| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821 |
- /******/ (function() { // webpackBootstrap
- /******/ var __webpack_modules__ = ({
- /***/ 6411:
- /***/ (function(module, exports) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- autosize 4.0.4
- license: MIT
- http://www.jacklmoore.com/autosize
- */
- (function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
- })(this, function (module, exports) {
- 'use strict';
- var map = typeof Map === "function" ? new Map() : function () {
- var keys = [];
- var values = [];
- return {
- has: function has(key) {
- return keys.indexOf(key) > -1;
- },
- get: function get(key) {
- return values[keys.indexOf(key)];
- },
- set: function set(key, value) {
- if (keys.indexOf(key) === -1) {
- keys.push(key);
- values.push(value);
- }
- },
- delete: function _delete(key) {
- var index = keys.indexOf(key);
- if (index > -1) {
- keys.splice(index, 1);
- values.splice(index, 1);
- }
- }
- };
- }();
- var createEvent = function createEvent(name) {
- return new Event(name, { bubbles: true });
- };
- try {
- new Event('test');
- } catch (e) {
- // IE does not support `new Event()`
- createEvent = function createEvent(name) {
- var evt = document.createEvent('Event');
- evt.initEvent(name, true, false);
- return evt;
- };
- }
- function assign(ta) {
- if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
- var heightOffset = null;
- var clientWidth = null;
- var cachedHeight = null;
- function init() {
- var style = window.getComputedStyle(ta, null);
- if (style.resize === 'vertical') {
- ta.style.resize = 'none';
- } else if (style.resize === 'both') {
- ta.style.resize = 'horizontal';
- }
- if (style.boxSizing === 'content-box') {
- heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
- } else {
- heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
- }
- // Fix when a textarea is not on document body and heightOffset is Not a Number
- if (isNaN(heightOffset)) {
- heightOffset = 0;
- }
- update();
- }
- function changeOverflow(value) {
- {
- // Chrome/Safari-specific fix:
- // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
- // made available by removing the scrollbar. The following forces the necessary text reflow.
- var width = ta.style.width;
- ta.style.width = '0px';
- // Force reflow:
- /* jshint ignore:start */
- ta.offsetWidth;
- /* jshint ignore:end */
- ta.style.width = width;
- }
- ta.style.overflowY = value;
- }
- function getParentOverflows(el) {
- var arr = [];
- while (el && el.parentNode && el.parentNode instanceof Element) {
- if (el.parentNode.scrollTop) {
- arr.push({
- node: el.parentNode,
- scrollTop: el.parentNode.scrollTop
- });
- }
- el = el.parentNode;
- }
- return arr;
- }
- function resize() {
- if (ta.scrollHeight === 0) {
- // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
- return;
- }
- var overflows = getParentOverflows(ta);
- var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
- ta.style.height = '';
- ta.style.height = ta.scrollHeight + heightOffset + 'px';
- // used to check if an update is actually necessary on window.resize
- clientWidth = ta.clientWidth;
- // prevents scroll-position jumping
- overflows.forEach(function (el) {
- el.node.scrollTop = el.scrollTop;
- });
- if (docTop) {
- document.documentElement.scrollTop = docTop;
- }
- }
- function update() {
- resize();
- var styleHeight = Math.round(parseFloat(ta.style.height));
- var computed = window.getComputedStyle(ta, null);
- // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
- var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
- // The actual height not matching the style height (set via the resize method) indicates that
- // the max-height has been exceeded, in which case the overflow should be allowed.
- if (actualHeight < styleHeight) {
- if (computed.overflowY === 'hidden') {
- changeOverflow('scroll');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- } else {
- // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
- if (computed.overflowY !== 'hidden') {
- changeOverflow('hidden');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- }
- if (cachedHeight !== actualHeight) {
- cachedHeight = actualHeight;
- var evt = createEvent('autosize:resized');
- try {
- ta.dispatchEvent(evt);
- } catch (err) {
- // Firefox will throw an error on dispatchEvent for a detached element
- // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
- }
- }
- }
- var pageResize = function pageResize() {
- if (ta.clientWidth !== clientWidth) {
- update();
- }
- };
- var destroy = function (style) {
- window.removeEventListener('resize', pageResize, false);
- ta.removeEventListener('input', update, false);
- ta.removeEventListener('keyup', update, false);
- ta.removeEventListener('autosize:destroy', destroy, false);
- ta.removeEventListener('autosize:update', update, false);
- Object.keys(style).forEach(function (key) {
- ta.style[key] = style[key];
- });
- map.delete(ta);
- }.bind(ta, {
- height: ta.style.height,
- resize: ta.style.resize,
- overflowY: ta.style.overflowY,
- overflowX: ta.style.overflowX,
- wordWrap: ta.style.wordWrap
- });
- ta.addEventListener('autosize:destroy', destroy, false);
- // IE9 does not fire onpropertychange or oninput for deletions,
- // so binding to onkeyup to catch most of those events.
- // There is no way that I know of to detect something like 'cut' in IE9.
- if ('onpropertychange' in ta && 'oninput' in ta) {
- ta.addEventListener('keyup', update, false);
- }
- window.addEventListener('resize', pageResize, false);
- ta.addEventListener('input', update, false);
- ta.addEventListener('autosize:update', update, false);
- ta.style.overflowX = 'hidden';
- ta.style.wordWrap = 'break-word';
- map.set(ta, {
- destroy: destroy,
- update: update
- });
- init();
- }
- function destroy(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.destroy();
- }
- }
- function update(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.update();
- }
- }
- var autosize = null;
- // Do nothing in Node.js environment and IE8 (or lower)
- if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
- autosize = function autosize(el) {
- return el;
- };
- autosize.destroy = function (el) {
- return el;
- };
- autosize.update = function (el) {
- return el;
- };
- } else {
- autosize = function autosize(el, options) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], function (x) {
- return assign(x, options);
- });
- }
- return el;
- };
- autosize.destroy = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], destroy);
- }
- return el;
- };
- autosize.update = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], update);
- }
- return el;
- };
- }
- exports.default = autosize;
- module.exports = exports['default'];
- });
- /***/ }),
- /***/ 4403:
- /***/ (function(module, exports) {
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
- */
- /* global define */
- (function () {
- 'use strict';
- var hasOwn = {}.hasOwnProperty;
- function classNames() {
- var classes = [];
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if (!arg) continue;
- var argType = typeof arg;
- if (argType === 'string' || argType === 'number') {
- classes.push(arg);
- } else if (Array.isArray(arg)) {
- if (arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- }
- } else if (argType === 'object') {
- if (arg.toString === Object.prototype.toString) {
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- } else {
- classes.push(arg.toString());
- }
- }
- }
- return classes.join(' ');
- }
- if ( true && module.exports) {
- classNames.default = classNames;
- module.exports = classNames;
- } else if (true) {
- // register as 'classnames', consistent with npm package name
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return classNames;
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- }());
- /***/ }),
- /***/ 4827:
- /***/ (function(module) {
- // This code has been refactored for 140 bytes
- // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
- var computedStyle = function (el, prop, getComputedStyle) {
- getComputedStyle = window.getComputedStyle;
- // In one fell swoop
- return (
- // If we have getComputedStyle
- getComputedStyle ?
- // Query it
- // TODO: From CSS-Query notes, we might need (node, null) for FF
- getComputedStyle(el) :
- // Otherwise, we are in IE and use currentStyle
- el.currentStyle
- )[
- // Switch to camelCase for CSSOM
- // DEV: Grabbed from jQuery
- // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
- // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
- prop.replace(/-(\w)/gi, function (word, letter) {
- return letter.toUpperCase();
- })
- ];
- };
- module.exports = computedStyle;
- /***/ }),
- /***/ 8981:
- /***/ (function(module, exports) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
- // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
- // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
- // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
- // v4 adds AMD/UMD, commonJS, and plain browser support
- // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
- // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
- // https://github.com/rndme/download
- (function (root, factory) {
- if (true) {
- // AMD. Register as an anonymous module.
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- }(this, function () {
- return function download(data, strFileName, strMimeType) {
- var self = window, // this script is only for browsers anyway...
- defaultMime = "application/octet-stream", // this default mime also triggers iframe downloads
- mimeType = strMimeType || defaultMime,
- payload = data,
- url = !strFileName && !strMimeType && payload,
- anchor = document.createElement("a"),
- toString = function(a){return String(a);},
- myBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString),
- fileName = strFileName || "download",
- blob,
- reader;
- myBlob= myBlob.call ? myBlob.bind(self) : Blob ;
-
- if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
- payload=[payload, mimeType];
- mimeType=payload[0];
- payload=payload[1];
- }
- if(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument
- fileName = url.split("/").pop().split("?")[0];
- anchor.href = url; // assign href prop to temp anchor
- if(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path:
- var ajax=new XMLHttpRequest();
- ajax.open( "GET", url, true);
- ajax.responseType = 'blob';
- ajax.onload= function(e){
- download(e.target.response, fileName, defaultMime);
- };
- setTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return:
- return ajax;
- } // end if valid url?
- } // end if url?
- //go ahead and download dataURLs right away
- if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){
-
- if(payload.length > (1024*1024*1.999) && myBlob !== toString ){
- payload=dataUrlToBlob(payload);
- mimeType=payload.type || defaultMime;
- }else{
- return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs:
- navigator.msSaveBlob(dataUrlToBlob(payload), fileName) :
- saver(payload) ; // everyone else can save dataURLs un-processed
- }
-
- }else{//not data url, is it a string with special needs?
- if(/([\x80-\xff])/.test(payload)){
- var i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length;
- for(i;i<mx;++i) tempUiArr[i]= payload.charCodeAt(i);
- payload=new myBlob([tempUiArr], {type: mimeType});
- }
- }
- blob = payload instanceof myBlob ?
- payload :
- new myBlob([payload], {type: mimeType}) ;
- function dataUrlToBlob(strUrl) {
- var parts= strUrl.split(/[:;,]/),
- type= parts[1],
- decoder= parts[2] == "base64" ? atob : decodeURIComponent,
- binData= decoder( parts.pop() ),
- mx= binData.length,
- i= 0,
- uiArr= new Uint8Array(mx);
- for(i;i<mx;++i) uiArr[i]= binData.charCodeAt(i);
- return new myBlob([uiArr], {type: type});
- }
- function saver(url, winMode){
- if ('download' in anchor) { //html5 A[download]
- anchor.href = url;
- anchor.setAttribute("download", fileName);
- anchor.className = "download-js-link";
- anchor.innerHTML = "downloading...";
- anchor.style.display = "none";
- document.body.appendChild(anchor);
- setTimeout(function() {
- anchor.click();
- document.body.removeChild(anchor);
- if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(anchor.href);}, 250 );}
- }, 66);
- return true;
- }
- // handle non-a[download] safari as best we can:
- if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
- if(/^data:/.test(url)) url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
- if(!window.open(url)){ // popup blocked, offer direct download:
- if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
- }
- return true;
- }
- //do iframe dataURL download (old ch+FF):
- var f = document.createElement("iframe");
- document.body.appendChild(f);
- if(!winMode && /^data:/.test(url)){ // force a mime that will download:
- url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
- }
- f.src=url;
- setTimeout(function(){ document.body.removeChild(f); }, 333);
- }//end saver
- if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL)
- return navigator.msSaveBlob(blob, fileName);
- }
- if(self.URL){ // simple fast and modern way using Blob and URL:
- saver(self.URL.createObjectURL(blob), true);
- }else{
- // handle non-Blob()+non-URL browsers:
- if(typeof blob === "string" || blob.constructor===toString ){
- try{
- return saver( "data:" + mimeType + ";base64," + self.btoa(blob) );
- }catch(y){
- return saver( "data:" + mimeType + "," + encodeURIComponent(blob) );
- }
- }
- // Blob but not URL support:
- reader=new FileReader();
- reader.onload=function(e){
- saver(this.result);
- };
- reader.readAsDataURL(blob);
- }
- return true;
- }; /* end download() */
- }));
- /***/ }),
- /***/ 9894:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- // Load in dependencies
- var computedStyle = __webpack_require__(4827);
- /**
- * Calculate the `line-height` of a given node
- * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
- * @returns {Number} `line-height` of the element in pixels
- */
- function lineHeight(node) {
- // Grab the line-height via style
- var lnHeightStr = computedStyle(node, 'line-height');
- var lnHeight = parseFloat(lnHeightStr, 10);
- // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
- if (lnHeightStr === lnHeight + '') {
- // Save the old lineHeight style and update the em unit to the element
- var _lnHeightStyle = node.style.lineHeight;
- node.style.lineHeight = lnHeightStr + 'em';
- // Calculate the em based height
- lnHeightStr = computedStyle(node, 'line-height');
- lnHeight = parseFloat(lnHeightStr, 10);
- // Revert the lineHeight style
- if (_lnHeightStyle) {
- node.style.lineHeight = _lnHeightStyle;
- } else {
- delete node.style.lineHeight;
- }
- }
- // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
- // DEV: `em` units are converted to `pt` in IE6
- // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
- if (lnHeightStr.indexOf('pt') !== -1) {
- lnHeight *= 4;
- lnHeight /= 3;
- // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
- } else if (lnHeightStr.indexOf('mm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 25.4;
- // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
- } else if (lnHeightStr.indexOf('cm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 2.54;
- // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
- } else if (lnHeightStr.indexOf('in') !== -1) {
- lnHeight *= 96;
- // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
- } else if (lnHeightStr.indexOf('pc') !== -1) {
- lnHeight *= 16;
- }
- // Continue our computation
- lnHeight = Math.round(lnHeight);
- // If the line-height is "normal", calculate by font-size
- if (lnHeightStr === 'normal') {
- // Create a temporary node
- var nodeName = node.nodeName;
- var _node = document.createElement(nodeName);
- _node.innerHTML = ' ';
- // If we have a text area, reset it to only 1 row
- // https://github.com/twolfson/line-height/issues/4
- if (nodeName.toUpperCase() === 'TEXTAREA') {
- _node.setAttribute('rows', '1');
- }
- // Set the font-size of the element
- var fontSizeStr = computedStyle(node, 'font-size');
- _node.style.fontSize = fontSizeStr;
- // Remove default padding/border which can affect offset height
- // https://github.com/twolfson/line-height/issues/4
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
- _node.style.padding = '0px';
- _node.style.border = '0px';
- // Append it to the body
- var body = document.body;
- body.appendChild(_node);
- // Assume the line height of the element is the height
- var height = _node.offsetHeight;
- lnHeight = height;
- // Remove our child from the DOM
- body.removeChild(_node);
- }
- // Return the calculated height
- return lnHeight;
- }
- // Export lineHeight
- module.exports = lineHeight;
- /***/ }),
- /***/ 5372:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var ReactPropTypesSecret = __webpack_require__(9567);
- function emptyFunction() {}
- function emptyFunctionWithReset() {}
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
- module.exports = function() {
- function shim(props, propName, componentName, location, propFullName, secret) {
- if (secret === ReactPropTypesSecret) {
- // It is still safe when called from React.
- return;
- }
- var err = new Error(
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
- 'Use PropTypes.checkPropTypes() to call them. ' +
- 'Read more at http://fb.me/use-check-prop-types'
- );
- err.name = 'Invariant Violation';
- throw err;
- };
- shim.isRequired = shim;
- function getShim() {
- return shim;
- };
- // Important!
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
- var ReactPropTypes = {
- array: shim,
- bigint: shim,
- bool: shim,
- func: shim,
- number: shim,
- object: shim,
- string: shim,
- symbol: shim,
- any: shim,
- arrayOf: getShim,
- element: shim,
- elementType: shim,
- instanceOf: getShim,
- node: shim,
- objectOf: getShim,
- oneOf: getShim,
- oneOfType: getShim,
- shape: getShim,
- exact: getShim,
- checkPropTypes: emptyFunctionWithReset,
- resetWarningCache: emptyFunction
- };
- ReactPropTypes.PropTypes = ReactPropTypes;
- return ReactPropTypes;
- };
- /***/ }),
- /***/ 2652:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- if (false) { var throwOnDirectAccess, ReactIs; } else {
- // By explicitly using `prop-types` you are opting into new production behavior.
- // http://fb.me/prop-types-in-prod
- module.exports = __webpack_require__(5372)();
- }
- /***/ }),
- /***/ 9567:
- /***/ (function(module) {
- "use strict";
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
- module.exports = ReactPropTypesSecret;
- /***/ }),
- /***/ 5438:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var __assign = (this && this.__assign) || Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
- };
- var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
- t[p[i]] = s[p[i]];
- return t;
- };
- exports.__esModule = true;
- var React = __webpack_require__(9196);
- var PropTypes = __webpack_require__(2652);
- var autosize = __webpack_require__(6411);
- var _getLineHeight = __webpack_require__(9894);
- var getLineHeight = _getLineHeight;
- var RESIZED = "autosize:resized";
- /**
- * A light replacement for built-in textarea component
- * which automaticaly adjusts its height to match the content
- */
- var TextareaAutosizeClass = /** @class */ (function (_super) {
- __extends(TextareaAutosizeClass, _super);
- function TextareaAutosizeClass() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.state = {
- lineHeight: null
- };
- _this.textarea = null;
- _this.onResize = function (e) {
- if (_this.props.onResize) {
- _this.props.onResize(e);
- }
- };
- _this.updateLineHeight = function () {
- if (_this.textarea) {
- _this.setState({
- lineHeight: getLineHeight(_this.textarea)
- });
- }
- };
- _this.onChange = function (e) {
- var onChange = _this.props.onChange;
- _this.currentValue = e.currentTarget.value;
- onChange && onChange(e);
- };
- return _this;
- }
- TextareaAutosizeClass.prototype.componentDidMount = function () {
- var _this = this;
- var _a = this.props, maxRows = _a.maxRows, async = _a.async;
- if (typeof maxRows === "number") {
- this.updateLineHeight();
- }
- if (typeof maxRows === "number" || async) {
- /*
- the defer is needed to:
- - force "autosize" to activate the scrollbar when this.props.maxRows is passed
- - support StyledComponents (see #71)
- */
- setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
- }
- else {
- this.textarea && autosize(this.textarea);
- }
- if (this.textarea) {
- this.textarea.addEventListener(RESIZED, this.onResize);
- }
- };
- TextareaAutosizeClass.prototype.componentWillUnmount = function () {
- if (this.textarea) {
- this.textarea.removeEventListener(RESIZED, this.onResize);
- autosize.destroy(this.textarea);
- }
- };
- TextareaAutosizeClass.prototype.render = function () {
- var _this = this;
- var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
- var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
- return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
- _this.textarea = element;
- if (typeof _this.props.innerRef === 'function') {
- _this.props.innerRef(element);
- }
- else if (_this.props.innerRef) {
- _this.props.innerRef.current = element;
- }
- } }), children));
- };
- TextareaAutosizeClass.prototype.componentDidUpdate = function () {
- this.textarea && autosize.update(this.textarea);
- };
- TextareaAutosizeClass.defaultProps = {
- rows: 1,
- async: false
- };
- TextareaAutosizeClass.propTypes = {
- rows: PropTypes.number,
- maxRows: PropTypes.number,
- onResize: PropTypes.func,
- innerRef: PropTypes.any,
- async: PropTypes.bool
- };
- return TextareaAutosizeClass;
- }(React.Component));
- exports.TextareaAutosize = React.forwardRef(function (props, ref) {
- return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
- });
- /***/ }),
- /***/ 773:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- "use strict";
- var __webpack_unused_export__;
- __webpack_unused_export__ = true;
- var TextareaAutosize_1 = __webpack_require__(5438);
- exports.Z = TextareaAutosize_1.TextareaAutosize;
- /***/ }),
- /***/ 9196:
- /***/ (function(module) {
- "use strict";
- module.exports = window["React"];
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ !function() {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function() { return module['default']; } :
- /******/ function() { return module; };
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ !function() {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = function(exports, definition) {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ !function() {
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
- /******/ }();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ !function() {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ }();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- !function() {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, {
- "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; },
- "PluginSidebar": function() { return /* reexport */ PluginSidebarEditSite; },
- "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; },
- "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; },
- "__experimentalNavigationToggle": function() { return /* reexport */ navigation_toggle; },
- "initializeEditor": function() { return /* binding */ initializeEditor; },
- "reinitializeEditor": function() { return /* binding */ reinitializeEditor; }
- });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
- var actions_namespaceObject = {};
- __webpack_require__.r(actions_namespaceObject);
- __webpack_require__.d(actions_namespaceObject, {
- "disableComplementaryArea": function() { return disableComplementaryArea; },
- "enableComplementaryArea": function() { return enableComplementaryArea; },
- "pinItem": function() { return pinItem; },
- "setFeatureDefaults": function() { return setFeatureDefaults; },
- "setFeatureValue": function() { return setFeatureValue; },
- "toggleFeature": function() { return toggleFeature; },
- "unpinItem": function() { return unpinItem; }
- });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
- var selectors_namespaceObject = {};
- __webpack_require__.r(selectors_namespaceObject);
- __webpack_require__.d(selectors_namespaceObject, {
- "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
- "isFeatureActive": function() { return isFeatureActive; },
- "isItemPinned": function() { return isItemPinned; }
- });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
- var store_actions_namespaceObject = {};
- __webpack_require__.r(store_actions_namespaceObject);
- __webpack_require__.d(store_actions_namespaceObject, {
- "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; },
- "addTemplate": function() { return addTemplate; },
- "closeGeneralSidebar": function() { return closeGeneralSidebar; },
- "openGeneralSidebar": function() { return openGeneralSidebar; },
- "openNavigationPanelToMenu": function() { return openNavigationPanelToMenu; },
- "removeTemplate": function() { return removeTemplate; },
- "revertTemplate": function() { return revertTemplate; },
- "setHomeTemplateId": function() { return setHomeTemplateId; },
- "setIsInserterOpened": function() { return setIsInserterOpened; },
- "setIsListViewOpened": function() { return setIsListViewOpened; },
- "setIsNavigationPanelOpened": function() { return setIsNavigationPanelOpened; },
- "setNavigationPanelActiveMenu": function() { return setNavigationPanelActiveMenu; },
- "setPage": function() { return setPage; },
- "setTemplate": function() { return setTemplate; },
- "setTemplatePart": function() { return setTemplatePart; },
- "switchEditorMode": function() { return switchEditorMode; },
- "toggleFeature": function() { return actions_toggleFeature; },
- "updateSettings": function() { return updateSettings; }
- });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
- var store_selectors_namespaceObject = {};
- __webpack_require__.r(store_selectors_namespaceObject);
- __webpack_require__.d(store_selectors_namespaceObject, {
- "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
- "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; },
- "__unstableGetPreference": function() { return __unstableGetPreference; },
- "getCanUserCreateMedia": function() { return getCanUserCreateMedia; },
- "getCurrentTemplateNavigationPanelSubMenu": function() { return getCurrentTemplateNavigationPanelSubMenu; },
- "getCurrentTemplateTemplateParts": function() { return getCurrentTemplateTemplateParts; },
- "getEditedPostId": function() { return getEditedPostId; },
- "getEditedPostType": function() { return getEditedPostType; },
- "getEditorMode": function() { return getEditorMode; },
- "getHomeTemplateId": function() { return getHomeTemplateId; },
- "getNavigationPanelActiveMenu": function() { return getNavigationPanelActiveMenu; },
- "getPage": function() { return getPage; },
- "getReusableBlocks": function() { return getReusableBlocks; },
- "getSettings": function() { return getSettings; },
- "isFeatureActive": function() { return selectors_isFeatureActive; },
- "isInserterOpened": function() { return isInserterOpened; },
- "isListViewOpened": function() { return isListViewOpened; },
- "isNavigationOpened": function() { return isNavigationOpened; }
- });
- ;// CONCATENATED MODULE: external ["wp","element"]
- var external_wp_element_namespaceObject = window["wp"]["element"];
- ;// CONCATENATED MODULE: external ["wp","blocks"]
- var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
- ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
- var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
- ;// CONCATENATED MODULE: external ["wp","data"]
- var external_wp_data_namespaceObject = window["wp"]["data"];
- ;// CONCATENATED MODULE: external ["wp","coreData"]
- var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
- ;// CONCATENATED MODULE: external ["wp","editor"]
- var external_wp_editor_namespaceObject = window["wp"]["editor"];
- ;// CONCATENATED MODULE: external ["wp","preferences"]
- var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
- ;// CONCATENATED MODULE: external ["wp","i18n"]
- var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
- ;// CONCATENATED MODULE: external ["wp","viewport"]
- var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
- ;// CONCATENATED MODULE: external ["wp","url"]
- var external_wp_url_namespaceObject = window["wp"]["url"];
- ;// CONCATENATED MODULE: external ["wp","hooks"]
- var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
- ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
- var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/components.js
- /**
- * WordPress dependencies
- */
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js
- /**
- * Internal dependencies
- */
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js
- /**
- * The identifier for the data store.
- *
- * @type {string}
- */
- const STORE_NAME = 'core/edit-site';
- const TEMPLATE_PART_AREA_HEADER = 'header';
- const TEMPLATE_PART_AREA_FOOTER = 'footer';
- const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
- const TEMPLATE_PART_AREA_GENERAL = 'uncategorized';
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/constants.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search'];
- const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single-post', 'front-page'];
- const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY];
- const TEMPLATES_GENERAL = ['page-home'];
- const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-'];
- const TEMPLATES_PAGES_PREFIXES = ['page-'];
- const TEMPLATE_OVERRIDES = {
- singular: ['single', 'page'],
- index: ['archive', '404', 'search', 'singular', 'home'],
- home: ['front-page']
- };
- const MENU_ROOT = 'root';
- const MENU_TEMPLATE_PARTS = 'template-parts';
- const MENU_TEMPLATES = 'templates';
- const MENU_TEMPLATES_GENERAL = 'templates-general';
- const MENU_TEMPLATES_PAGES = 'templates-pages';
- const MENU_TEMPLATES_POSTS = 'templates-posts';
- const MENU_TEMPLATES_UNUSED = 'templates-unused';
- const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
- const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
- const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
- const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';
- const TEMPLATE_PARTS_SUB_MENUS = [{
- area: TEMPLATE_PART_AREA_HEADER,
- menu: MENU_TEMPLATE_PARTS_HEADERS,
- title: (0,external_wp_i18n_namespaceObject.__)('headers')
- }, {
- area: TEMPLATE_PART_AREA_FOOTER,
- menu: MENU_TEMPLATE_PARTS_FOOTERS,
- title: (0,external_wp_i18n_namespaceObject.__)('footers')
- }, {
- area: TEMPLATE_PART_AREA_SIDEBAR,
- menu: MENU_TEMPLATE_PARTS_SIDEBARS,
- title: (0,external_wp_i18n_namespaceObject.__)('sidebars')
- }, {
- area: TEMPLATE_PART_AREA_GENERAL,
- menu: MENU_TEMPLATE_PARTS_GENERAL,
- title: (0,external_wp_i18n_namespaceObject.__)('general')
- }];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Reducer returning the editing canvas device type.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function deviceType() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'SET_PREVIEW_DEVICE_TYPE':
- return action.deviceType;
- }
- return state;
- }
- /**
- * Reducer returning the settings.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function settings() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'UPDATE_SETTINGS':
- return { ...state,
- ...action.settings
- };
- }
- return state;
- }
- /**
- * Reducer keeping track of the currently edited Post Type,
- * Post Id and the context provided to fill the content of the block editor.
- *
- * @param {Object} state Current edited post.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function editedPost() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'SET_TEMPLATE':
- case 'SET_PAGE':
- return {
- type: 'wp_template',
- id: action.templateId,
- page: action.page
- };
- case 'SET_TEMPLATE_PART':
- return {
- type: 'wp_template_part',
- id: action.templatePartId
- };
- }
- return state;
- }
- /**
- * Reducer for information about the site's homepage.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function homeTemplateId(state, action) {
- switch (action.type) {
- case 'SET_HOME_TEMPLATE':
- return action.homeTemplateId;
- }
- return state;
- }
- /**
- * Reducer for information about the navigation panel, such as its active menu
- * and whether it should be opened or closed.
- *
- * Note: this reducer interacts with the inserter and list view panels reducers
- * to make sure that only one of the three panels is open at the same time.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- */
- function navigationPanel() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
- menu: MENU_ROOT,
- isOpen: false
- };
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'SET_NAVIGATION_PANEL_ACTIVE_MENU':
- return { ...state,
- menu: action.menu
- };
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
- return { ...state,
- isOpen: true,
- menu: action.menu
- };
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
- return { ...state,
- menu: !action.isOpen ? MENU_ROOT : state.menu,
- // Set menu to root when closing panel.
- isOpen: action.isOpen
- };
- case 'SET_IS_LIST_VIEW_OPENED':
- return { ...state,
- menu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu,
- // Set menu to root when closing panel.
- isOpen: action.isOpen ? false : state.isOpen
- };
- case 'SET_IS_INSERTER_OPENED':
- return { ...state,
- menu: state.isOpen && action.value ? MENU_ROOT : state.menu,
- // Set menu to root when closing panel.
- isOpen: action.value ? false : state.isOpen
- };
- }
- return state;
- }
- /**
- * Reducer to set the block inserter panel open or closed.
- *
- * Note: this reducer interacts with the navigation and list view panels reducers
- * to make sure that only one of the three panels is open at the same time.
- *
- * @param {boolean|Object} state Current state.
- * @param {Object} action Dispatched action.
- */
- function blockInserterPanel() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
- return false;
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
- case 'SET_IS_LIST_VIEW_OPENED':
- return action.isOpen ? false : state;
- case 'SET_IS_INSERTER_OPENED':
- return action.value;
- }
- return state;
- }
- /**
- * Reducer to set the list view panel open or closed.
- *
- * Note: this reducer interacts with the navigation and inserter panels reducers
- * to make sure that only one of the three panels is open at the same time.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- */
- function listViewPanel() {
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- let action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
- return false;
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
- return action.isOpen ? false : state;
- case 'SET_IS_INSERTER_OPENED':
- return action.value ? false : state;
- case 'SET_IS_LIST_VIEW_OPENED':
- return action.isOpen;
- }
- return state;
- }
- /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
- deviceType,
- settings,
- editedPost,
- homeTemplateId,
- navigationPanel,
- blockInserterPanel,
- listViewPanel
- }));
- ;// CONCATENATED MODULE: external ["wp","apiFetch"]
- var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
- var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
- ;// CONCATENATED MODULE: external ["wp","deprecated"]
- var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
- var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
- ;// CONCATENATED MODULE: external ["wp","notices"]
- var external_wp_notices_namespaceObject = window["wp"]["notices"];
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
- function extends_extends() {
- extends_extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return extends_extends.apply(this, arguments);
- }
- // EXTERNAL MODULE: ./node_modules/classnames/index.js
- var classnames = __webpack_require__(4403);
- var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
- ;// CONCATENATED MODULE: external ["wp","components"]
- var external_wp_components_namespaceObject = window["wp"]["components"];
- ;// CONCATENATED MODULE: external ["wp","primitives"]
- var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
- /**
- * WordPress dependencies
- */
- const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
- }));
- /* harmony default export */ var library_check = (check);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
- /**
- * WordPress dependencies
- */
- const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
- }));
- /* harmony default export */ var star_filled = (starFilled);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
- /**
- * WordPress dependencies
- */
- const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
- clipRule: "evenodd"
- }));
- /* harmony default export */ var star_empty = (starEmpty);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
- /**
- * WordPress dependencies
- */
- const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
- }));
- /* harmony default export */ var close_small = (closeSmall);
- ;// CONCATENATED MODULE: external "lodash"
- var external_lodash_namespaceObject = window["lodash"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
- /**
- * WordPress dependencies
- */
- /**
- * Enable the complementary area.
- *
- * @param {string} scope Complementary area scope.
- * @param {string} area Area identifier.
- */
- const enableComplementaryArea = (scope, area) => _ref => {
- let {
- registry
- } = _ref;
- // Return early if there's no area.
- if (!area) {
- return;
- }
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area);
- };
- /**
- * Disable the complementary area.
- *
- * @param {string} scope Complementary area scope.
- */
- const disableComplementaryArea = scope => _ref2 => {
- let {
- registry
- } = _ref2;
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null);
- };
- /**
- * Pins an item.
- *
- * @param {string} scope Item scope.
- * @param {string} item Item identifier.
- *
- * @return {Object} Action object.
- */
- const pinItem = (scope, item) => _ref3 => {
- let {
- registry
- } = _ref3;
- // Return early if there's no item.
- if (!item) {
- return;
- }
- const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
- if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
- return;
- }
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
- [item]: true
- });
- };
- /**
- * Unpins an item.
- *
- * @param {string} scope Item scope.
- * @param {string} item Item identifier.
- */
- const unpinItem = (scope, item) => _ref4 => {
- let {
- registry
- } = _ref4;
- // Return early if there's no item.
- if (!item) {
- return;
- }
- const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
- [item]: false
- });
- };
- /**
- * Returns an action object used in signalling that a feature should be toggled.
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {string} featureName The feature name.
- */
- function toggleFeature(scope, featureName) {
- return function (_ref5) {
- let {
- registry
- } = _ref5;
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).toggle`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
- };
- }
- /**
- * Returns an action object used in signalling that a feature should be set to
- * a true or false value
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {string} featureName The feature name.
- * @param {boolean} value The value to set.
- *
- * @return {Object} Action object.
- */
- function setFeatureValue(scope, featureName, value) {
- return function (_ref6) {
- let {
- registry
- } = _ref6;
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).set`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
- };
- }
- /**
- * Returns an action object used in signalling that defaults should be set for features.
- *
- * @param {string} scope The feature scope (e.g. core/edit-post).
- * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
- *
- * @return {Object} Action object.
- */
- function setFeatureDefaults(scope, defaults) {
- return function (_ref7) {
- let {
- registry
- } = _ref7;
- external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
- since: '6.0',
- alternative: `dispatch( 'core/preferences' ).setDefaults`
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
- };
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
- /**
- * WordPress dependencies
- */
- /**
- * Returns the complementary area that is active in a given scope.
- *
- * @param {Object} state Global application state.
- * @param {string} scope Item scope.
- *
- * @return {string} The complementary area that is active in the given scope.
- */
- const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
- return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea');
- });
- /**
- * Returns a boolean indicating if an item is pinned or not.
- *
- * @param {Object} state Global application state.
- * @param {string} scope Scope.
- * @param {string} item Item to check.
- *
- * @return {boolean} True if the item is pinned and false otherwise.
- */
- const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
- var _pinnedItems$item;
- const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
- return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
- });
- /**
- * Returns a boolean indicating whether a feature is active for a particular
- * scope.
- *
- * @param {Object} state The store state.
- * @param {string} scope The scope of the feature (e.g. core/edit-post).
- * @param {string} featureName The name of the feature.
- *
- * @return {boolean} Is the feature enabled?
- */
- const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
- external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
- since: '6.0',
- alternative: `select( 'core/preferences' ).get( scope, featureName )`
- });
- return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
- });
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
- /**
- * The identifier for the data store.
- *
- * @type {string}
- */
- const constants_STORE_NAME = 'core/interface';
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Store definition for the interface namespace.
- *
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
- *
- * @type {Object}
- */
- const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
- reducer: () => {},
- actions: actions_namespaceObject,
- selectors: selectors_namespaceObject
- }); // Once we build a more generic persistence plugin that works across types of stores
- // we'd be able to replace this with a register call.
- (0,external_wp_data_namespaceObject.register)(store);
- ;// CONCATENATED MODULE: external ["wp","plugins"]
- var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
- /**
- * WordPress dependencies
- */
- /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
- return {
- icon: ownProps.icon || context.icon,
- identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
- };
- }));
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ComplementaryAreaToggle(_ref) {
- let {
- as = external_wp_components_namespaceObject.Button,
- scope,
- identifier,
- icon,
- selectedIcon,
- ...props
- } = _ref;
- const ComponentToUse = as;
- const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, extends_extends({
- icon: selectedIcon && isSelected ? selectedIcon : icon,
- onClick: () => {
- if (isSelected) {
- disableComplementaryArea(scope);
- } else {
- enableComplementaryArea(scope, identifier);
- }
- }
- }, (0,external_lodash_namespaceObject.omit)(props, ['name'])));
- }
- /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const ComplementaryAreaHeader = _ref => {
- let {
- smallScreenTitle,
- children,
- className,
- toggleButtonProps
- } = _ref;
- const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({
- icon: close_small
- }, toggleButtonProps));
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "components-panel__header interface-complementary-area-header__small"
- }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
- className: "interface-complementary-area-header__small-title"
- }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
- tabIndex: -1
- }, children, toggleButton));
- };
- /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function ActionItemSlot(_ref) {
- let {
- name,
- as: Component = external_wp_components_namespaceObject.ButtonGroup,
- fillProps = {},
- bubblesVirtually,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
- name: name,
- bubblesVirtually: bubblesVirtually,
- fillProps: fillProps
- }, fills => {
- if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) {
- return null;
- } // Special handling exists for backward compatibility.
- // It ensures that menu items created by plugin authors aren't
- // duplicated with automatically injected menu items coming
- // from pinnable plugin sidebars.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- const initializedByPlugins = [];
- external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
- let {
- props: {
- __unstableExplicitMenuItem,
- __unstableTarget
- }
- } = _ref2;
- if (__unstableTarget && __unstableExplicitMenuItem) {
- initializedByPlugins.push(__unstableTarget);
- }
- });
- const children = external_wp_element_namespaceObject.Children.map(fills, child => {
- if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
- return null;
- }
- return child;
- });
- return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
- });
- }
- function ActionItem(_ref3) {
- let {
- name,
- as: Component = external_wp_components_namespaceObject.Button,
- onClick,
- ...props
- } = _ref3;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
- name: name
- }, _ref4 => {
- let {
- onClick: fpOnClick
- } = _ref4;
- return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({
- onClick: onClick || fpOnClick ? function () {
- (onClick || external_lodash_namespaceObject.noop)(...arguments);
- (fpOnClick || external_lodash_namespaceObject.noop)(...arguments);
- } : undefined
- }, props));
- });
- }
- ActionItem.Slot = ActionItemSlot;
- /* harmony default export */ var action_item = (ActionItem);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility.
- // They are removed so they don't leak to DOM elements.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget']));
- function ComplementaryAreaMoreMenuItem(_ref) {
- let {
- scope,
- target,
- __unstableExplicitMenuItem,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({
- as: toggleProps => {
- return (0,external_wp_element_namespaceObject.createElement)(action_item, extends_extends({
- __unstableExplicitMenuItem: __unstableExplicitMenuItem,
- __unstableTarget: `${scope}/${target}`,
- as: PluginsMenuItem,
- name: `${scope}/plugin-more-menu`
- }, toggleProps));
- },
- role: "menuitemcheckbox",
- selectedIcon: library_check,
- name: target,
- scope: scope
- }, props));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PinnedItems(_ref) {
- let {
- scope,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, extends_extends({
- name: `PinnedItems/${scope}`
- }, props));
- }
- function PinnedItemsSlot(_ref2) {
- let {
- scope,
- className,
- ...props
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({
- name: `PinnedItems/${scope}`
- }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()(className, 'interface-pinned-items')
- }, fills));
- }
- PinnedItems.Slot = PinnedItemsSlot;
- /* harmony default export */ var pinned_items = (PinnedItems);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ComplementaryAreaSlot(_ref) {
- let {
- scope,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({
- name: `ComplementaryArea/${scope}`
- }, props));
- }
- function ComplementaryAreaFill(_ref2) {
- let {
- scope,
- children,
- className
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
- name: `ComplementaryArea/${scope}`
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: className
- }, children));
- }
- function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
- const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
- const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // If the complementary area is active and the editor is switching from a big to a small window size.
- if (isActive && isSmall && !previousIsSmall.current) {
- // Disable the complementary area.
- disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
- shouldOpenWhenNotSmall.current = true;
- } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
- // and we are going from a small to big window size.
- shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
- // Remove the flag indicating the complementary area should be enabled.
- shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
- enableComplementaryArea(scope, identifier);
- } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
- // remove the flag.
- shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
- shouldOpenWhenNotSmall.current = false;
- }
- if (isSmall !== previousIsSmall.current) {
- previousIsSmall.current = isSmall;
- }
- }, [isActive, isSmall, scope, identifier, activeArea]);
- }
- function ComplementaryArea(_ref3) {
- let {
- children,
- className,
- closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
- identifier,
- header,
- headerClassName,
- icon,
- isPinnable = true,
- panelClassName,
- scope,
- name,
- smallScreenTitle,
- title,
- toggleShortcut,
- isActiveByDefault,
- showIconLabels = false
- } = _ref3;
- const {
- isActive,
- isPinned,
- activeArea,
- isSmall,
- isLarge
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getActiveComplementaryArea,
- isItemPinned
- } = select(store);
- const _activeArea = getActiveComplementaryArea(scope);
- return {
- isActive: _activeArea === identifier,
- isPinned: isItemPinned(scope, identifier),
- activeArea: _activeArea,
- isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
- isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
- };
- }, [identifier, scope]);
- useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
- const {
- enableComplementaryArea,
- disableComplementaryArea,
- pinItem,
- unpinItem
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (isActiveByDefault && activeArea === undefined && !isSmall) {
- enableComplementaryArea(scope, identifier);
- }
- }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
- scope: scope
- }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
- scope: scope,
- identifier: identifier,
- isPressed: isActive && (!showIconLabels || isLarge),
- "aria-expanded": isActive,
- label: title,
- icon: showIconLabels ? library_check : icon,
- showTooltip: !showIconLabels,
- variant: showIconLabels ? 'tertiary' : undefined
- })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
- target: name,
- scope: scope,
- icon: icon
- }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
- className: classnames_default()('interface-complementary-area', className),
- scope: scope
- }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
- className: headerClassName,
- closeLabel: closeLabel,
- onClose: () => disableComplementaryArea(scope),
- smallScreenTitle: smallScreenTitle,
- toggleButtonProps: {
- label: closeLabel,
- shortcut: toggleShortcut,
- scope,
- identifier
- }
- }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: "interface-complementary-area__pin-unpin-item",
- icon: isPinned ? star_filled : star_empty,
- label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
- onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
- isPressed: isPinned,
- "aria-expanded": isPinned
- }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
- className: panelClassName
- }, children)));
- }
- const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
- ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
- /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
- ;// CONCATENATED MODULE: external ["wp","compose"]
- var external_wp_compose_namespaceObject = window["wp"]["compose"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * WordPress dependencies
- */
- function useHTMLClass(className) {
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- const element = document && document.querySelector(`html:not(.${className})`);
- if (!element) {
- return;
- }
- element.classList.toggle(className);
- return () => {
- element.classList.toggle(className);
- };
- }, [className]);
- }
- function InterfaceSkeleton(_ref, ref) {
- let {
- footer,
- header,
- sidebar,
- secondarySidebar,
- notices,
- content,
- drawer,
- actions,
- labels,
- className,
- shortcuts
- } = _ref;
- const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
- useHTMLClass('interface-interface-skeleton__html-container');
- const defaultLabels = {
- /* translators: accessibility text for the nav bar landmark region. */
- drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
- /* translators: accessibility text for the top bar landmark region. */
- header: (0,external_wp_i18n_namespaceObject.__)('Header'),
- /* translators: accessibility text for the content landmark region. */
- body: (0,external_wp_i18n_namespaceObject.__)('Content'),
- /* translators: accessibility text for the secondary sidebar landmark region. */
- secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
- /* translators: accessibility text for the settings landmark region. */
- sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
- /* translators: accessibility text for the publish landmark region. */
- actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
- /* translators: accessibility text for the footer landmark region. */
- footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
- };
- const mergedLabels = { ...defaultLabels,
- ...labels
- };
- return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, navigateRegionsProps, {
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
- className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
- }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__drawer",
- role: "region",
- "aria-label": mergedLabels.drawer,
- tabIndex: "-1"
- }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__editor"
- }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__header",
- role: "region",
- "aria-label": mergedLabels.header,
- tabIndex: "-1"
- }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__body"
- }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__secondary-sidebar",
- role: "region",
- "aria-label": mergedLabels.secondarySidebar,
- tabIndex: "-1"
- }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__notices"
- }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__content",
- role: "region",
- "aria-label": mergedLabels.body,
- tabIndex: "-1"
- }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__sidebar",
- role: "region",
- "aria-label": mergedLabels.sidebar,
- tabIndex: "-1"
- }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__actions",
- role: "region",
- "aria-label": mergedLabels.actions,
- tabIndex: "-1"
- }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-interface-skeleton__footer",
- role: "region",
- "aria-label": mergedLabels.footer,
- tabIndex: "-1"
- }, footer));
- }
- /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
- /**
- * WordPress dependencies
- */
- const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
- }));
- /* harmony default export */ var more_vertical = (moreVertical);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function MoreMenuDropdown(_ref) {
- let {
- as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
- className,
- /* translators: button label text should, if possible, be under 16 characters. */
- label = (0,external_wp_i18n_namespaceObject.__)('Options'),
- popoverProps,
- toggleProps,
- children
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
- className: classnames_default()('interface-more-menu-dropdown', className),
- icon: more_vertical,
- label: label,
- popoverProps: {
- position: 'bottom left',
- ...popoverProps,
- className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
- },
- toggleProps: {
- tooltipPosition: 'bottom',
- ...toggleProps
- }
- }, onClose => children(onClose));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js
- /**
- * WordPress dependencies
- */
- function PreferencesModal(_ref) {
- let {
- closeModal,
- children
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
- className: "interface-preferences-modal",
- title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
- onRequestClose: closeModal
- }, children);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
- /**
- * WordPress dependencies
- */
- /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
- /**
- * Return an SVG icon.
- *
- * @param {IconProps} props icon is the SVG component to render
- * size is a number specifiying the icon size in pixels
- * Other props will be passed to wrapped SVG component
- *
- * @return {JSX.Element} Icon component
- */
- function Icon(_ref) {
- let {
- icon,
- size = 24,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
- width: size,
- height: size,
- ...props
- });
- }
- /* harmony default export */ var icon = (Icon);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
- /**
- * WordPress dependencies
- */
- const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
- }));
- /* harmony default export */ var chevron_left = (chevronLeft);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
- /**
- * WordPress dependencies
- */
- const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
- }));
- /* harmony default export */ var chevron_right = (chevronRight);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js
- /**
- * WordPress dependencies
- */
- const PREFERENCES_MENU = 'preferences-menu';
- function PreferencesModalTabs(_ref) {
- let {
- sections
- } = _ref;
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components
- // between small and large viewports.
- const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
- /**
- * Create helper objects from `sections` for easier data handling.
- * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
- * is used for easier access to active tab's content.
- */
- const {
- tabs,
- sectionsContentMap
- } = (0,external_wp_element_namespaceObject.useMemo)(() => {
- let mappedTabs = {
- tabs: [],
- sectionsContentMap: {}
- };
- if (sections.length) {
- mappedTabs = sections.reduce((accumulator, _ref2) => {
- let {
- name,
- tabLabel: title,
- content
- } = _ref2;
- accumulator.tabs.push({
- name,
- title
- });
- accumulator.sectionsContentMap[name] = content;
- return accumulator;
- }, {
- tabs: [],
- sectionsContentMap: {}
- });
- }
- return mappedTabs;
- }, [sections]);
- const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
- let modalContent; // We render different components based on the viewport size.
- if (isLargeViewport) {
- modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
- className: "interface-preferences__tabs",
- tabs: tabs,
- initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
- onSelect: setActiveMenu,
- orientation: "vertical"
- }, getCurrentTab);
- } else {
- modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
- initialPath: "/",
- className: "interface-preferences__provider"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- path: "/"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
- isBorderless: true,
- size: "small"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
- key: tab.name,
- path: tab.name,
- as: external_wp_components_namespaceObject.__experimentalItem,
- isAction: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- }))));
- }))))), sections.length && sections.map(section => {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
- key: `${section.name}-menu`,
- path: section.name
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
- isBorderless: true,
- size: "large"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
- isBorderless: false,
- justify: "left",
- size: "small",
- gap: "6"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "16"
- }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
- }));
- }
- return modalContent;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js
- const Section = _ref => {
- let {
- description,
- title,
- children
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
- className: "interface-preferences-modal__section"
- }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("h2", {
- className: "interface-preferences-modal__section-title"
- }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "interface-preferences-modal__section-description"
- }, description)), children);
- };
- /* harmony default export */ var preferences_modal_section = (Section);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js
- /**
- * WordPress dependencies
- */
- function BaseOption(_ref) {
- let {
- help,
- label,
- isChecked,
- onChange,
- children
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "interface-preferences-modal__option"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
- help: help,
- label: label,
- checked: isChecked,
- onChange: onChange
- }), children);
- }
- /* harmony default export */ var preferences_modal_base_option = (BaseOption);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
- ;// CONCATENATED MODULE: external ["wp","blockEditor"]
- var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
- ;// CONCATENATED MODULE: external ["wp","a11y"]
- var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js
- /**
- * Check if a template is revertable to its original theme-provided template file.
- *
- * @param {Object} template The template entity to check.
- * @return {boolean} Whether the template is revertable.
- */
- function isTemplateRevertable(template) {
- if (!template) {
- return false;
- }
- /* eslint-disable camelcase */
- return (template === null || template === void 0 ? void 0 : template.source) === 'custom' && (template === null || template === void 0 ? void 0 : template.has_theme_file);
- /* eslint-enable camelcase */
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Dispatches an action that toggles a feature flag.
- *
- * @param {string} featureName Feature name.
- */
- function actions_toggleFeature(featureName) {
- return function (_ref) {
- let {
- registry
- } = _ref;
- external_wp_deprecated_default()("select( 'core/edit-site' ).toggleFeature( featureName )", {
- since: '6.0',
- alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )"
- });
- registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName);
- };
- }
- /**
- * Action that changes the width of the editing canvas.
- *
- * @param {string} deviceType
- *
- * @return {Object} Action object.
- */
- function __experimentalSetPreviewDeviceType(deviceType) {
- return {
- type: 'SET_PREVIEW_DEVICE_TYPE',
- deviceType
- };
- }
- /**
- * Action that sets a template, optionally fetching it from REST API.
- *
- * @param {number} templateId The template ID.
- * @param {string} templateSlug The template slug.
- * @return {Object} Action object.
- */
- const setTemplate = (templateId, templateSlug) => async _ref2 => {
- let {
- dispatch,
- registry
- } = _ref2;
- if (!templateSlug) {
- const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId);
- templateSlug = template === null || template === void 0 ? void 0 : template.slug;
- }
- dispatch({
- type: 'SET_TEMPLATE',
- templateId,
- page: {
- context: {
- templateSlug
- }
- }
- });
- };
- /**
- * Action that adds a new template and sets it as the current template.
- *
- * @param {Object} template The template.
- *
- * @return {Object} Action object used to set the current template.
- */
- const addTemplate = template => async _ref3 => {
- let {
- dispatch,
- registry
- } = _ref3;
- const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template);
- if (template.content) {
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', 'wp_template', newTemplate.id, {
- blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content)
- }, {
- undoIgnore: true
- });
- }
- dispatch({
- type: 'SET_TEMPLATE',
- templateId: newTemplate.id,
- page: {
- context: {
- templateSlug: newTemplate.slug
- }
- }
- });
- };
- /**
- * Action that removes a template.
- *
- * @param {Object} template The template object.
- */
- const removeTemplate = template => async _ref4 => {
- let {
- registry
- } = _ref4;
- try {
- await registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', template.type, template.id, {
- force: true
- });
- const lastError = registry.select(external_wp_coreData_namespaceObject.store).getLastEntityDeleteError('postType', template.type, template.id);
- if (lastError) {
- throw lastError;
- }
- registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: The template/part's name. */
- (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), template.title.rendered), {
- type: 'snackbar'
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.');
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- };
- /**
- * Action that sets a template part.
- *
- * @param {string} templatePartId The template part ID.
- *
- * @return {Object} Action object.
- */
- function setTemplatePart(templatePartId) {
- return {
- type: 'SET_TEMPLATE_PART',
- templatePartId
- };
- }
- /**
- * Action that sets the home template ID to the template ID of the page resolved
- * from a given path.
- *
- * @param {number} homeTemplateId The template ID for the homepage.
- */
- function setHomeTemplateId(homeTemplateId) {
- return {
- type: 'SET_HOME_TEMPLATE',
- homeTemplateId
- };
- }
- /**
- * Resolves the template for a page and displays both. If no path is given, attempts
- * to use the postId to generate a path like `?p=${ postId }`.
- *
- * @param {Object} page The page object.
- * @param {string} page.type The page type.
- * @param {string} page.slug The page slug.
- * @param {string} page.path The page path.
- * @param {Object} page.context The page context.
- *
- * @return {number} The resolved template ID for the page route.
- */
- const setPage = page => async _ref5 => {
- var _page$context;
- let {
- dispatch,
- registry
- } = _ref5;
- if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) {
- const entity = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', page.context.postType || 'post', page.context.postId); // If the entity is undefined for some reason, path will resolve to "/"
- page.path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link);
- }
- const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(page.path);
- if (!template) {
- return;
- }
- dispatch({
- type: 'SET_PAGE',
- page: template.slug ? { ...page,
- context: { ...page.context,
- templateSlug: template.slug
- }
- } : page,
- templateId: template.id
- });
- return template.id;
- };
- /**
- * Action that sets the active navigation panel menu.
- *
- * @param {string} menu Menu prop of active menu.
- *
- * @return {Object} Action object.
- */
- function setNavigationPanelActiveMenu(menu) {
- return {
- type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',
- menu
- };
- }
- /**
- * Opens the navigation panel and sets its active menu at the same time.
- *
- * @param {string} menu Identifies the menu to open.
- */
- function openNavigationPanelToMenu(menu) {
- return {
- type: 'OPEN_NAVIGATION_PANEL_TO_MENU',
- menu
- };
- }
- /**
- * Sets whether the navigation panel should be open.
- *
- * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It
- * does not toggle the state, but sets it directly.
- */
- function setIsNavigationPanelOpened(isOpen) {
- return {
- type: 'SET_IS_NAVIGATION_PANEL_OPENED',
- isOpen
- };
- }
- /**
- * Opens or closes the inserter.
- *
- * @param {boolean|Object} value Whether the inserter should be
- * opened (true) or closed (false).
- * To specify an insertion point,
- * use an object.
- * @param {string} value.rootClientId The root client ID to insert at.
- * @param {number} value.insertionIndex The index to insert at.
- *
- * @return {Object} Action object.
- */
- function setIsInserterOpened(value) {
- return {
- type: 'SET_IS_INSERTER_OPENED',
- value
- };
- }
- /**
- * Returns an action object used to update the settings.
- *
- * @param {Object} settings New settings.
- *
- * @return {Object} Action object.
- */
- function updateSettings(settings) {
- return {
- type: 'UPDATE_SETTINGS',
- settings
- };
- }
- /**
- * Sets whether the list view panel should be open.
- *
- * @param {boolean} isOpen If true, opens the list view. If false, closes it.
- * It does not toggle the state, but sets it directly.
- */
- function setIsListViewOpened(isOpen) {
- return {
- type: 'SET_IS_LIST_VIEW_OPENED',
- isOpen
- };
- }
- /**
- * Reverts a template to its original theme-provided file.
- *
- * @param {Object} template The template to revert.
- * @param {Object} [options]
- * @param {boolean} [options.allowUndo] Whether to allow the user to undo
- * reverting the template. Default true.
- */
- const revertTemplate = function (template) {
- let {
- allowUndo = true
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return async _ref6 => {
- let {
- registry
- } = _ref6;
- if (!isTemplateRevertable(template)) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), {
- type: 'snackbar'
- });
- return;
- }
- try {
- var _fileTemplate$content;
- const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type);
- if (!templateEntityConfig) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
- type: 'snackbar'
- });
- return;
- }
- const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
- context: 'edit',
- source: 'theme'
- });
- const fileTemplate = await external_wp_apiFetch_default()({
- path: fileTemplatePath
- });
- if (!fileTemplate) {
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
- type: 'snackbar'
- });
- return;
- }
- const serializeBlocks = _ref7 => {
- let {
- blocks: blocksForSerialization = []
- } = _ref7;
- return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
- };
- const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo
- // the revert in the header toolbar correctly.
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, {
- content: serializeBlocks,
- // Required to make the `undo` behave correctly.
- blocks: edited.blocks,
- // Required to revert the blocks in the editor.
- source: 'custom' // required to avoid turning the editor into a dirty state
- }, {
- undoIgnore: true // Required to merge this edit with the last undo level.
- });
- const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate === null || fileTemplate === void 0 ? void 0 : (_fileTemplate$content = fileTemplate.content) === null || _fileTemplate$content === void 0 ? void 0 : _fileTemplate$content.raw);
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, {
- content: serializeBlocks,
- blocks,
- source: 'theme'
- });
- if (allowUndo) {
- const undoRevert = () => {
- registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, {
- content: serializeBlocks,
- blocks: edited.blocks,
- source: 'custom'
- });
- };
- registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'), {
- type: 'snackbar',
- actions: [{
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- onClick: undoRevert
- }]
- });
- } else {
- registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'));
- }
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.');
- registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- };
- };
- /**
- * Action that opens an editor sidebar.
- *
- * @param {?string} name Sidebar name to be opened.
- */
- const openGeneralSidebar = name => _ref8 => {
- let {
- registry
- } = _ref8;
- registry.dispatch(store).enableComplementaryArea(STORE_NAME, name);
- };
- /**
- * Action that closes the sidebar.
- */
- const closeGeneralSidebar = () => _ref9 => {
- let {
- registry
- } = _ref9;
- registry.dispatch(store).disableComplementaryArea(STORE_NAME);
- };
- const switchEditorMode = mode => _ref10 => {
- let {
- registry
- } = _ref10;
- registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode); // Unselect blocks when we switch to a non visual mode.
- if (mode !== 'visual') {
- registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
- }
- if (mode === 'visual') {
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive');
- } else if (mode === 'mosaic') {
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Mosaic view selected'), 'assertive');
- }
- };
- ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
- var LEAF_KEY, hasWeakMap;
- /**
- * Arbitrary value used as key for referencing cache object in WeakMap tree.
- *
- * @type {Object}
- */
- LEAF_KEY = {};
- /**
- * Whether environment supports WeakMap.
- *
- * @type {boolean}
- */
- hasWeakMap = typeof WeakMap !== 'undefined';
- /**
- * Returns the first argument as the sole entry in an array.
- *
- * @param {*} value Value to return.
- *
- * @return {Array} Value returned as entry in array.
- */
- function arrayOf( value ) {
- return [ value ];
- }
- /**
- * Returns true if the value passed is object-like, or false otherwise. A value
- * is object-like if it can support property assignment, e.g. object or array.
- *
- * @param {*} value Value to test.
- *
- * @return {boolean} Whether value is object-like.
- */
- function isObjectLike( value ) {
- return !! value && 'object' === typeof value;
- }
- /**
- * Creates and returns a new cache object.
- *
- * @return {Object} Cache object.
- */
- function createCache() {
- var cache = {
- clear: function() {
- cache.head = null;
- },
- };
- return cache;
- }
- /**
- * Returns true if entries within the two arrays are strictly equal by
- * reference from a starting index.
- *
- * @param {Array} a First array.
- * @param {Array} b Second array.
- * @param {number} fromIndex Index from which to start comparison.
- *
- * @return {boolean} Whether arrays are shallowly equal.
- */
- function isShallowEqual( a, b, fromIndex ) {
- var i;
- if ( a.length !== b.length ) {
- return false;
- }
- for ( i = fromIndex; i < a.length; i++ ) {
- if ( a[ i ] !== b[ i ] ) {
- return false;
- }
- }
- return true;
- }
- /**
- * Returns a memoized selector function. The getDependants function argument is
- * called before the memoized selector and is expected to return an immutable
- * reference or array of references on which the selector depends for computing
- * its own return value. The memoize cache is preserved only as long as those
- * dependant references remain the same. If getDependants returns a different
- * reference(s), the cache is cleared and the selector value regenerated.
- *
- * @param {Function} selector Selector function.
- * @param {Function} getDependants Dependant getter returning an immutable
- * reference or array of reference used in
- * cache bust consideration.
- *
- * @return {Function} Memoized selector.
- */
- /* harmony default export */ function rememo(selector, getDependants ) {
- var rootCache, getCache;
- // Use object source as dependant if getter not provided
- if ( ! getDependants ) {
- getDependants = arrayOf;
- }
- /**
- * Returns the root cache. If WeakMap is supported, this is assigned to the
- * root WeakMap cache set, otherwise it is a shared instance of the default
- * cache object.
- *
- * @return {(WeakMap|Object)} Root cache object.
- */
- function getRootCache() {
- return rootCache;
- }
- /**
- * Returns the cache for a given dependants array. When possible, a WeakMap
- * will be used to create a unique cache for each set of dependants. This
- * is feasible due to the nature of WeakMap in allowing garbage collection
- * to occur on entries where the key object is no longer referenced. Since
- * WeakMap requires the key to be an object, this is only possible when the
- * dependant is object-like. The root cache is created as a hierarchy where
- * each top-level key is the first entry in a dependants set, the value a
- * WeakMap where each key is the next dependant, and so on. This continues
- * so long as the dependants are object-like. If no dependants are object-
- * like, then the cache is shared across all invocations.
- *
- * @see isObjectLike
- *
- * @param {Array} dependants Selector dependants.
- *
- * @return {Object} Cache object.
- */
- function getWeakMapCache( dependants ) {
- var caches = rootCache,
- isUniqueByDependants = true,
- i, dependant, map, cache;
- for ( i = 0; i < dependants.length; i++ ) {
- dependant = dependants[ i ];
- // Can only compose WeakMap from object-like key.
- if ( ! isObjectLike( dependant ) ) {
- isUniqueByDependants = false;
- break;
- }
- // Does current segment of cache already have a WeakMap?
- if ( caches.has( dependant ) ) {
- // Traverse into nested WeakMap.
- caches = caches.get( dependant );
- } else {
- // Create, set, and traverse into a new one.
- map = new WeakMap();
- caches.set( dependant, map );
- caches = map;
- }
- }
- // We use an arbitrary (but consistent) object as key for the last item
- // in the WeakMap to serve as our running cache.
- if ( ! caches.has( LEAF_KEY ) ) {
- cache = createCache();
- cache.isUniqueByDependants = isUniqueByDependants;
- caches.set( LEAF_KEY, cache );
- }
- return caches.get( LEAF_KEY );
- }
- // Assign cache handler by availability of WeakMap
- getCache = hasWeakMap ? getWeakMapCache : getRootCache;
- /**
- * Resets root memoization cache.
- */
- function clear() {
- rootCache = hasWeakMap ? new WeakMap() : createCache();
- }
- // eslint-disable-next-line jsdoc/check-param-names
- /**
- * The augmented selector call, considering first whether dependants have
- * changed before passing it to underlying memoize function.
- *
- * @param {Object} source Source object for derivation.
- * @param {...*} extraArgs Additional arguments to pass to selector.
- *
- * @return {*} Selector result.
- */
- function callSelector( /* source, ...extraArgs */ ) {
- var len = arguments.length,
- cache, node, i, args, dependants;
- // Create copy of arguments (avoid leaking deoptimization).
- args = new Array( len );
- for ( i = 0; i < len; i++ ) {
- args[ i ] = arguments[ i ];
- }
- dependants = getDependants.apply( null, args );
- cache = getCache( dependants );
- // If not guaranteed uniqueness by dependants (primitive type or lack
- // of WeakMap support), shallow compare against last dependants and, if
- // references have changed, destroy cache to recalculate result.
- if ( ! cache.isUniqueByDependants ) {
- if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
- cache.clear();
- }
- cache.lastDependants = dependants;
- }
- node = cache.head;
- while ( node ) {
- // Check whether node arguments match arguments
- if ( ! isShallowEqual( node.args, args, 1 ) ) {
- node = node.next;
- continue;
- }
- // At this point we can assume we've found a match
- // Surface matched node to head if not already
- if ( node !== cache.head ) {
- // Adjust siblings to point to each other.
- node.prev.next = node.next;
- if ( node.next ) {
- node.next.prev = node.prev;
- }
- node.next = cache.head;
- node.prev = null;
- cache.head.prev = node;
- cache.head = node;
- }
- // Return immediately
- return node.val;
- }
- // No cached value found. Continue to insertion phase:
- node = {
- // Generate the result from original function
- val: selector.apply( null, args ),
- };
- // Avoid including the source object in the cache.
- args[ 0 ] = null;
- node.args = args;
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
- // Shift existing head down list
- if ( cache.head ) {
- cache.head.prev = node;
- node.next = cache.head;
- }
- cache.head = node;
- return node.val;
- }
- callSelector.getDependants = getDependants;
- callSelector.clear = clear;
- clear();
- return callSelector;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- function isTemplateSuperseded(slug, existingSlugs, showOnFront) {
- if (!TEMPLATE_OVERRIDES[slug]) {
- return false;
- } // `home` template is unused if it is superseded by `front-page`
- // or "show on front" is set to show a page rather than blog posts.
- if (slug === 'home' && showOnFront !== 'posts') {
- return true;
- }
- return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront));
- }
- function getTemplateLocation(slug) {
- const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug);
- if (isTopLevelTemplate) {
- return MENU_TEMPLATES;
- }
- const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug);
- if (isGeneralTemplate) {
- return MENU_TEMPLATES_GENERAL;
- }
- const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix));
- if (isPostsTemplate) {
- return MENU_TEMPLATES_POSTS;
- }
- const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix));
- if (isPagesTemplate) {
- return MENU_TEMPLATES_PAGES;
- }
- return MENU_TEMPLATES_GENERAL;
- }
- function getUnusedTemplates(templates, showOnFront) {
- const templateSlugs = map(templates, 'slug');
- const supersededTemplates = templates.filter(_ref => {
- let {
- slug
- } = _ref;
- return isTemplateSuperseded(slug, templateSlugs, showOnFront);
- });
- return supersededTemplates;
- }
- function getTemplatesLocationMap(templates) {
- return templates.reduce((obj, template) => {
- obj[template.slug] = getTemplateLocation(template.slug);
- return obj;
- }, {});
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * @typedef {'template'|'template_type'} TemplateType Template type.
- */
- /**
- * Helper for getting a preference from the preferences store.
- *
- * This is only present so that `getSettings` doesn't need to be made a
- * registry selector.
- *
- * It's unstable because the selector needs to be exported and so part of the
- * public API to work.
- */
- const __unstableGetPreference = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, name) => select(external_wp_preferences_namespaceObject.store).get('core/edit-site', name));
- /**
- * Returns whether the given feature is enabled or not.
- *
- * @param {Object} state Global application state.
- * @param {string} featureName Feature slug.
- *
- * @return {boolean} Is active.
- */
- function selectors_isFeatureActive(state, featureName) {
- external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive`, {
- since: '6.0',
- alternative: `select( 'core/preferences' ).get`
- });
- return !!__unstableGetPreference(state, featureName);
- }
- /**
- * Returns the current editing canvas device type.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Device type.
- */
- function __experimentalGetPreviewDeviceType(state) {
- return state.deviceType;
- }
- /**
- * Returns whether the current user can create media or not.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} Whether the current user can create media or not.
- */
- const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'));
- /**
- * Returns any available Reusable blocks.
- *
- * @param {Object} state Global application state.
- *
- * @return {Array} The available reusable blocks.
- */
- const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
- const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
- return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
- per_page: -1
- }) : [];
- });
- /**
- * Returns the settings, taking into account active features and permissions.
- *
- * @param {Object} state Global application state.
- * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.
- *
- * @return {Object} Settings.
- */
- const getSettings = rememo((state, setIsInserterOpen) => {
- const settings = { ...state.settings,
- outlineMode: true,
- focusMode: !!__unstableGetPreference(state, 'focusMode'),
- hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'),
- keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'),
- showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'),
- __experimentalSetIsInserterOpened: setIsInserterOpen,
- __experimentalReusableBlocks: getReusableBlocks(state),
- __experimentalPreferPatternsOnRoot: 'wp_template' === getEditedPostType(state)
- };
- const canUserCreateMedia = getCanUserCreateMedia(state);
- if (!canUserCreateMedia) {
- return settings;
- }
- settings.mediaUpload = _ref => {
- let {
- onError,
- ...rest
- } = _ref;
- (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
- wpAllowedMimeTypes: state.settings.allowedMimeTypes,
- onError: _ref2 => {
- let {
- message
- } = _ref2;
- return onError(message);
- },
- ...rest
- });
- };
- return settings;
- }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
- /**
- * Returns the current home template ID.
- *
- * @param {Object} state Global application state.
- *
- * @return {number?} Home template ID.
- */
- function getHomeTemplateId(state) {
- return state.homeTemplateId;
- }
- function getCurrentEditedPost(state) {
- return state.editedPost;
- }
- /**
- * Returns the current edited post type (wp_template or wp_template_part).
- *
- * @param {Object} state Global application state.
- *
- * @return {TemplateType?} Template type.
- */
- function getEditedPostType(state) {
- return getCurrentEditedPost(state).type;
- }
- /**
- * Returns the ID of the currently edited template or template part.
- *
- * @param {Object} state Global application state.
- *
- * @return {string?} Post ID.
- */
- function getEditedPostId(state) {
- return getCurrentEditedPost(state).id;
- }
- /**
- * Returns the current page object.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} Page.
- */
- function getPage(state) {
- return getCurrentEditedPost(state).page;
- }
- /**
- * Returns the active menu in the navigation panel.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Active menu.
- */
- function getNavigationPanelActiveMenu(state) {
- return state.navigationPanel.menu;
- }
- /**
- * Returns the current template or template part's corresponding
- * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} The current template or template part's sub menu.
- */
- const getCurrentTemplateNavigationPanelSubMenu = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
- const templateType = getEditedPostType(state);
- const templateId = getEditedPostId(state);
- const template = templateId ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', templateType, templateId) : null;
- if (!template) {
- return MENU_ROOT;
- }
- if ('wp_template_part' === templateType) {
- var _TEMPLATE_PARTS_SUB_M;
- return ((_TEMPLATE_PARTS_SUB_M = TEMPLATE_PARTS_SUB_MENUS.find(submenu => submenu.area === (template === null || template === void 0 ? void 0 : template.area))) === null || _TEMPLATE_PARTS_SUB_M === void 0 ? void 0 : _TEMPLATE_PARTS_SUB_M.menu) || MENU_TEMPLATE_PARTS;
- }
- const templates = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template');
- const showOnFront = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'site').show_on_front;
- if (isTemplateSuperseded(template.slug, (0,external_lodash_namespaceObject.map)(templates, 'slug'), showOnFront)) {
- return MENU_TEMPLATES_UNUSED;
- }
- return getTemplateLocation(template.slug);
- });
- /**
- * Returns the current opened/closed state of the navigation panel.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} True if the navigation panel should be open; false if closed.
- */
- function isNavigationOpened(state) {
- return state.navigationPanel.isOpen;
- }
- /**
- * Returns the current opened/closed state of the inserter panel.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} True if the inserter panel should be open; false if closed.
- */
- function isInserterOpened(state) {
- return !!state.blockInserterPanel;
- }
- /**
- * Get the insertion point for the inserter.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} The root client ID, index to insert at and starting filter value.
- */
- function __experimentalGetInsertionPoint(state) {
- const {
- rootClientId,
- insertionIndex,
- filterValue
- } = state.blockInserterPanel;
- return {
- rootClientId,
- insertionIndex,
- filterValue
- };
- }
- /**
- * Returns the current opened/closed state of the list view panel.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} True if the list view panel should be open; false if closed.
- */
- function isListViewOpened(state) {
- return state.listViewPanel;
- }
- /**
- * Returns the template parts and their blocks for the current edited template.
- *
- * @param {Object} state Global application state.
- * @return {Array} Template parts and their blocks in an array.
- */
- const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
- var _template$blocks;
- const templateType = getEditedPostType(state);
- const templateId = getEditedPostId(state);
- const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', templateType, templateId);
- const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', {
- per_page: -1
- });
- const templatePartsById = (0,external_lodash_namespaceObject.keyBy)(templateParts, templatePart => templatePart.id);
- return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)).map(block => {
- const {
- attributes: {
- theme,
- slug
- }
- } = block;
- const templatePartId = `${theme}//${slug}`;
- const templatePart = templatePartsById[templatePartId];
- return {
- templatePart,
- block
- };
- }).filter(_ref3 => {
- let {
- templatePart
- } = _ref3;
- return !!templatePart;
- });
- });
- /**
- * Returns the current editing mode.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Editing mode.
- */
- function getEditorMode(state) {
- return __unstableGetPreference(state, 'editorMode');
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const storeConfig = {
- reducer: reducer,
- actions: store_actions_namespaceObject,
- selectors: store_selectors_namespaceObject
- };
- const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig);
- (0,external_wp_data_namespaceObject.register)(store_store);
- ;// CONCATENATED MODULE: ./node_modules/history/index.js
- /**
- * Actions represent the type of change to a location value.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
- */
- var Action;
- (function (Action) {
- /**
- * A POP indicates a change to an arbitrary index in the history stack, such
- * as a back or forward navigation. It does not describe the direction of the
- * navigation, only that the current index changed.
- *
- * Note: This is the default action for newly created history objects.
- */
- Action["Pop"] = "POP";
- /**
- * A PUSH indicates a new entry being added to the history stack, such as when
- * a link is clicked and a new page loads. When this happens, all subsequent
- * entries in the stack are lost.
- */
- Action["Push"] = "PUSH";
- /**
- * A REPLACE indicates the entry at the current index in the history stack
- * being replaced by a new one.
- */
- Action["Replace"] = "REPLACE";
- })(Action || (Action = {}));
- var readOnly = false ? 0 : function (obj) {
- return obj;
- };
- function warning(cond, message) {
- if (!cond) {
- // eslint-disable-next-line no-console
- if (typeof console !== 'undefined') console.warn(message);
- try {
- // Welcome to debugging history!
- //
- // This error is thrown as a convenience so you can more easily
- // find the source for a warning that appears in the console by
- // enabling "pause on exceptions" in your JavaScript debugger.
- throw new Error(message); // eslint-disable-next-line no-empty
- } catch (e) {}
- }
- }
- var BeforeUnloadEventType = 'beforeunload';
- var HashChangeEventType = 'hashchange';
- var PopStateEventType = 'popstate';
- /**
- * Browser history stores the location in regular URLs. This is the standard for
- * most web apps, but it requires some configuration on the server to ensure you
- * serve the same app at multiple URLs.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
- */
- function createBrowserHistory(options) {
- if (options === void 0) {
- options = {};
- }
- var _options = options,
- _options$window = _options.window,
- window = _options$window === void 0 ? document.defaultView : _options$window;
- var globalHistory = window.history;
- function getIndexAndLocation() {
- var _window$location = window.location,
- pathname = _window$location.pathname,
- search = _window$location.search,
- hash = _window$location.hash;
- var state = globalHistory.state || {};
- return [state.idx, readOnly({
- pathname: pathname,
- search: search,
- hash: hash,
- state: state.usr || null,
- key: state.key || 'default'
- })];
- }
- var blockedPopTx = null;
- function handlePop() {
- if (blockedPopTx) {
- blockers.call(blockedPopTx);
- blockedPopTx = null;
- } else {
- var nextAction = Action.Pop;
- var _getIndexAndLocation = getIndexAndLocation(),
- nextIndex = _getIndexAndLocation[0],
- nextLocation = _getIndexAndLocation[1];
- if (blockers.length) {
- if (nextIndex != null) {
- var delta = index - nextIndex;
- if (delta) {
- // Revert the POP
- blockedPopTx = {
- action: nextAction,
- location: nextLocation,
- retry: function retry() {
- go(delta * -1);
- }
- };
- go(delta);
- }
- } else {
- // Trying to POP to a location with no index. We did not create
- // this location, so we can't effectively block the navigation.
- false ? 0 : void 0;
- }
- } else {
- applyTx(nextAction);
- }
- }
- }
- window.addEventListener(PopStateEventType, handlePop);
- var action = Action.Pop;
- var _getIndexAndLocation2 = getIndexAndLocation(),
- index = _getIndexAndLocation2[0],
- location = _getIndexAndLocation2[1];
- var listeners = createEvents();
- var blockers = createEvents();
- if (index == null) {
- index = 0;
- globalHistory.replaceState(extends_extends({}, globalHistory.state, {
- idx: index
- }), '');
- }
- function createHref(to) {
- return typeof to === 'string' ? to : createPath(to);
- } // state defaults to `null` because `window.history.state` does
- function getNextLocation(to, state) {
- if (state === void 0) {
- state = null;
- }
- return readOnly(extends_extends({
- pathname: location.pathname,
- hash: '',
- search: ''
- }, typeof to === 'string' ? parsePath(to) : to, {
- state: state,
- key: createKey()
- }));
- }
- function getHistoryStateAndUrl(nextLocation, index) {
- return [{
- usr: nextLocation.state,
- key: nextLocation.key,
- idx: index
- }, createHref(nextLocation)];
- }
- function allowTx(action, location, retry) {
- return !blockers.length || (blockers.call({
- action: action,
- location: location,
- retry: retry
- }), false);
- }
- function applyTx(nextAction) {
- action = nextAction;
- var _getIndexAndLocation3 = getIndexAndLocation();
- index = _getIndexAndLocation3[0];
- location = _getIndexAndLocation3[1];
- listeners.call({
- action: action,
- location: location
- });
- }
- function push(to, state) {
- var nextAction = Action.Push;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- push(to, state);
- }
- if (allowTx(nextAction, nextLocation, retry)) {
- var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
- historyState = _getHistoryStateAndUr[0],
- url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
- // try...catch because iOS limits us to 100 pushState calls :/
- try {
- globalHistory.pushState(historyState, '', url);
- } catch (error) {
- // They are going to lose state here, but there is no real
- // way to warn them about it since the page will refresh...
- window.location.assign(url);
- }
- applyTx(nextAction);
- }
- }
- function replace(to, state) {
- var nextAction = Action.Replace;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- replace(to, state);
- }
- if (allowTx(nextAction, nextLocation, retry)) {
- var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
- historyState = _getHistoryStateAndUr2[0],
- url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
- globalHistory.replaceState(historyState, '', url);
- applyTx(nextAction);
- }
- }
- function go(delta) {
- globalHistory.go(delta);
- }
- var history = {
- get action() {
- return action;
- },
- get location() {
- return location;
- },
- createHref: createHref,
- push: push,
- replace: replace,
- go: go,
- back: function back() {
- go(-1);
- },
- forward: function forward() {
- go(1);
- },
- listen: function listen(listener) {
- return listeners.push(listener);
- },
- block: function block(blocker) {
- var unblock = blockers.push(blocker);
- if (blockers.length === 1) {
- window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
- }
- return function () {
- unblock(); // Remove the beforeunload listener so the document may
- // still be salvageable in the pagehide event.
- // See https://html.spec.whatwg.org/#unloading-documents
- if (!blockers.length) {
- window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
- }
- };
- }
- };
- return history;
- }
- /**
- * Hash history stores the location in window.location.hash. This makes it ideal
- * for situations where you don't want to send the location to the server for
- * some reason, either because you do cannot configure it or the URL space is
- * reserved for something else.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
- */
- function createHashHistory(options) {
- if (options === void 0) {
- options = {};
- }
- var _options2 = options,
- _options2$window = _options2.window,
- window = _options2$window === void 0 ? document.defaultView : _options2$window;
- var globalHistory = window.history;
- function getIndexAndLocation() {
- var _parsePath = parsePath(window.location.hash.substr(1)),
- _parsePath$pathname = _parsePath.pathname,
- pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
- _parsePath$search = _parsePath.search,
- search = _parsePath$search === void 0 ? '' : _parsePath$search,
- _parsePath$hash = _parsePath.hash,
- hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
- var state = globalHistory.state || {};
- return [state.idx, readOnly({
- pathname: pathname,
- search: search,
- hash: hash,
- state: state.usr || null,
- key: state.key || 'default'
- })];
- }
- var blockedPopTx = null;
- function handlePop() {
- if (blockedPopTx) {
- blockers.call(blockedPopTx);
- blockedPopTx = null;
- } else {
- var nextAction = Action.Pop;
- var _getIndexAndLocation4 = getIndexAndLocation(),
- nextIndex = _getIndexAndLocation4[0],
- nextLocation = _getIndexAndLocation4[1];
- if (blockers.length) {
- if (nextIndex != null) {
- var delta = index - nextIndex;
- if (delta) {
- // Revert the POP
- blockedPopTx = {
- action: nextAction,
- location: nextLocation,
- retry: function retry() {
- go(delta * -1);
- }
- };
- go(delta);
- }
- } else {
- // Trying to POP to a location with no index. We did not create
- // this location, so we can't effectively block the navigation.
- false ? 0 : void 0;
- }
- } else {
- applyTx(nextAction);
- }
- }
- }
- window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
- // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
- window.addEventListener(HashChangeEventType, function () {
- var _getIndexAndLocation5 = getIndexAndLocation(),
- nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
- if (createPath(nextLocation) !== createPath(location)) {
- handlePop();
- }
- });
- var action = Action.Pop;
- var _getIndexAndLocation6 = getIndexAndLocation(),
- index = _getIndexAndLocation6[0],
- location = _getIndexAndLocation6[1];
- var listeners = createEvents();
- var blockers = createEvents();
- if (index == null) {
- index = 0;
- globalHistory.replaceState(_extends({}, globalHistory.state, {
- idx: index
- }), '');
- }
- function getBaseHref() {
- var base = document.querySelector('base');
- var href = '';
- if (base && base.getAttribute('href')) {
- var url = window.location.href;
- var hashIndex = url.indexOf('#');
- href = hashIndex === -1 ? url : url.slice(0, hashIndex);
- }
- return href;
- }
- function createHref(to) {
- return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
- }
- function getNextLocation(to, state) {
- if (state === void 0) {
- state = null;
- }
- return readOnly(_extends({
- pathname: location.pathname,
- hash: '',
- search: ''
- }, typeof to === 'string' ? parsePath(to) : to, {
- state: state,
- key: createKey()
- }));
- }
- function getHistoryStateAndUrl(nextLocation, index) {
- return [{
- usr: nextLocation.state,
- key: nextLocation.key,
- idx: index
- }, createHref(nextLocation)];
- }
- function allowTx(action, location, retry) {
- return !blockers.length || (blockers.call({
- action: action,
- location: location,
- retry: retry
- }), false);
- }
- function applyTx(nextAction) {
- action = nextAction;
- var _getIndexAndLocation7 = getIndexAndLocation();
- index = _getIndexAndLocation7[0];
- location = _getIndexAndLocation7[1];
- listeners.call({
- action: action,
- location: location
- });
- }
- function push(to, state) {
- var nextAction = Action.Push;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- push(to, state);
- }
- false ? 0 : void 0;
- if (allowTx(nextAction, nextLocation, retry)) {
- var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
- historyState = _getHistoryStateAndUr3[0],
- url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
- // try...catch because iOS limits us to 100 pushState calls :/
- try {
- globalHistory.pushState(historyState, '', url);
- } catch (error) {
- // They are going to lose state here, but there is no real
- // way to warn them about it since the page will refresh...
- window.location.assign(url);
- }
- applyTx(nextAction);
- }
- }
- function replace(to, state) {
- var nextAction = Action.Replace;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- replace(to, state);
- }
- false ? 0 : void 0;
- if (allowTx(nextAction, nextLocation, retry)) {
- var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
- historyState = _getHistoryStateAndUr4[0],
- url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
- globalHistory.replaceState(historyState, '', url);
- applyTx(nextAction);
- }
- }
- function go(delta) {
- globalHistory.go(delta);
- }
- var history = {
- get action() {
- return action;
- },
- get location() {
- return location;
- },
- createHref: createHref,
- push: push,
- replace: replace,
- go: go,
- back: function back() {
- go(-1);
- },
- forward: function forward() {
- go(1);
- },
- listen: function listen(listener) {
- return listeners.push(listener);
- },
- block: function block(blocker) {
- var unblock = blockers.push(blocker);
- if (blockers.length === 1) {
- window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
- }
- return function () {
- unblock(); // Remove the beforeunload listener so the document may
- // still be salvageable in the pagehide event.
- // See https://html.spec.whatwg.org/#unloading-documents
- if (!blockers.length) {
- window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
- }
- };
- }
- };
- return history;
- }
- /**
- * Memory history stores the current location in memory. It is designed for use
- * in stateful non-browser environments like tests and React Native.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
- */
- function createMemoryHistory(options) {
- if (options === void 0) {
- options = {};
- }
- var _options3 = options,
- _options3$initialEntr = _options3.initialEntries,
- initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
- initialIndex = _options3.initialIndex;
- var entries = initialEntries.map(function (entry) {
- var location = readOnly(_extends({
- pathname: '/',
- search: '',
- hash: '',
- state: null,
- key: createKey()
- }, typeof entry === 'string' ? parsePath(entry) : entry));
- false ? 0 : void 0;
- return location;
- });
- var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
- var action = Action.Pop;
- var location = entries[index];
- var listeners = createEvents();
- var blockers = createEvents();
- function createHref(to) {
- return typeof to === 'string' ? to : createPath(to);
- }
- function getNextLocation(to, state) {
- if (state === void 0) {
- state = null;
- }
- return readOnly(_extends({
- pathname: location.pathname,
- search: '',
- hash: ''
- }, typeof to === 'string' ? parsePath(to) : to, {
- state: state,
- key: createKey()
- }));
- }
- function allowTx(action, location, retry) {
- return !blockers.length || (blockers.call({
- action: action,
- location: location,
- retry: retry
- }), false);
- }
- function applyTx(nextAction, nextLocation) {
- action = nextAction;
- location = nextLocation;
- listeners.call({
- action: action,
- location: location
- });
- }
- function push(to, state) {
- var nextAction = Action.Push;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- push(to, state);
- }
- false ? 0 : void 0;
- if (allowTx(nextAction, nextLocation, retry)) {
- index += 1;
- entries.splice(index, entries.length, nextLocation);
- applyTx(nextAction, nextLocation);
- }
- }
- function replace(to, state) {
- var nextAction = Action.Replace;
- var nextLocation = getNextLocation(to, state);
- function retry() {
- replace(to, state);
- }
- false ? 0 : void 0;
- if (allowTx(nextAction, nextLocation, retry)) {
- entries[index] = nextLocation;
- applyTx(nextAction, nextLocation);
- }
- }
- function go(delta) {
- var nextIndex = clamp(index + delta, 0, entries.length - 1);
- var nextAction = Action.Pop;
- var nextLocation = entries[nextIndex];
- function retry() {
- go(delta);
- }
- if (allowTx(nextAction, nextLocation, retry)) {
- index = nextIndex;
- applyTx(nextAction, nextLocation);
- }
- }
- var history = {
- get index() {
- return index;
- },
- get action() {
- return action;
- },
- get location() {
- return location;
- },
- createHref: createHref,
- push: push,
- replace: replace,
- go: go,
- back: function back() {
- go(-1);
- },
- forward: function forward() {
- go(1);
- },
- listen: function listen(listener) {
- return listeners.push(listener);
- },
- block: function block(blocker) {
- return blockers.push(blocker);
- }
- };
- return history;
- } ////////////////////////////////////////////////////////////////////////////////
- // UTILS
- ////////////////////////////////////////////////////////////////////////////////
- function clamp(n, lowerBound, upperBound) {
- return Math.min(Math.max(n, lowerBound), upperBound);
- }
- function promptBeforeUnload(event) {
- // Cancel the event.
- event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
- event.returnValue = '';
- }
- function createEvents() {
- var handlers = [];
- return {
- get length() {
- return handlers.length;
- },
- push: function push(fn) {
- handlers.push(fn);
- return function () {
- handlers = handlers.filter(function (handler) {
- return handler !== fn;
- });
- };
- },
- call: function call(arg) {
- handlers.forEach(function (fn) {
- return fn && fn(arg);
- });
- }
- };
- }
- function createKey() {
- return Math.random().toString(36).substr(2, 8);
- }
- /**
- * Creates a string URL path from the given pathname, search, and hash components.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
- */
- function createPath(_ref) {
- var _ref$pathname = _ref.pathname,
- pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
- _ref$search = _ref.search,
- search = _ref$search === void 0 ? '' : _ref$search,
- _ref$hash = _ref.hash,
- hash = _ref$hash === void 0 ? '' : _ref$hash;
- if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
- if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
- return pathname;
- }
- /**
- * Parses a string URL path into its separate pathname, search, and hash components.
- *
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
- */
- function parsePath(path) {
- var parsedPath = {};
- if (path) {
- var hashIndex = path.indexOf('#');
- if (hashIndex >= 0) {
- parsedPath.hash = path.substr(hashIndex);
- path = path.substr(0, hashIndex);
- }
- var searchIndex = path.indexOf('?');
- if (searchIndex >= 0) {
- parsedPath.search = path.substr(searchIndex);
- path = path.substr(0, searchIndex);
- }
- if (path) {
- parsedPath.pathname = path;
- }
- }
- return parsedPath;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/history.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- const history_history = createBrowserHistory();
- const originalHistoryPush = history_history.push;
- const originalHistoryReplace = history_history.replace;
- function push(params, state) {
- return originalHistoryPush.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state);
- }
- function replace(params, state) {
- return originalHistoryReplace.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state);
- }
- history_history.push = push;
- history_history.replace = replace;
- /* harmony default export */ var utils_history = (history_history);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const RoutesContext = (0,external_wp_element_namespaceObject.createContext)();
- const HistoryContext = (0,external_wp_element_namespaceObject.createContext)();
- function useLocation() {
- return (0,external_wp_element_namespaceObject.useContext)(RoutesContext);
- }
- function useHistory() {
- return (0,external_wp_element_namespaceObject.useContext)(HistoryContext);
- }
- function getLocationWithParams(location) {
- const searchParams = new URLSearchParams(location.search);
- return { ...location,
- params: Object.fromEntries(searchParams.entries())
- };
- }
- function Routes(_ref) {
- let {
- children
- } = _ref;
- const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(utils_history.location));
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- return utils_history.listen(_ref2 => {
- let {
- location: updatedLocation
- } = _ref2;
- setLocation(getLocationWithParams(updatedLocation));
- });
- }, []);
- return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, {
- value: utils_history
- }, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, {
- value: location
- }, children(location)));
- }
- ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
- var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
- /**
- * WordPress dependencies
- */
- const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
- }));
- /* harmony default export */ var library_plus = (plus);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
- /**
- * WordPress dependencies
- */
- const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
- }));
- /* harmony default export */ var list_view = (listView);
- ;// CONCATENATED MODULE: external ["wp","keycodes"]
- var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
- /**
- * WordPress dependencies
- */
- const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
- }));
- /* harmony default export */ var library_external = (external);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js
- /**
- * WordPress dependencies
- */
- const textFormattingShortcuts = [{
- keyCombination: {
- modifier: 'primary',
- character: 'b'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
- }, {
- keyCombination: {
- modifier: 'primary',
- character: 'i'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
- }, {
- keyCombination: {
- modifier: 'primary',
- character: 'k'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
- }, {
- keyCombination: {
- modifier: 'primaryShift',
- character: 'k'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
- }, {
- keyCombination: {
- modifier: 'primary',
- character: 'u'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
- }];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function KeyCombination(_ref) {
- let {
- keyCombination,
- forceAriaLabel
- } = _ref;
- const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
- const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
- return (0,external_wp_element_namespaceObject.createElement)("kbd", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination",
- "aria-label": forceAriaLabel || ariaLabel
- }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
- if (character === '+') {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
- key: index
- }, character);
- }
- return (0,external_wp_element_namespaceObject.createElement)("kbd", {
- key: index,
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-key"
- }, character);
- }));
- }
- function Shortcut(_ref2) {
- let {
- description,
- keyCombination,
- aliases = [],
- ariaLabel
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-description"
- }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-term"
- }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
- keyCombination: keyCombination,
- forceAriaLabel: ariaLabel
- }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
- keyCombination: alias,
- forceAriaLabel: ariaLabel,
- key: index
- }))));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function DynamicShortcut(_ref) {
- let {
- name
- } = _ref;
- const {
- keyCombination,
- description,
- aliases
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getShortcutKeyCombination,
- getShortcutDescription,
- getShortcutAliases
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
- return {
- keyCombination: getShortcutKeyCombination(name),
- aliases: getShortcutAliases(name),
- description: getShortcutDescription(name)
- };
- }, [name]);
- if (!keyCombination) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(Shortcut, {
- keyCombination: keyCombination,
- description: description,
- aliases: aliases
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const ShortcutList = _ref => {
- let {
- shortcuts
- } = _ref;
- return (
- /*
- * Disable reason: The `list` ARIA role is redundant but
- * Safari+VoiceOver won't announce the list otherwise.
- */
- /* eslint-disable jsx-a11y/no-redundant-roles */
- (0,external_wp_element_namespaceObject.createElement)("ul", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut-list",
- role: "list"
- }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
- className: "edit-site-keyboard-shortcut-help-modal__shortcut",
- key: index
- }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(DynamicShortcut, {
- name: shortcut
- }) : (0,external_wp_element_namespaceObject.createElement)(Shortcut, shortcut))))
- /* eslint-enable jsx-a11y/no-redundant-roles */
- );
- };
- const ShortcutSection = _ref2 => {
- let {
- title,
- shortcuts,
- className
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)("section", {
- className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className)
- }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
- className: "edit-site-keyboard-shortcut-help-modal__section-title"
- }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
- shortcuts: shortcuts
- }));
- };
- const ShortcutCategorySection = _ref3 => {
- let {
- title,
- categoryName,
- additionalShortcuts = []
- } = _ref3;
- const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
- }, [categoryName]);
- return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
- title: title,
- shortcuts: categoryShortcuts.concat(additionalShortcuts)
- });
- };
- function KeyboardShortcutHelpModal(_ref4) {
- let {
- isModalActive,
- toggleModal
- } = _ref4;
- if (!isModalActive) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
- className: "edit-site-keyboard-shortcut-help-modal",
- title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
- onRequestClose: toggleModal
- }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
- className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts",
- shortcuts: ['core/edit-site/keyboard-shortcuts']
- }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
- categoryName: "global"
- }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
- categoryName: "selection"
- }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
- categoryName: "block",
- additionalShortcuts: [{
- keyCombination: {
- character: '/'
- },
- description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
- /* translators: The forward-slash character. e.g. '/'. */
- ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
- }]
- }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
- title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
- shortcuts: textFormattingShortcuts
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/enable-feature.js
- /**
- * WordPress dependencies
- */
- function EnableFeature(props) {
- const {
- featureName,
- ...remainingProps
- } = props;
- const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName), [featureName]);
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const onChange = () => toggle('core/edit-site', featureName);
- return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, extends_extends({
- onChange: onChange,
- isChecked: isChecked
- }, remainingProps));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditSitePreferencesModal(_ref) {
- let {
- isModalActive,
- toggleModal
- } = _ref;
- const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
- name: 'general',
- tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
- content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
- title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
- }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
- featureName: "focusMode",
- help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
- }), (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
- featureName: "showIconLabels",
- label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'),
- help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons')
- }))
- }, {
- name: 'blocks',
- tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
- content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
- title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
- }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
- featureName: "keepCaretInsideBlock",
- help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
- label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
- }))
- }]);
- if (!isModalActive) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, {
- closeModal: toggleModal
- }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, {
- sections: sections
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/tools-more-menu-group/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- const {
- Fill: ToolsMoreMenuGroup,
- Slot
- } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup');
- ToolsMoreMenuGroup.Slot = _ref => {
- let {
- fillProps
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(Slot, {
- fillProps: fillProps
- }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills);
- };
- /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
- // EXTERNAL MODULE: ./node_modules/downloadjs/download.js
- var download = __webpack_require__(8981);
- var download_default = /*#__PURE__*/__webpack_require__.n(download);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js
- /**
- * WordPress dependencies
- */
- const download_download = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"
- }));
- /* harmony default export */ var library_download = (download_download);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/site-export.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function SiteExport() {
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- async function handleExport() {
- try {
- const response = await external_wp_apiFetch_default()({
- path: '/wp-block-editor/v1/export',
- parse: false
- });
- const blob = await response.blob();
- const contentDisposition = response.headers.get('content-disposition');
- const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
- const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export';
- download_default()(blob, fileName + '.zip', 'application/zip');
- } catch (errorResponse) {
- let error = {};
- try {
- error = await errorResponse.json();
- } catch (e) {}
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- role: "menuitem",
- icon: library_download,
- onClick: handleExport,
- info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.')
- }, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item'));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/welcome-guide-menu-item.js
- /**
- * WordPress dependencies
- */
- function WelcomeGuideMenuItem() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => toggle('core/edit-site', 'welcomeGuide')
- }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/copy-content-menu-item.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function CopyContentMenuItem() {
- const {
- createNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const getText = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return () => {
- const {
- getEditedPostId,
- getEditedPostType
- } = select(store_store);
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
- if (record) {
- if (typeof record.content === 'function') {
- return record.content(record);
- } else if (record.blocks) {
- return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
- } else if (record.content) {
- return record.content;
- }
- }
- return '';
- };
- }, []);
- function onSuccess() {
- createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
- isDismissible: true,
- type: 'snackbar'
- });
- }
- const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- ref: ref
- }, (0,external_wp_i18n_namespaceObject.__)('Copy all content'));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/mode-switcher/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Set of available mode options.
- *
- * @type {Array}
- */
- const MODES = [{
- value: 'visual',
- label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
- }, {
- value: 'text',
- label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
- }];
- function ModeSwitcher() {
- const {
- shortcut,
- mode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'),
- isRichEditingEnabled: select(store_store).getSettings().richEditingEnabled,
- isCodeEditingEnabled: select(store_store).getSettings().codeEditingEnabled,
- mode: select(store_store).getEditorMode()
- }), []);
- const {
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const choices = MODES.map(choice => {
- if (choice.value !== mode) {
- return { ...choice,
- shortcut
- };
- }
- return choice;
- });
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Editor')
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
- choices: choices,
- value: mode,
- onSelect: switchEditorMode
- }));
- }
- /* harmony default export */ var mode_switcher = (ModeSwitcher);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function MoreMenu() {
- const [isModalActive, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false);
- const [isPreferencesModalActive, togglePreferencesModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false);
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, _ref => {
- let {
- onClose
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
- scope: "core/edit-site",
- name: "fixedToolbar",
- label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
- info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
- messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
- messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
- scope: "core/edit-site",
- name: "focusMode",
- label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
- info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
- messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
- messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
- }), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, {
- name: "core/edit-site/plugin-more-menu",
- label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
- as: external_wp_components_namespaceObject.MenuGroup,
- fillProps: {
- onClick: onClose
- }
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Tools')
- }, (0,external_wp_element_namespaceObject.createElement)(SiteExport, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: toggleModal,
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
- }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: library_external,
- role: "menuitem",
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/site-editor/'),
- target: "_blank",
- rel: "noopener noreferrer"
- }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "span"
- },
- /* translators: accessibility text */
- (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
- fillProps: {
- onClose
- }
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: togglePreferencesModal
- }, (0,external_wp_i18n_namespaceObject.__)('Preferences'))));
- }), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
- isModalActive: isModalActive,
- toggleModal: toggleModal
- }), (0,external_wp_element_namespaceObject.createElement)(EditSitePreferencesModal, {
- isModalActive: isPreferencesModalActive,
- toggleModal: togglePreferencesModal
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function SaveButton(_ref) {
- let {
- openEntitiesSavedStates,
- isEntitiesSavedStatesOpen
- } = _ref;
- const {
- isDirty,
- isSaving
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- __experimentalGetDirtyEntityRecords,
- isSavingEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- return {
- isDirty: dirtyEntityRecords.length > 0,
- isSaving: (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key))
- };
- }, []);
- const disabled = !isDirty || isSaving;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- className: "edit-site-save-button__button",
- "aria-disabled": disabled,
- "aria-expanded": isEntitiesSavedStatesOpen,
- disabled: disabled,
- isBusy: isSaving,
- onClick: disabled ? undefined : openEntitiesSavedStates
- }, (0,external_wp_i18n_namespaceObject.__)('Save')));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
- /**
- * WordPress dependencies
- */
- const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
- }));
- /* harmony default export */ var library_undo = (undo);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
- /**
- * WordPress dependencies
- */
- const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
- }));
- /* harmony default export */ var library_redo = (redo);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/undo.js
- /**
- * WordPress dependencies
- */
- function UndoButton() {
- const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []);
- const {
- undo
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo,
- label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
- // button, because it will remove focus for keyboard users.
- // See: https://github.com/WordPress/gutenberg/issues/3486
- ,
- "aria-disabled": !hasUndo,
- onClick: hasUndo ? undo : undefined
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/redo.js
- /**
- * WordPress dependencies
- */
- function RedoButton() {
- const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []);
- const {
- redo
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo,
- label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
- shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no undo levels we don't want to actually disable this
- // button, because it will remove focus for keyboard users.
- // See: https://github.com/WordPress/gutenberg/issues/3486
- ,
- "aria-disabled": !hasRedo,
- onClick: hasRedo ? redo : undefined
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
- /**
- * WordPress dependencies
- */
- const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
- }));
- /* harmony default export */ var chevron_down = (chevronDown);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/document-actions/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function getBlockDisplayText(block) {
- if (block) {
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
- return blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, block.attributes) : null;
- }
- return null;
- }
- function useSecondaryText() {
- const {
- getBlock
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
- const activeEntityBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetActiveBlockIdByBlockNames(['core/template-part']), []);
- if (activeEntityBlockId) {
- return {
- label: getBlockDisplayText(getBlock(activeEntityBlockId)),
- isActive: true
- };
- }
- return {};
- }
- /**
- * @param {Object} props Props for the DocumentActions component.
- * @param {string} props.entityTitle The title to display.
- * @param {string} props.entityLabel A label to use for entity-related options.
- * E.g. "template" would be used for "edit
- * template" and "show template details".
- * @param {boolean} props.isLoaded Whether the data is available.
- * @param {Function} props.children React component to use for the
- * information dropdown area. Should be a
- * function which accepts dropdown props.
- * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.
- */
- function DocumentActions(_ref) {
- let {
- entityTitle,
- entityLabel,
- isLoaded,
- children: dropdownContent,
- showIconLabels
- } = _ref;
- const {
- label
- } = useSecondaryText(); // The title ref is passed to the popover as the anchorRef so that the
- // dropdown is centered over the whole title area rather than just one
- // part of it.
- const titleRef = (0,external_wp_element_namespaceObject.useRef)(); // Return a simple loading indicator until we have information to show.
- if (!isLoaded) {
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-document-actions"
- }, (0,external_wp_i18n_namespaceObject.__)('Loading…'));
- } // Return feedback that the template does not seem to exist.
- if (!entityTitle) {
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-document-actions"
- }, (0,external_wp_i18n_namespaceObject.__)('Template not found'));
- }
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()('edit-site-document-actions', {
- 'has-secondary-label': !!label
- })
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- ref: titleRef,
- className: "edit-site-document-actions__title-wrapper"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- className: "edit-site-document-actions__title",
- as: "h1"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "span"
- }, (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: %s: the entity being edited, like "template"*/
- (0,external_wp_i18n_namespaceObject.__)('Editing %s: '), entityLabel)), entityTitle), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- className: "edit-site-document-actions__secondary-item"
- }, label !== null && label !== void 0 ? label : ''), dropdownContent && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
- popoverProps: {
- anchorRef: titleRef.current
- },
- position: "bottom center",
- renderToggle: _ref2 => {
- let {
- isOpen,
- onToggle
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-document-actions__get-info",
- icon: chevron_down,
- "aria-expanded": isOpen,
- "aria-haspopup": "true",
- onClick: onToggle,
- label: (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: %s: the entity to see details about, like "template"*/
- (0,external_wp_i18n_namespaceObject.__)('Show %s details'), entityLabel)
- }, showIconLabels && (0,external_wp_i18n_namespaceObject.__)('Details'));
- },
- contentClassName: "edit-site-document-actions__info-dropdown",
- renderContent: dropdownContent
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function useLink() {
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- let state = arguments.length > 1 ? arguments[1] : undefined;
- let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- const history = useHistory();
- function onClick(event) {
- event.preventDefault();
- if (shouldReplace) {
- history.replace(params, state);
- } else {
- history.push(params, state);
- }
- }
- return {
- href: (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params),
- onClick
- };
- }
- function Link(_ref) {
- let {
- params = {},
- state,
- replace: shouldReplace = false,
- children,
- ...props
- } = _ref;
- const {
- href,
- onClick
- } = useLink(params, state, shouldReplace);
- return (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({
- href: href,
- onClick: onClick
- }, props), children);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/template-areas.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TemplatePartItemMore(_ref) {
- var _templatePart$title;
- let {
- onClose,
- templatePart,
- closeTemplateDetailsDropdown
- } = _ref;
- const {
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- params
- } = useLocation();
- const editLinkProps = useLink({
- postId: templatePart.id,
- postType: templatePart.type
- }, {
- fromTemplateId: params.postId
- });
- function editTemplatePart(event) {
- editLinkProps.onClick(event);
- onClose();
- closeTemplateDetailsDropdown();
- }
- function clearCustomizations() {
- revertTemplate(templatePart);
- onClose();
- closeTemplateDetailsDropdown();
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, editLinkProps, {
- onClick: editTemplatePart
- }), (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: %s: template part title */
- (0,external_wp_i18n_namespaceObject.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), isTemplateRevertable(templatePart) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'),
- onClick: clearCustomizations
- }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))));
- }
- function TemplatePartItem(_ref2) {
- let {
- templatePart,
- clientId,
- closeTemplateDetailsDropdown
- } = _ref2;
- const {
- selectBlock,
- toggleBlockHighlight
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
- return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area);
- }, [templatePart.area]);
- const highlightBlock = () => toggleBlockHighlight(clientId, true);
- const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- role: "menuitem",
- className: "edit-site-template-details__template-areas-item"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- role: "button",
- icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
- iconPosition: "left",
- onClick: () => {
- selectBlock(clientId);
- },
- onMouseOver: highlightBlock,
- onMouseLeave: cancelHighlightBlock,
- onFocus: highlightBlock,
- onBlur: cancelHighlightBlock
- }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('More options'),
- className: "edit-site-template-details__template-areas-item-more"
- }, _ref3 => {
- let {
- onClose
- } = _ref3;
- return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItemMore, {
- onClose: onClose,
- templatePart: templatePart,
- closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
- });
- }));
- }
- function TemplateAreas(_ref4) {
- let {
- closeTemplateDetailsDropdown
- } = _ref4;
- const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []);
- if (!templateParts.length) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Areas'),
- className: "edit-site-template-details__group edit-site-template-details__template-areas"
- }, templateParts.map(_ref5 => {
- let {
- templatePart,
- block
- } = _ref5;
- return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItem, {
- key: templatePart.slug,
- clientId: block.clientId,
- templatePart: templatePart,
- closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
- });
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/edit-template-title.js
- /**
- * WordPress dependencies
- */
- function EditTemplateTitle(_ref) {
- let {
- template
- } = _ref;
- const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', template.type, 'title', template.id);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Title'),
- value: title,
- help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
- onChange: newTitle => {
- setTitle(newTitle || template.slug);
- }
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TemplateDetails(_ref) {
- let {
- template,
- onClose
- } = _ref;
- const {
- title,
- description
- } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetTemplateInfo(template), []);
- const {
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const templateSubMenu = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if ((template === null || template === void 0 ? void 0 : template.type) === 'wp_template') {
- return {
- title: (0,external_wp_i18n_namespaceObject.__)('templates'),
- menu: MENU_TEMPLATES
- };
- }
- return TEMPLATE_PARTS_SUB_MENUS.find(_ref2 => {
- let {
- area
- } = _ref2;
- return area === (template === null || template === void 0 ? void 0 : template.area);
- });
- }, [template]);
- const browseAllLinkProps = useLink({
- // TODO: We should update this to filter by template part's areas as well.
- postType: template.type,
- postId: undefined
- }); // Only user-created and non-default templates can change the name.
- const canEditTitle = template.is_custom && !template.has_theme_file;
- if (!template) {
- return null;
- }
- const revert = () => {
- revertTemplate(template);
- onClose();
- };
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-template-details"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-template-details__group"
- }, canEditTitle ? (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, {
- template: template
- }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 4,
- weight: 600,
- className: "edit-site-template-details__title"
- }, title), description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
- size: "body",
- className: "edit-site-template-details__description",
- as: "p"
- }, description)), (0,external_wp_element_namespaceObject.createElement)(TemplateAreas, {
- closeTemplateDetailsDropdown: onClose
- }), isTemplateRevertable(template) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- className: "edit-site-template-details__group edit-site-template-details__revert"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- className: "edit-site-template-details__revert-button",
- info: (0,external_wp_i18n_namespaceObject.__)('Restore template to default state'),
- onClick: revert
- }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({
- className: "edit-site-template-details__show-all-button"
- }, browseAllLinkProps), (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: the template part's area name ("Headers", "Sidebars") or "templates". */
- (0,external_wp_i18n_namespaceObject.__)('Browse all %s'), templateSubMenu.title)));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const preventDefault = event => {
- event.preventDefault();
- };
- function Header(_ref) {
- let {
- openEntitiesSavedStates,
- isEntitiesSavedStatesOpen,
- showIconLabels
- } = _ref;
- const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
- const {
- deviceType,
- entityTitle,
- template,
- templateType,
- isInserterOpen,
- isListViewOpen,
- listViewShortcut,
- isLoaded,
- isVisualMode
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- __experimentalGetPreviewDeviceType,
- getEditedPostType,
- getEditedPostId,
- isInserterOpened,
- isListViewOpened,
- getEditorMode
- } = select(store_store);
- const {
- getEditedEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- __experimentalGetTemplateInfo: getTemplateInfo
- } = select(external_wp_editor_namespaceObject.store);
- const {
- getShortcutRepresentation
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
- const postType = getEditedPostType();
- const postId = getEditedPostId();
- const record = getEditedEntityRecord('postType', postType, postId);
- const _isLoaded = !!postId;
- return {
- deviceType: __experimentalGetPreviewDeviceType(),
- entityTitle: getTemplateInfo(record).title,
- isLoaded: _isLoaded,
- template: record,
- templateType: postType,
- isInserterOpen: isInserterOpened(),
- isListViewOpen: isListViewOpened(),
- listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'),
- isVisualMode: getEditorMode() === 'visual'
- };
- }, []);
- const {
- __experimentalSetPreviewDeviceType: setPreviewDeviceType,
- setIsInserterOpened,
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
- if (isInserterOpen) {
- // Focusing the inserter button closes the inserter popover.
- inserterButton.current.focus();
- } else {
- setIsInserterOpened(true);
- }
- }, [isInserterOpen, setIsInserterOpened]);
- const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
- const isFocusMode = templateType === 'wp_template_part';
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header_start"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header__toolbar"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- ref: inserterButton,
- variant: "primary",
- isPressed: isInserterOpen,
- className: "edit-site-header-toolbar__inserter-toggle",
- disabled: !isVisualMode,
- onMouseDown: preventDefault,
- onClick: openInserter,
- icon: library_plus,
- label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button')
- }, showIconLabels && (!isInserterOpen ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
- as: external_wp_blockEditor_namespaceObject.ToolSelector,
- disabled: !isVisualMode
- }), (0,external_wp_element_namespaceObject.createElement)(UndoButton, null), (0,external_wp_element_namespaceObject.createElement)(RedoButton, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-header-toolbar__list-view-toggle",
- disabled: !isVisualMode,
- icon: list_view,
- isPressed: isListViewOpen
- /* translators: button label text should, if possible, be under 16 characters. */
- ,
- label: (0,external_wp_i18n_namespaceObject.__)('List View'),
- onClick: toggleListView,
- shortcut: listViewShortcut
- })))), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header_center"
- }, (0,external_wp_element_namespaceObject.createElement)(DocumentActions, {
- entityTitle: entityTitle,
- entityLabel: templateType === 'wp_template_part' ? 'template part' : 'template',
- isLoaded: isLoaded,
- showIconLabels: showIconLabels
- }, _ref2 => {
- let {
- onClose
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(TemplateDetails, {
- template: template,
- onClose: onClose
- });
- })), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header_end"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-header__actions"
- }, !isFocusMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
- deviceType: deviceType,
- setDeviceType: setPreviewDeviceType
- }), (0,external_wp_element_namespaceObject.createElement)(SaveButton, {
- openEntitiesSavedStates: openEntitiesSavedStates,
- isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen
- }), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
- scope: "core/edit-site"
- }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null))));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
- /**
- * WordPress dependencies
- */
- const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
- clipRule: "evenodd"
- }));
- /* harmony default export */ var library_cog = (cog);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/default-sidebar.js
- /**
- * WordPress dependencies
- */
- function default_sidebar_DefaultSidebar(_ref) {
- let {
- className,
- identifier,
- title,
- icon,
- children,
- closeLabel,
- header,
- headerClassName,
- panelClassName
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(complementary_area, {
- className: className,
- scope: "core/edit-site",
- identifier: identifier,
- title: title,
- icon: icon,
- closeLabel: closeLabel,
- header: header,
- headerClassName: headerClassName,
- panelClassName: panelClassName
- }, children), (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
- scope: "core/edit-site",
- identifier: identifier,
- icon: icon
- }, title));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
- /**
- * WordPress dependencies
- */
- const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"
- }));
- /* harmony default export */ var library_styles = (styles);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function IconWithCurrentColor(_ref) {
- let {
- className,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, extends_extends({
- className: classnames_default()(className, 'edit-site-global-styles-icon-with-current-color')
- }, props));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function GenericNavigationButton(_ref) {
- let {
- icon,
- children,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, props, icon && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
- icon: icon,
- size: 24
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children);
- }
- function NavigationButton(props) {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, extends_extends({
- as: GenericNavigationButton
- }, props));
- }
- function NavigationBackButton(props) {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, extends_extends({
- as: GenericNavigationButton
- }, props));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js
- /**
- * WordPress dependencies
- */
- const typography = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"
- }));
- /* harmony default export */ var library_typography = (typography);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js
- /**
- * WordPress dependencies
- */
- const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"
- }));
- /* harmony default export */ var library_color = (color);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
- /**
- * WordPress dependencies
- */
- const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
- }));
- /* harmony default export */ var library_layout = (layout);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js
- /**
- * External dependencies
- */
- /* Supporting data. */
- const ROOT_BLOCK_NAME = 'root';
- const ROOT_BLOCK_SELECTOR = 'body';
- const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']));
- const PRESET_METADATA = [{
- path: ['color', 'palette'],
- valueKey: 'color',
- cssVarInfix: 'color',
- classes: [{
- classSuffix: 'color',
- propertyName: 'color'
- }, {
- classSuffix: 'background-color',
- propertyName: 'background-color'
- }, {
- classSuffix: 'border-color',
- propertyName: 'border-color'
- }]
- }, {
- path: ['color', 'gradients'],
- valueKey: 'gradient',
- cssVarInfix: 'gradient',
- classes: [{
- classSuffix: 'gradient-background',
- propertyName: 'background'
- }]
- }, {
- path: ['color', 'duotone'],
- cssVarInfix: 'duotone',
- valueFunc: _ref => {
- let {
- slug
- } = _ref;
- return `url( '#wp-duotone-${slug}' )`;
- },
- classes: []
- }, {
- path: ['typography', 'fontSizes'],
- valueKey: 'size',
- cssVarInfix: 'font-size',
- classes: [{
- classSuffix: 'font-size',
- propertyName: 'font-size'
- }]
- }, {
- path: ['typography', 'fontFamilies'],
- valueKey: 'fontFamily',
- cssVarInfix: 'font-family',
- classes: [{
- classSuffix: 'font-family',
- propertyName: 'font-family'
- }]
- }];
- const STYLE_PATH_TO_CSS_VAR_INFIX = {
- 'color.background': 'color',
- 'color.text': 'color',
- 'elements.link.color.text': 'color',
- 'color.gradient': 'gradient',
- 'typography.fontSize': 'font-size',
- 'typography.fontFamily': 'font-family'
- };
- function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
- // Block presets take priority above root level presets.
- const orderedPresetsByOrigin = [(0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, ...presetPath]), (0,external_lodash_namespaceObject.get)(features, presetPath)];
- for (const presetByOrigin of orderedPresetsByOrigin) {
- if (presetByOrigin) {
- // Preset origins ordered by priority.
- const origins = ['custom', 'theme', 'default'];
- for (const origin of origins) {
- const presets = presetByOrigin[origin];
- if (presets) {
- const presetObject = (0,external_lodash_namespaceObject.find)(presets, preset => preset[presetProperty] === presetValueValue);
- if (presetObject) {
- if (presetProperty === 'slug') {
- return presetObject;
- } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
- const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug);
- if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
- return presetObject;
- }
- return undefined;
- }
- }
- }
- }
- }
- }
- function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
- if (!presetPropertyValue) {
- return presetPropertyValue;
- }
- const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
- const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', cssVarInfix]);
- if (!metadata) {
- // The property doesn't have preset data
- // so the value should be returned as it is.
- return presetPropertyValue;
- }
- const {
- valueKey,
- path
- } = metadata;
- const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue);
- if (!presetObject) {
- // Value wasn't found in the presets,
- // so it must be a custom value.
- return presetPropertyValue;
- }
- return `var:preset|${cssVarInfix}|${presetObject.slug}`;
- }
- function getValueFromPresetVariable(features, blockName, variable, _ref2) {
- let [presetType, slug] = _ref2;
- const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', presetType]);
- if (!metadata) {
- return variable;
- }
- const presetObject = findInPresetsBy(features, blockName, metadata.path, 'slug', slug);
- if (presetObject) {
- const {
- valueKey
- } = metadata;
- const result = presetObject[valueKey];
- return getValueFromVariable(features, blockName, result);
- }
- return variable;
- }
- function getValueFromCustomVariable(features, blockName, variable, path) {
- var _get;
- const result = (_get = (0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(features, ['custom', ...path]);
- if (!result) {
- return variable;
- } // A variable may reference another variable so we need recursion until we find the value.
- return getValueFromVariable(features, blockName, result);
- }
- function getValueFromVariable(features, blockName, variable) {
- if (!variable || !(0,external_lodash_namespaceObject.isString)(variable)) {
- return variable;
- }
- const USER_VALUE_PREFIX = 'var:';
- const THEME_VALUE_PREFIX = 'var(--wp--';
- const THEME_VALUE_SUFFIX = ')';
- let parsedVar;
- if (variable.startsWith(USER_VALUE_PREFIX)) {
- parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|');
- } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
- parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--');
- } else {
- // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
- return variable;
- }
- const [type, ...path] = parsedVar;
- if (type === 'preset') {
- return getValueFromPresetVariable(features, blockName, variable, path);
- }
- if (type === 'custom') {
- return getValueFromCustomVariable(features, blockName, variable, path);
- }
- return variable;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context.js
- /**
- * WordPress dependencies
- */
- const DEFAULT_GLOBAL_STYLES_CONTEXT = {
- user: {},
- base: {},
- merged: {},
- setUserConfig: () => {}
- };
- const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const EMPTY_CONFIG = {
- settings: {},
- styles: {}
- };
- const useGlobalStylesReset = () => {
- const {
- user: config,
- setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
- const canReset = !!config && !(0,external_lodash_namespaceObject.isEqual)(config, EMPTY_CONFIG);
- return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])];
- };
- function useSetting(path, blockName) {
- var _getSettingValueForCo;
- let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
- const {
- merged: mergedConfig,
- base: baseConfig,
- user: userConfig,
- setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
- const fullPath = !blockName ? `settings.${path}` : `settings.blocks.${blockName}.${path}`;
- const setSetting = newValue => {
- setUserConfig(currentConfig => {
- const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig);
- const pathToSet = external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path] ? fullPath + '.custom' : fullPath;
- (0,external_lodash_namespaceObject.set)(newUserConfig, pathToSet, newValue);
- return newUserConfig;
- });
- };
- const getSettingValueForContext = name => {
- const currentPath = !name ? `settings.${path}` : `settings.blocks.${name}.${path}`;
- const getSettingValue = configToUse => {
- const result = (0,external_lodash_namespaceObject.get)(configToUse, currentPath);
- if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path]) {
- var _ref, _result$custom;
- return (_ref = (_result$custom = result === null || result === void 0 ? void 0 : result.custom) !== null && _result$custom !== void 0 ? _result$custom : result === null || result === void 0 ? void 0 : result.theme) !== null && _ref !== void 0 ? _ref : result === null || result === void 0 ? void 0 : result.default;
- }
- return result;
- };
- let result;
- switch (source) {
- case 'all':
- result = getSettingValue(mergedConfig);
- break;
- case 'user':
- result = getSettingValue(userConfig);
- break;
- case 'base':
- result = getSettingValue(baseConfig);
- break;
- default:
- throw 'Unsupported source';
- }
- return result;
- }; // Unlike styles settings get inherited from top level settings.
- const resultWithFallback = (_getSettingValueForCo = getSettingValueForContext(blockName)) !== null && _getSettingValueForCo !== void 0 ? _getSettingValueForCo : getSettingValueForContext();
- return [resultWithFallback, setSetting];
- }
- function useStyle(path, blockName) {
- var _get;
- let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
- const {
- merged: mergedConfig,
- base: baseConfig,
- user: userConfig,
- setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
- const finalPath = !blockName ? `styles.${path}` : `styles.blocks.${blockName}.${path}`;
- const setStyle = newValue => {
- setUserConfig(currentConfig => {
- const newUserConfig = (0,external_lodash_namespaceObject.cloneDeep)(currentConfig);
- (0,external_lodash_namespaceObject.set)(newUserConfig, finalPath, getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue));
- return newUserConfig;
- });
- };
- let result;
- switch (source) {
- case 'all':
- result = getValueFromVariable(mergedConfig.settings, blockName, (_get = (0,external_lodash_namespaceObject.get)(userConfig, finalPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(baseConfig, finalPath));
- break;
- case 'user':
- result = getValueFromVariable(mergedConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(userConfig, finalPath));
- break;
- case 'base':
- result = getValueFromVariable(baseConfig.settings, blockName, (0,external_lodash_namespaceObject.get)(baseConfig, finalPath));
- break;
- default:
- throw 'Unsupported source';
- }
- return [result, setStyle];
- }
- const hooks_ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'];
- function getSupportedGlobalStylesPanels(name) {
- if (!name) {
- return hooks_ROOT_BLOCK_SUPPORTS;
- }
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
- if (!blockType) {
- return [];
- }
- const supportKeys = [];
- Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => {
- if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) {
- return;
- } // Opting out means that, for certain support keys like background color,
- // blocks have to explicitly set the support value false. If the key is
- // unset, we still enable it.
- if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) {
- if ((0,external_lodash_namespaceObject.has)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0]) && (0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) {
- return supportKeys.push(styleName);
- }
- }
- if ((0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) {
- return supportKeys.push(styleName);
- }
- });
- return supportKeys;
- }
- function useColorsPerOrigin(name) {
- const [customColors] = useSetting('color.palette.custom', name);
- const [themeColors] = useSetting('color.palette.theme', name);
- const [defaultColors] = useSetting('color.palette.default', name);
- const [shouldDisplayDefaultColors] = useSetting('color.defaultPalette');
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- const result = [];
- if (themeColors && themeColors.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
- colors: themeColors
- });
- }
- if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
- colors: defaultColors
- });
- }
- if (customColors && customColors.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
- colors: customColors
- });
- }
- return result;
- }, [customColors, themeColors, defaultColors]);
- }
- function useGradientsPerOrigin(name) {
- const [customGradients] = useSetting('color.gradients.custom', name);
- const [themeGradients] = useSetting('color.gradients.theme', name);
- const [defaultGradients] = useSetting('color.gradients.default', name);
- const [shouldDisplayDefaultGradients] = useSetting('color.defaultGradients');
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
- const result = [];
- if (themeGradients && themeGradients.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
- gradients: themeGradients
- });
- }
- if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
- gradients: defaultGradients
- });
- }
- if (customGradients && customGradients.length) {
- result.push({
- name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
- gradients: customGradients
- });
- }
- return result;
- }, [customGradients, themeGradients, defaultGradients]);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/border-panel.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const MIN_BORDER_WIDTH = 0;
- function useHasBorderPanel(name) {
- const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)];
- return controls.some(Boolean);
- }
- function useHasBorderColorControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('border.color', name)[0] && supports.includes('borderColor');
- }
- function useHasBorderRadiusControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('border.radius', name)[0] && supports.includes('borderRadius');
- }
- function useHasBorderStyleControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('border.style', name)[0] && supports.includes('borderStyle');
- }
- function useHasBorderWidthControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('border.width', name)[0] && supports.includes('borderWidth');
- }
- function BorderPanel(_ref) {
- let {
- name
- } = _ref;
- // To better reflect if the user has customized a value we need to
- // ensure the style value being checked is from the `user` origin.
- const [userBorderStyles] = useStyle('border', name, 'user');
- const createHasValueCallback = feature => () => !!(userBorderStyles !== null && userBorderStyles !== void 0 && userBorderStyles[feature]);
- const createResetCallback = setStyle => () => setStyle(undefined);
- const handleOnChange = setStyle => value => {
- setStyle(value || undefined);
- };
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
- availableUnits: useSetting('spacing.units')[0] || ['px', 'em', 'rem']
- }); // Border width.
- const showBorderWidth = useHasBorderWidthControl(name);
- const [borderWidthValue, setBorderWidth] = useStyle('border.width', name); // Border style.
- const showBorderStyle = useHasBorderStyleControl(name);
- const [borderStyle, setBorderStyle] = useStyle('border.style', name); // When we set a border color or width ensure we have a style so the user
- // can see a visible border.
- const handleOnChangeWithStyle = setStyle => value => {
- if (!!value && !borderStyle) {
- setBorderStyle('solid');
- }
- setStyle(value || undefined);
- }; // Border color.
- const showBorderColor = useHasBorderColorControl(name);
- const [borderColor, setBorderColor] = useStyle('border.color', name);
- const disableCustomColors = !useSetting('color.custom')[0];
- const disableCustomGradients = !useSetting('color.customGradient')[0];
- const borderColorSettings = [{
- label: (0,external_wp_i18n_namespaceObject.__)('Color'),
- colors: useColorsPerOrigin(name),
- colorValue: borderColor,
- onColorChange: handleOnChangeWithStyle(setBorderColor),
- clearable: false
- }]; // Border radius.
- const showBorderRadius = useHasBorderRadiusControl(name);
- const [borderRadiusValues, setBorderRadius] = useStyle('border.radius', name);
- const hasBorderRadius = () => {
- const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius;
- if (typeof borderValues === 'object') {
- return Object.entries(borderValues).some(Boolean);
- }
- return !!borderValues;
- };
- const resetAll = () => {
- setBorderColor(undefined);
- setBorderRadius(undefined);
- setBorderStyle(undefined);
- setBorderWidth(undefined);
- };
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Border'),
- resetAll: resetAll
- }, showBorderWidth && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- className: "single-column",
- hasValue: createHasValueCallback('width'),
- label: (0,external_wp_i18n_namespaceObject.__)('Width'),
- onDeselect: createResetCallback(setBorderWidth),
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
- value: borderWidthValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Width'),
- min: MIN_BORDER_WIDTH,
- onChange: handleOnChangeWithStyle(setBorderWidth),
- units: units
- })), showBorderStyle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- className: "single-column",
- hasValue: createHasValueCallback('style'),
- label: (0,external_wp_i18n_namespaceObject.__)('Style'),
- onDeselect: createResetCallback(setBorderStyle),
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderStyleControl, {
- value: borderStyle,
- onChange: handleOnChange(setBorderStyle)
- })), showBorderColor && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- hasValue: createHasValueCallback('color'),
- label: (0,external_wp_i18n_namespaceObject.__)('Color'),
- onDeselect: createResetCallback(setBorderColor),
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, {
- __experimentalHasMultipleOrigins: true,
- __experimentalIsRenderedInSidebar: true,
- disableCustomColors: disableCustomColors,
- disableCustomGradients: disableCustomGradients,
- enableAlpha: true,
- settings: borderColorSettings
- })), showBorderRadius && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- hasValue: hasBorderRadius,
- label: (0,external_wp_i18n_namespaceObject.__)('Radius'),
- onDeselect: createResetCallback(setBorderRadius),
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderRadiusControl, {
- values: borderRadiusValues,
- onChange: handleOnChange(setBorderRadius)
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-utils.js
- /**
- * Internal dependencies
- */
- function useHasColorPanel(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor');
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const AXIAL_SIDES = ['horizontal', 'vertical'];
- function useHasDimensionsPanel(name) {
- const hasPadding = useHasPadding(name);
- const hasMargin = useHasMargin(name);
- const hasGap = useHasGap(name);
- return hasPadding || hasMargin || hasGap;
- }
- function useHasPadding(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- const [settings] = useSetting('spacing.padding', name);
- return settings && supports.includes('padding');
- }
- function useHasMargin(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- const [settings] = useSetting('spacing.margin', name);
- return settings && supports.includes('margin');
- }
- function useHasGap(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- const [settings] = useSetting('spacing.blockGap', name); // Do not show the gap control panel for block-level global styles
- // as they do not work on the frontend.
- // See: https://github.com/WordPress/gutenberg/pull/39845.
- // We can revert this condition when they're working again.
- return !!name ? false : settings && supports.includes('--wp--style--block-gap');
- }
- function filterValuesBySides(values, sides) {
- if (!sides) {
- // If no custom side configuration all sides are opted into by default.
- return values;
- } // Only include sides opted into within filtered values.
- const filteredValues = {};
- sides.forEach(side => {
- if (side === 'vertical') {
- filteredValues.top = values.top;
- filteredValues.bottom = values.bottom;
- }
- if (side === 'horizontal') {
- filteredValues.left = values.left;
- filteredValues.right = values.right;
- }
- filteredValues[side] = values[side];
- });
- return filteredValues;
- }
- function splitStyleValue(value) {
- // Check for shorthand value ( a string value ).
- if (value && typeof value === 'string') {
- // Convert to value for individual sides for BoxControl.
- return {
- top: value,
- right: value,
- bottom: value,
- left: value
- };
- }
- return value;
- }
- function DimensionsPanel(_ref) {
- let {
- name
- } = _ref;
- const showPaddingControl = useHasPadding(name);
- const showMarginControl = useHasMargin(name);
- const showGapControl = useHasGap(name);
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
- availableUnits: useSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw']
- });
- const [rawPadding, setRawPadding] = useStyle('spacing.padding', name);
- const paddingValues = splitStyleValue(rawPadding);
- const paddingSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'padding');
- const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
- const setPaddingValues = newPaddingValues => {
- const padding = filterValuesBySides(newPaddingValues, paddingSides);
- setRawPadding(padding);
- };
- const resetPaddingValue = () => setPaddingValues({});
- const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length;
- const [rawMargin, setRawMargin] = useStyle('spacing.margin', name);
- const marginValues = splitStyleValue(rawMargin);
- const marginSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'margin');
- const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
- const setMarginValues = newMarginValues => {
- const margin = filterValuesBySides(newMarginValues, marginSides);
- setRawMargin(margin);
- };
- const resetMarginValue = () => setMarginValues({});
- const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length;
- const [gapValue, setGapValue] = useStyle('spacing.blockGap', name);
- const resetGapValue = () => setGapValue(undefined);
- const hasGapValue = () => !!gapValue;
- const resetAll = () => {
- resetPaddingValue();
- resetMarginValue();
- resetGapValue();
- };
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
- label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'),
- resetAll: resetAll
- }, showPaddingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- hasValue: hasPaddingValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
- onDeselect: resetPaddingValue,
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
- values: paddingValues,
- onChange: setPaddingValues,
- label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
- sides: paddingSides,
- units: units,
- allowReset: false,
- splitOnAxis: isAxialPadding
- })), showMarginControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- hasValue: hasMarginValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
- onDeselect: resetMarginValue,
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
- values: marginValues,
- onChange: setMarginValues,
- label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
- sides: marginSides,
- units: units,
- allowReset: false,
- splitOnAxis: isAxialMargin
- })), showGapControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
- hasValue: hasGapValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
- onDeselect: resetGapValue,
- isShownByDefault: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
- __unstableInputWidth: "80px",
- min: 0,
- onChange: setGapValue,
- units: units,
- value: gapValue
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function useHasTypographyPanel(name) {
- const hasLineHeight = useHasLineHeightControl(name);
- const hasFontAppearance = useHasAppearanceControl(name);
- const hasLetterSpacing = useHasLetterSpacingControl(name);
- const supports = getSupportedGlobalStylesPanels(name);
- return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
- }
- function useHasLineHeightControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
- }
- function useHasAppearanceControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
- const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
- return hasFontStyles || hasFontWeights;
- }
- function useHasLetterSpacingControl(name) {
- const supports = getSupportedGlobalStylesPanels(name);
- return useSetting('typography.letterSpacing', name)[0] && supports.includes('letterSpacing');
- }
- function TypographyPanel(_ref) {
- let {
- name,
- element
- } = _ref;
- const supports = getSupportedGlobalStylesPanels(name);
- const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
- const [fontSizes] = useSetting('typography.fontSizes', name);
- const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0];
- const [fontFamilies] = useSetting('typography.fontFamilies', name);
- const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
- const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
- const hasLineHeightEnabled = useHasLineHeightControl(name);
- const hasAppearanceControl = useHasAppearanceControl(name);
- const hasLetterSpacingControl = useHasLetterSpacingControl(name);
- const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name);
- const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name);
- const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name);
- const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name);
- const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name);
- const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
- const [backgroundColor] = useStyle(prefix + 'color.background', name);
- const [gradientValue] = useStyle(prefix + 'color.gradient', name);
- const [color] = useStyle(prefix + 'color.text', name);
- const extraStyles = element === 'link' ? {
- textDecoration: 'underline'
- } : {};
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
- className: "edit-site-typography-panel",
- initialOpen: true
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-typography-panel__preview",
- style: {
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
- color,
- fontSize,
- fontStyle,
- fontWeight,
- letterSpacing,
- ...extraStyles
- }
- }, "Aa"), supports.includes('fontFamily') && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontFamilyControl, {
- fontFamilies: fontFamilies,
- value: fontFamily,
- onChange: setFontFamily
- }), supports.includes('fontSize') && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, {
- value: fontSize,
- onChange: setFontSize,
- fontSizes: fontSizes,
- disableCustomFontSizes: disableCustomFontSizes
- }), hasLineHeightEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- marginBottom: 6
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.LineHeightControl, {
- __nextHasNoMarginBottom: true,
- value: lineHeight,
- onChange: setLineHeight
- })), hasAppearanceControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontAppearanceControl, {
- value: {
- fontStyle,
- fontWeight
- },
- onChange: _ref2 => {
- let {
- fontStyle: newFontStyle,
- fontWeight: newFontWeight
- } = _ref2;
- setFontStyle(newFontStyle);
- setFontWeight(newFontWeight);
- },
- hasFontStyles: hasFontStyles,
- hasFontWeights: hasFontWeights
- }), hasLetterSpacingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLetterSpacingControl, {
- value: letterSpacing,
- onChange: setLetterSpacing
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context-menu.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ContextMenu(_ref) {
- let {
- name,
- parentMenu = ''
- } = _ref;
- const hasTypographyPanel = useHasTypographyPanel(name);
- const hasColorPanel = useHasColorPanel(name);
- const hasBorderPanel = useHasBorderPanel(name);
- const hasDimensionsPanel = useHasDimensionsPanel(name);
- const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- icon: library_typography,
- path: parentMenu + '/typography'
- }, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- icon: library_color,
- path: parentMenu + '/colors'
- }, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- icon: library_layout,
- path: parentMenu + '/layout'
- }, (0,external_wp_i18n_namespaceObject.__)('Layout')));
- }
- /* harmony default export */ var context_menu = (ContextMenu);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/utils.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- function generateBoxRules(style, options, path, ruleKey) {
- const boxStyle = (0,external_lodash_namespaceObject.get)(style, path);
- if (!boxStyle) {
- return [];
- }
- const rules = [];
- if (typeof boxStyle === 'string') {
- rules.push({
- selector: options.selector,
- key: ruleKey,
- value: boxStyle
- });
- } else {
- const sideRules = ['top', 'right', 'bottom', 'left'].reduce((acc, side) => {
- const value = (0,external_lodash_namespaceObject.get)(boxStyle, [side]);
- if (value) {
- acc.push({
- selector: options.selector,
- key: `${ruleKey}${(0,external_lodash_namespaceObject.upperFirst)(side)}`,
- value
- });
- }
- return acc;
- }, []);
- rules.push(...sideRules);
- }
- return rules;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/padding.js
- /**
- * Internal dependencies
- */
- const padding = {
- name: 'padding',
- generate: (style, options) => {
- return generateBoxRules(style, options, ['spacing', 'padding'], 'padding');
- }
- };
- /* harmony default export */ var styles_padding = (padding);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/margin.js
- /**
- * Internal dependencies
- */
- const margin = {
- name: 'margin',
- generate: (style, options) => {
- return generateBoxRules(style, options, ['spacing', 'margin'], 'margin');
- }
- };
- /* harmony default export */ var styles_margin = (margin);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/styles/index.js
- /**
- * Internal dependencies
- */
- const styleDefinitions = [styles_margin, styles_padding];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/style-engine/build-module/index.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Generates a stylesheet for a given style object and selector.
- *
- * @param style Style object.
- * @param options Options object with settings to adjust how the styles are generated.
- *
- * @return generated stylesheet.
- */
- function generate(style, options) {
- const rules = getCSSRules(style, options);
- const groupedRules = groupBy(rules, 'selector');
- const selectorRules = Object.keys(groupedRules).reduce((acc, subSelector) => {
- acc.push(`${subSelector} { ${groupedRules[subSelector].map(rule => `${kebabCase(rule.key)}: ${rule.value};`).join(' ')} }`);
- return acc;
- }, []);
- return selectorRules.join('\n');
- }
- /**
- * Returns a JSON representation of the generated CSS rules.
- *
- * @param style Style object.
- * @param options Options object with settings to adjust how the styles are generated.
- *
- * @return generated styles.
- */
- function getCSSRules(style, options) {
- const rules = [];
- styleDefinitions.forEach(definition => {
- rules.push(...definition.generate(style, options));
- });
- return rules;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/use-global-styles-output.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Internal dependencies
- */
- function compileStyleValue(uncompiledValue) {
- const VARIABLE_REFERENCE_PREFIX = 'var:';
- const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
- const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
- if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) {
- const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
- return `var(--wp--${variable})`;
- }
- return uncompiledValue;
- }
- /**
- * Transform given preset tree into a set of style declarations.
- *
- * @param {Object} blockPresets
- *
- * @return {Array} An array of style declarations.
- */
- function getPresetsDeclarations() {
- let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref) => {
- let {
- path,
- valueKey,
- valueFunc,
- cssVarInfix
- } = _ref;
- const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []);
- ['default', 'theme', 'custom'].forEach(origin => {
- if (presetByOrigin[origin]) {
- presetByOrigin[origin].forEach(value => {
- if (valueKey) {
- declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${value[valueKey]}`);
- } else if (valueFunc && typeof valueFunc === 'function') {
- declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${valueFunc(value)}`);
- }
- });
- }
- });
- return declarations;
- }, []);
- }
- /**
- * Transform given preset tree into a set of preset class declarations.
- *
- * @param {string} blockSelector
- * @param {Object} blockPresets
- * @return {string} CSS declarations for the preset classes.
- */
- function getPresetsClasses(blockSelector) {
- let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref2) => {
- let {
- path,
- cssVarInfix,
- classes
- } = _ref2;
- if (!classes) {
- return declarations;
- }
- const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []);
- ['default', 'theme', 'custom'].forEach(origin => {
- if (presetByOrigin[origin]) {
- presetByOrigin[origin].forEach(_ref3 => {
- let {
- slug
- } = _ref3;
- classes.forEach(_ref4 => {
- let {
- classSuffix,
- propertyName
- } = _ref4;
- const classSelectorToUse = `.has-${(0,external_lodash_namespaceObject.kebabCase)(slug)}-${classSuffix}`;
- const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3"
- .map(selector => `${selector}${classSelectorToUse}`).join(',');
- const value = `var(--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(slug)})`;
- declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`;
- });
- });
- }
- });
- return declarations;
- }, '');
- }
- function getPresetsSvgFilters() {
- let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- return PRESET_METADATA.filter( // Duotone are the only type of filters for now.
- metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
- const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, metadata.path, {});
- return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstablePresetDuotoneFilter, {
- preset: preset,
- key: preset.slug
- })));
- });
- }
- function flattenTree() {
- let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- let prefix = arguments.length > 1 ? arguments[1] : undefined;
- let token = arguments.length > 2 ? arguments[2] : undefined;
- let result = [];
- Object.keys(input).forEach(key => {
- const newKey = prefix + (0,external_lodash_namespaceObject.kebabCase)(key.replace('/', '-'));
- const newLeaf = input[key];
- if (newLeaf instanceof Object) {
- const newPrefix = newKey + token;
- result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
- } else {
- result.push(`${newKey}: ${newLeaf}`);
- }
- });
- return result;
- }
- /**
- * Transform given style tree into a set of style declarations.
- *
- * @param {Object} blockStyles Block styles.
- *
- * @return {Array} An array of style declarations.
- */
- function getStylesDeclarations() {
- let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- const output = (0,external_lodash_namespaceObject.reduce)(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => {
- let {
- value,
- properties,
- useEngine
- } = _ref5;
- const pathToValue = value;
- if ((0,external_lodash_namespaceObject.first)(pathToValue) === 'elements' || useEngine) {
- return declarations;
- }
- const styleValue = (0,external_lodash_namespaceObject.get)(blockStyles, pathToValue);
- if (!!properties && !(0,external_lodash_namespaceObject.isString)(styleValue)) {
- Object.entries(properties).forEach(entry => {
- const [name, prop] = entry;
- if (!(0,external_lodash_namespaceObject.get)(styleValue, [prop], false)) {
- // Do not create a declaration
- // for sub-properties that don't have any value.
- return;
- }
- const cssProperty = (0,external_lodash_namespaceObject.kebabCase)(name);
- declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(styleValue, [prop]))}`);
- });
- } else if ((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue, false)) {
- const cssProperty = key.startsWith('--') ? key : (0,external_lodash_namespaceObject.kebabCase)(key);
- declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue))}`);
- }
- return declarations;
- }, []); // The goal is to move everything to server side generated engine styles
- // This is temporary as we absorb more and more styles into the engine.
- const extraRules = getCSSRules(blockStyles, {
- selector: 'self'
- });
- extraRules.forEach(rule => {
- if (rule.selector !== 'self') {
- throw "This style can't be added as inline style";
- }
- const cssProperty = rule.key.startsWith('--') ? rule.key : (0,external_lodash_namespaceObject.kebabCase)(rule.key);
- output.push(`${cssProperty}: ${compileStyleValue(rule.value)}`);
- });
- return output;
- }
- const getNodesWithStyles = (tree, blockSelectors) => {
- var _tree$styles, _tree$styles2;
- const nodes = [];
- if (!(tree !== null && tree !== void 0 && tree.styles)) {
- return nodes;
- }
- const pickStyleKeys = treeToPickFrom => (0,external_lodash_namespaceObject.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter'].includes(key)); // Top-level.
- const styles = pickStyleKeys(tree.styles);
- if (!!styles) {
- nodes.push({
- styles,
- selector: ROOT_BLOCK_SELECTOR
- });
- }
- (0,external_lodash_namespaceObject.forEach)((_tree$styles = tree.styles) === null || _tree$styles === void 0 ? void 0 : _tree$styles.elements, (value, key) => {
- if (!!value && !!external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key]) {
- nodes.push({
- styles: value,
- selector: external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[key]
- });
- }
- }); // Iterate over blocks: they can have styles & elements.
- (0,external_lodash_namespaceObject.forEach)((_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.blocks, (node, blockName) => {
- var _blockSelectors$block;
- const blockStyles = pickStyleKeys(node);
- if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
- nodes.push({
- styles: blockStyles,
- selector: blockSelectors[blockName].selector,
- duotoneSelector: blockSelectors[blockName].duotoneSelector
- });
- }
- (0,external_lodash_namespaceObject.forEach)(node === null || node === void 0 ? void 0 : node.elements, (value, elementName) => {
- if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== null && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== void 0 && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName])) {
- nodes.push({
- styles: value,
- selector: blockSelectors[blockName].selector.split(',').map(sel => sel + ' ' + external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]).join(',')
- });
- }
- });
- });
- return nodes;
- };
- const getNodesWithSettings = (tree, blockSelectors) => {
- var _tree$settings, _tree$settings2;
- const nodes = [];
- if (!(tree !== null && tree !== void 0 && tree.settings)) {
- return nodes;
- }
- const pickPresets = treeToPickFrom => {
- const presets = {};
- PRESET_METADATA.forEach(_ref6 => {
- let {
- path
- } = _ref6;
- const value = (0,external_lodash_namespaceObject.get)(treeToPickFrom, path, false);
- if (value !== false) {
- (0,external_lodash_namespaceObject.set)(presets, path, value);
- }
- });
- return presets;
- }; // Top-level.
- const presets = pickPresets(tree.settings);
- const custom = (_tree$settings = tree.settings) === null || _tree$settings === void 0 ? void 0 : _tree$settings.custom;
- if (!(0,external_lodash_namespaceObject.isEmpty)(presets) || !!custom) {
- nodes.push({
- presets,
- custom,
- selector: ROOT_BLOCK_SELECTOR
- });
- } // Blocks.
- (0,external_lodash_namespaceObject.forEach)((_tree$settings2 = tree.settings) === null || _tree$settings2 === void 0 ? void 0 : _tree$settings2.blocks, (node, blockName) => {
- const blockPresets = pickPresets(node);
- const blockCustom = node.custom;
- if (!(0,external_lodash_namespaceObject.isEmpty)(blockPresets) || !!blockCustom) {
- nodes.push({
- presets: blockPresets,
- custom: blockCustom,
- selector: blockSelectors[blockName].selector
- });
- }
- });
- return nodes;
- };
- const toCustomProperties = (tree, blockSelectors) => {
- const settings = getNodesWithSettings(tree, blockSelectors);
- let ruleset = '';
- settings.forEach(_ref7 => {
- let {
- presets,
- custom,
- selector
- } = _ref7;
- const declarations = getPresetsDeclarations(presets);
- const customProps = flattenTree(custom, '--wp--custom--', '--');
- if (customProps.length > 0) {
- declarations.push(...customProps);
- }
- if (declarations.length > 0) {
- ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
- }
- });
- return ruleset;
- };
- const toStyles = (tree, blockSelectors) => {
- const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
- const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
- /*
- * Reset default browser margin on the root body element.
- * This is set on the root selector **before** generating the ruleset
- * from the `theme.json`. This is to ensure that if the `theme.json` declares
- * `margin` in its `spacing` declaration for the `body` element then these
- * user-generated values take precedence in the CSS cascade.
- * @link https://github.com/WordPress/gutenberg/issues/36147.
- */
- let ruleset = 'body {margin: 0;}';
- nodesWithStyles.forEach(_ref8 => {
- let {
- selector,
- duotoneSelector,
- styles
- } = _ref8;
- const duotoneStyles = {};
- if (styles !== null && styles !== void 0 && styles.filter) {
- duotoneStyles.filter = styles.filter;
- delete styles.filter;
- } // Process duotone styles (they use color.__experimentalDuotone selector).
- if (duotoneSelector) {
- const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
- if (duotoneDeclarations.length === 0) {
- return;
- }
- ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
- } // Process the remaning block styles (they use either normal block class or __experimentalSelector).
- const declarations = getStylesDeclarations(styles);
- if (declarations.length === 0) {
- return;
- }
- ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
- });
- nodesWithSettings.forEach(_ref9 => {
- let {
- selector,
- presets
- } = _ref9;
- if (ROOT_BLOCK_SELECTOR === selector) {
- // Do not add extra specificity for top-level classes.
- selector = '';
- }
- const classes = getPresetsClasses(selector, presets);
- if (!(0,external_lodash_namespaceObject.isEmpty)(classes)) {
- ruleset = ruleset + classes;
- }
- });
- return ruleset;
- };
- function toSvgFilters(tree, blockSelectors) {
- const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
- return nodesWithSettings.flatMap(_ref10 => {
- let {
- presets
- } = _ref10;
- return getPresetsSvgFilters(presets);
- });
- }
- const getBlockSelectors = blockTypes => {
- const result = {};
- blockTypes.forEach(blockType => {
- var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$;
- const name = blockType.name;
- const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
- const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
- result[name] = {
- name,
- selector,
- duotoneSelector
- };
- });
- return result;
- };
- function useGlobalStylesOutput() {
- const [stylesheets, setStylesheets] = (0,external_wp_element_namespaceObject.useState)([]);
- const [settings, setSettings] = (0,external_wp_element_namespaceObject.useState)({});
- const [svgFilters, setSvgFilters] = (0,external_wp_element_namespaceObject.useState)({});
- const {
- merged: mergedConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.styles) || !(mergedConfig !== null && mergedConfig !== void 0 && mergedConfig.settings)) {
- return;
- }
- const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)());
- const customProperties = toCustomProperties(mergedConfig, blockSelectors);
- const globalStyles = toStyles(mergedConfig, blockSelectors);
- const filters = toSvgFilters(mergedConfig, blockSelectors);
- setStylesheets([{
- css: customProperties,
- isGlobalStyles: true
- }, {
- css: globalStyles,
- isGlobalStyles: true
- }]);
- setSettings(mergedConfig.settings);
- setSvgFilters(filters);
- }, [mergedConfig]);
- return [stylesheets, settings, svgFilters];
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const firstFrame = {
- start: {
- opacity: 1,
- display: 'block'
- },
- hover: {
- opacity: 0,
- display: 'none'
- }
- };
- const secondFrame = {
- hover: {
- opacity: 1,
- display: 'block'
- },
- start: {
- opacity: 0,
- display: 'none'
- }
- };
- const normalizedWidth = 248;
- const normalizedHeight = 152;
- const normalizedColorSwatchSize = 32;
- const StylesPreview = _ref => {
- let {
- label,
- isFocused
- } = _ref;
- const [fontWeight] = useStyle('typography.fontWeight');
- const [fontFamily = 'serif'] = useStyle('typography.fontFamily');
- const [headingFontFamily = fontFamily] = useStyle('elements.h1.typography.fontFamily');
- const [headingFontWeight = fontWeight] = useStyle('elements.h1.typography.fontWeight');
- const [textColor = 'black'] = useStyle('color.text');
- const [headingColor = textColor] = useStyle('elements.h1.color.text');
- const [linkColor = 'blue'] = useStyle('elements.link.color.text');
- const [backgroundColor = 'white'] = useStyle('color.background');
- const [gradientValue] = useStyle('color.gradient');
- const [styles] = useGlobalStylesOutput();
- const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
- const [coreColors] = useSetting('color.palette.core');
- const [themeColors] = useSetting('color.palette.theme');
- const [customColors] = useSetting('color.palette.custom');
- const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
- const [containerResizeListener, {
- width
- }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
- const ratio = width ? width / normalizedWidth : 1;
- const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []);
- const highlightedColors = paletteColors.filter( // we exclude these two colors because they are already visible in the preview.
- _ref2 => {
- let {
- color
- } = _ref2;
- return color !== backgroundColor && color !== headingColor;
- }).slice(0, 2); // Reset leaked styles from WP common.css.
- const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (styles) {
- return [...styles, {
- css: 'body{min-width: 0;}',
- isGlobalStyles: true
- }];
- }
- return styles;
- }, [styles]);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
- className: "edit-site-global-styles-preview__iframe",
- head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
- styles: editorStyles
- }),
- style: {
- height: normalizedHeight * ratio,
- visibility: !width ? 'hidden' : 'visible'
- },
- onMouseEnter: () => setIsHovered(true),
- onMouseLeave: () => setIsHovered(false),
- tabIndex: -1
- }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- style: {
- height: normalizedHeight * ratio,
- width: '100%',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
- cursor: 'pointer'
- },
- initial: "start",
- animate: (isHovered || isFocused) && !disableMotion ? 'hover' : 'start'
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- variants: firstFrame,
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 10 * ratio,
- justify: "center",
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- style: {
- fontFamily: headingFontFamily,
- fontSize: 65 * ratio,
- color: headingColor,
- fontWeight: headingFontWeight
- }
- }, "Aa"), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 4 * ratio
- }, highlightedColors.map(_ref3 => {
- let {
- slug,
- color
- } = _ref3;
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- key: slug,
- style: {
- height: normalizedColorSwatchSize * ratio,
- width: normalizedColorSwatchSize * ratio,
- background: color,
- borderRadius: normalizedColorSwatchSize * ratio / 2
- }
- });
- })))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- variants: secondFrame,
- style: {
- height: '100%',
- overflow: 'hidden'
- }
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3 * ratio,
- justify: "center",
- style: {
- height: '100%',
- overflow: 'hidden',
- padding: 10 * ratio,
- boxSizing: 'border-box'
- }
- }, label && (0,external_wp_element_namespaceObject.createElement)("div", {
- style: {
- fontSize: 35 * ratio,
- fontFamily: headingFontFamily,
- color: headingColor,
- fontWeight: headingFontWeight,
- lineHeight: '1em'
- }
- }, label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 2 * ratio,
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- style: {
- fontFamily,
- fontSize: 24 * ratio,
- color: textColor
- }
- }, "Aa"), (0,external_wp_element_namespaceObject.createElement)("div", {
- style: {
- fontFamily,
- fontSize: 24 * ratio,
- color: linkColor
- }
- }, "Aa")), paletteColors && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 0
- }, paletteColors.slice(0, 4).map((_ref4, index) => {
- let {
- color
- } = _ref4;
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- key: index,
- style: {
- height: 10 * ratio,
- width: 30 * ratio,
- background: color,
- flexGrow: 1
- }
- });
- }))))));
- };
- /* harmony default export */ var preview = (StylesPreview);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenRoot() {
- const {
- variations
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return {
- variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()
- };
- }, []);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
- size: "small"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 2
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardMedia, null, (0,external_wp_element_namespaceObject.createElement)(preview, null))), !!(variations !== null && variations !== void 0 && variations.length) && (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: "/variations"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Browse styles')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(context_menu, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardDivider, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, null, (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.')), (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: "/blocks"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "space-between"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
- }))))));
- }
- /* harmony default export */ var screen_root = (ScreenRoot);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenHeader(_ref) {
- let {
- title,
- description
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 2
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- spacing: 2
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(NavigationBackButton, {
- icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
- size: "small",
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 5
- }, title))), description && (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-global-styles-header__description"
- }, description));
- }
- /* harmony default export */ var header = (ScreenHeader);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function useSortedBlockTypes() {
- const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // Ensure core blocks are prioritized in the returned results,
- // because third party blocks can be registered earlier than
- // the core blocks (usually by using the `init` action),
- // thus affecting the display order.
- // We don't sort reusable blocks as they are handled differently.
- const groupByType = (blocks, block) => {
- const {
- core,
- noncore
- } = blocks;
- const type = block.name.startsWith('core/') ? core : noncore;
- type.push(block);
- return blocks;
- };
- const {
- core: coreItems,
- noncore: nonCoreItems
- } = blockItems.reduce(groupByType, {
- core: [],
- noncore: []
- });
- return [...coreItems, ...nonCoreItems];
- }
- function BlockMenuItem(_ref) {
- let {
- block
- } = _ref;
- const hasTypographyPanel = useHasTypographyPanel(block.name);
- const hasColorPanel = useHasColorPanel(block.name);
- const hasBorderPanel = useHasBorderPanel(block.name);
- const hasDimensionsPanel = useHasDimensionsPanel(block.name);
- const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
- const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel;
- if (!hasBlockMenuItem) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: '/blocks/' + block.name
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
- icon: block.icon
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title)));
- }
- function ScreenBlockList() {
- const sortedBlockTypes = useSortedBlockTypes();
- const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
- const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
- const isMatchingSearchTerm = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm, []);
- const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!filterValue) {
- return sortedBlockTypes;
- }
- return sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue));
- }, [filterValue, sortedBlockTypes, isMatchingSearchTerm]);
- const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); // Announce search results on change
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!filterValue) {
- return;
- } // We extract the results from the wrapper div's `ref` because
- // filtered items can contain items that will eventually not
- // render and there is no reliable way to detect when a child
- // will return `null`.
- // TODO: We should find a better way of handling this as it's
- // fragile and depends on the number of rendered elements of `BlockMenuItem`,
- // which is now one.
- // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116
- const count = blockTypesListRef.current.childElementCount;
- const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: %d: number of results. */
- (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
- debouncedSpeak(resultsFoundMessage, count);
- }, [filterValue, debouncedSpeak]);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
- description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
- className: "edit-site-block-types-search",
- onChange: setFilterValue,
- value: filterValue,
- label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'),
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
- ref: blockTypesListRef,
- className: "edit-site-block-types-item-list"
- }, filteredBlockTypes.map(block => (0,external_wp_element_namespaceObject.createElement)(BlockMenuItem, {
- block: block,
- key: 'menu-itemblock-' + block.name
- }))));
- }
- /* harmony default export */ var screen_block_list = (ScreenBlockList);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenBlock(_ref) {
- let {
- name
- } = _ref;
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: blockType.title
- }), (0,external_wp_element_namespaceObject.createElement)(context_menu, {
- parentMenu: '/blocks/' + name,
- name: name
- }));
- }
- /* harmony default export */ var screen_block = (ScreenBlock);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js
- /**
- * WordPress dependencies
- */
- function Subtitle(_ref) {
- let {
- children
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- className: "edit-site-global-styles-subtitle",
- level: 2
- }, children);
- }
- /* harmony default export */ var subtitle = (Subtitle);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function Item(_ref) {
- let {
- name,
- parentMenu,
- element,
- label
- } = _ref;
- const hasSupport = !name;
- const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
- const extraStyles = element === 'link' ? {
- textDecoration: 'underline'
- } : {};
- const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name);
- const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name);
- const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name);
- const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
- const [backgroundColor] = useStyle(prefix + 'color.background', name);
- const [gradientValue] = useStyle(prefix + 'color.gradient', name);
- const [color] = useStyle(prefix + 'color.text', name);
- if (!hasSupport) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: parentMenu + '/typography/' + element
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-global-styles-screen-typography__indicator",
- style: {
- fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
- background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
- color,
- fontStyle,
- fontWeight,
- letterSpacing,
- ...extraStyles
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, label)));
- }
- function ScreenTypography(_ref2) {
- let {
- name
- } = _ref2;
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Typography'),
- description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.')
- }), !name && (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-global-styles-screen-typography"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, (0,external_wp_element_namespaceObject.createElement)(Item, {
- name: name,
- parentMenu: parentMenu,
- element: "text",
- label: (0,external_wp_i18n_namespaceObject.__)('Text')
- }), (0,external_wp_element_namespaceObject.createElement)(Item, {
- name: name,
- parentMenu: parentMenu,
- element: "link",
- label: (0,external_wp_i18n_namespaceObject.__)('Links')
- })))), !!name && (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, {
- name: name,
- element: "text"
- }));
- }
- /* harmony default export */ var screen_typography = (ScreenTypography);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const screen_typography_element_elements = {
- text: {
- description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'),
- title: (0,external_wp_i18n_namespaceObject.__)('Text')
- },
- link: {
- description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'),
- title: (0,external_wp_i18n_namespaceObject.__)('Links')
- }
- };
- function ScreenTypographyElement(_ref) {
- let {
- name,
- element
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: screen_typography_element_elements[element].title,
- description: screen_typography_element_elements[element].description
- }), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, {
- name: name,
- element: element
- }));
- }
- /* harmony default export */ var screen_typography_element = (ScreenTypographyElement);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function ColorIndicatorWrapper(_ref) {
- let {
- className,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, extends_extends({
- className: classnames_default()('edit-site-global-styles__color-indicator-wrapper', className)
- }, props));
- }
- /* harmony default export */ var color_indicator_wrapper = (ColorIndicatorWrapper);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const EMPTY_COLORS = [];
- function Palette(_ref) {
- let {
- name
- } = _ref;
- const [customColors] = useSetting('color.palette.custom');
- const [themeColors] = useSetting('color.palette.theme');
- const [defaultColors] = useSetting('color.palette.default');
- const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name);
- const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]);
- const screenPath = !name ? '/colors/palette' : '/blocks/' + name + '/colors/palette';
- const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of palette colors.
- (0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors');
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Palette')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: screenPath
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- direction: colors.length === 0 ? 'row-reverse' : 'row'
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
- isLayered: false,
- offset: -8
- }, colors.slice(0, 5).map(_ref2 => {
- let {
- color
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
- key: color
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
- colorValue: color
- }));
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText)))));
- }
- /* harmony default export */ var palette = (Palette);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function BackgroundColorItem(_ref) {
- let {
- name,
- parentMenu
- } = _ref;
- const supports = getSupportedGlobalStylesPanels(name);
- const hasSupport = supports.includes('backgroundColor') || supports.includes('background');
- const [backgroundColor] = useStyle('color.background', name);
- const [gradientValue] = useStyle('color.gradient', name);
- if (!hasSupport) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: parentMenu + '/colors/background'
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
- expanded: false
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
- colorValue: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Background'))));
- }
- function TextColorItem(_ref2) {
- let {
- name,
- parentMenu
- } = _ref2;
- const supports = getSupportedGlobalStylesPanels(name);
- const hasSupport = supports.includes('color');
- const [color] = useStyle('color.text', name);
- if (!hasSupport) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: parentMenu + '/colors/text'
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
- expanded: false
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
- colorValue: color
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Text'))));
- }
- function LinkColorItem(_ref3) {
- let {
- name,
- parentMenu
- } = _ref3;
- const supports = getSupportedGlobalStylesPanels(name);
- const hasSupport = supports.includes('linkColor');
- const [color] = useStyle('elements.link.color.text', name);
- if (!hasSupport) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
- path: parentMenu + '/colors/link'
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "flex-start"
- }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
- expanded: false
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
- colorValue: color
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Links'))));
- }
- function ScreenColors(_ref4) {
- let {
- name
- } = _ref4;
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Colors'),
- description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.')
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-global-styles-screen-colors"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 10
- }, (0,external_wp_element_namespaceObject.createElement)(palette, {
- name: name
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: 3
- }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
- isBordered: true,
- isSeparated: true
- }, (0,external_wp_element_namespaceObject.createElement)(BackgroundColorItem, {
- name: name,
- parentMenu: parentMenu
- }), (0,external_wp_element_namespaceObject.createElement)(TextColorItem, {
- name: name,
- parentMenu: parentMenu
- }), (0,external_wp_element_namespaceObject.createElement)(LinkColorItem, {
- name: name,
- parentMenu: parentMenu
- }))))));
- }
- /* harmony default export */ var screen_colors = (ScreenColors);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ColorPalettePanel(_ref) {
- let {
- name
- } = _ref;
- const [themeColors, setThemeColors] = useSetting('color.palette.theme', name);
- const [baseThemeColors] = useSetting('color.palette.theme', name, 'base');
- const [defaultColors, setDefaultColors] = useSetting('color.palette.default', name);
- const [baseDefaultColors] = useSetting('color.palette.default', name, 'base');
- const [customColors, setCustomColors] = useSetting('color.palette.custom', name);
- const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-global-styles-color-palette-panel",
- spacing: 10
- }, !!themeColors && !!themeColors.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: themeColors !== baseThemeColors,
- canOnlyChangeValues: true,
- colors: themeColors,
- onChange: setThemeColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme')
- }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: defaultColors !== baseDefaultColors,
- canOnlyChangeValues: true,
- colors: defaultColors,
- onChange: setDefaultColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- colors: customColors,
- onChange: setCustomColors,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
- emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'),
- slugPrefix: "custom-"
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function GradientPalettePanel(_ref) {
- let {
- name
- } = _ref;
- const [themeGradients, setThemeGradients] = useSetting('color.gradients.theme', name);
- const [baseThemeGradients] = useSetting('color.gradients.theme', name, 'base');
- const [defaultGradients, setDefaultGradients] = useSetting('color.gradients.default', name);
- const [baseDefaultGradients] = useSetting('color.gradients.default', name, 'base');
- const [customGradients, setCustomGradients] = useSetting('color.gradients.custom', name);
- const [defaultPaletteEnabled] = useSetting('color.defaultGradients', name);
- const [duotonePalette] = useSetting('color.duotone') || [];
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- className: "edit-site-global-styles-gradient-palette-panel",
- spacing: 10
- }, !!themeGradients && !!themeGradients.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: themeGradients !== baseThemeGradients,
- canOnlyChangeValues: true,
- gradients: themeGradients,
- onChange: setThemeGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme')
- }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- canReset: defaultGradients !== baseDefaultGradients,
- canOnlyChangeValues: true,
- gradients: defaultGradients,
- onChange: setDefaultGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
- gradients: customGradients,
- onChange: setCustomGradients,
- paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
- emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'),
- slugPrefix: "custom-"
- }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Duotone')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
- margin: 3
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
- duotonePalette: duotonePalette,
- disableCustomDuotone: true,
- disableCustomColors: true,
- clearable: false,
- onChange: external_lodash_namespaceObject.noop
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenColorPalette(_ref) {
- let {
- name
- } = _ref;
- const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('solid');
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Palette'),
- description: (0,external_wp_i18n_namespaceObject.__)('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
- className: "edit-site-screen-color-palette-toggle",
- value: currentTab,
- onChange: setCurrentTab,
- label: (0,external_wp_i18n_namespaceObject.__)('Select palette type'),
- hideLabelFromVision: true,
- isBlock: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "solid",
- label: (0,external_wp_i18n_namespaceObject.__)('Solid')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
- value: "gradient",
- label: (0,external_wp_i18n_namespaceObject.__)('Gradient')
- })), currentTab === 'solid' && (0,external_wp_element_namespaceObject.createElement)(ColorPalettePanel, {
- name: name
- }), currentTab === 'gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientPalettePanel, {
- name: name
- }));
- }
- /* harmony default export */ var screen_color_palette = (ScreenColorPalette);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background-color.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenBackgroundColor(_ref) {
- let {
- name
- } = _ref;
- const supports = getSupportedGlobalStylesPanels(name);
- const [solids] = useSetting('color.palette', name);
- const [gradients] = useSetting('color.gradients', name);
- const [areCustomSolidsEnabled] = useSetting('color.custom', name);
- const [areCustomGradientsEnabled] = useSetting('color.customGradient', name);
- const colorsPerOrigin = useColorsPerOrigin(name);
- const gradientsPerOrigin = useGradientsPerOrigin(name);
- const [isBackgroundEnabled] = useSetting('color.background', name);
- const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
- const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
- const [backgroundColor, setBackgroundColor] = useStyle('color.background', name);
- const [userBackgroundColor] = useStyle('color.background', name, 'user');
- const [gradient, setGradient] = useStyle('color.gradient', name);
- const [userGradient] = useStyle('color.gradient', name, 'user');
- if (!hasBackgroundColor && !hasGradientColor) {
- return null;
- }
- let backgroundSettings = {};
- if (hasBackgroundColor) {
- backgroundSettings = {
- colorValue: backgroundColor,
- onColorChange: setBackgroundColor
- };
- if (backgroundColor) {
- backgroundSettings.clearable = backgroundColor === userBackgroundColor;
- }
- }
- let gradientSettings = {};
- if (hasGradientColor) {
- gradientSettings = {
- gradientValue: gradient,
- onGradientChange: setGradient
- };
- if (gradient) {
- gradientSettings.clearable = gradient === userGradient;
- }
- }
- const controlProps = { ...backgroundSettings,
- ...gradientSettings
- };
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Background'),
- description: (0,external_wp_i18n_namespaceObject.__)('Set a background color or gradient for the whole site.')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({
- className: "edit-site-screen-background-color__control",
- colors: colorsPerOrigin,
- gradients: gradientsPerOrigin,
- disableCustomColors: !areCustomSolidsEnabled,
- disableCustomGradients: !areCustomGradientsEnabled,
- __experimentalHasMultipleOrigins: true,
- showTitle: false,
- enableAlpha: true,
- __experimentalIsRenderedInSidebar: true
- }, controlProps)));
- }
- /* harmony default export */ var screen_background_color = (ScreenBackgroundColor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-text-color.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenTextColor(_ref) {
- let {
- name
- } = _ref;
- const supports = getSupportedGlobalStylesPanels(name);
- const [solids] = useSetting('color.palette', name);
- const [areCustomSolidsEnabled] = useSetting('color.custom', name);
- const [isTextEnabled] = useSetting('color.text', name);
- const colorsPerOrigin = useColorsPerOrigin(name);
- const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
- const [color, setColor] = useStyle('color.text', name);
- const [userColor] = useStyle('color.text', name, 'user');
- if (!hasTextColor) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Text'),
- description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for text across the site.')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
- className: "edit-site-screen-text-color__control",
- colors: colorsPerOrigin,
- disableCustomColors: !areCustomSolidsEnabled,
- __experimentalHasMultipleOrigins: true,
- showTitle: false,
- enableAlpha: true,
- __experimentalIsRenderedInSidebar: true,
- colorValue: color,
- onColorChange: setColor,
- clearable: color === userColor
- }));
- }
- /* harmony default export */ var screen_text_color = (ScreenTextColor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-link-color.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenLinkColor(_ref) {
- let {
- name
- } = _ref;
- const supports = getSupportedGlobalStylesPanels(name);
- const [solids] = useSetting('color.palette', name);
- const [areCustomSolidsEnabled] = useSetting('color.custom', name);
- const colorsPerOrigin = useColorsPerOrigin(name);
- const [isLinkEnabled] = useSetting('color.link', name);
- const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled);
- const [linkColor, setLinkColor] = useStyle('elements.link.color.text', name);
- const [userLinkColor] = useStyle('elements.link.color.text', name, 'user');
- if (!hasLinkColor) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Links'),
- description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for links across the site.')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
- className: "edit-site-screen-link-color__control",
- colors: colorsPerOrigin,
- disableCustomColors: !areCustomSolidsEnabled,
- __experimentalHasMultipleOrigins: true,
- showTitle: false,
- enableAlpha: true,
- __experimentalIsRenderedInSidebar: true,
- colorValue: linkColor,
- onColorChange: setLinkColor,
- clearable: linkColor === userLinkColor
- }));
- }
- /* harmony default export */ var screen_link_color = (ScreenLinkColor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ScreenLayout(_ref) {
- let {
- name
- } = _ref;
- const hasBorderPanel = useHasBorderPanel(name);
- const hasDimensionsPanel = useHasDimensionsPanel(name);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- title: (0,external_wp_i18n_namespaceObject.__)('Layout')
- }), hasDimensionsPanel && (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, {
- name: name
- }), hasBorderPanel && (0,external_wp_element_namespaceObject.createElement)(BorderPanel, {
- name: name
- }));
- }
- /* harmony default export */ var screen_layout = (ScreenLayout);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/global-styles-provider.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function mergeTreesCustomizer(_, srcValue) {
- // We only pass as arrays the presets,
- // in which case we want the new array of values
- // to override the old array (no merging).
- if (Array.isArray(srcValue)) {
- return srcValue;
- }
- }
- function mergeBaseAndUserConfigs(base, user) {
- return (0,external_lodash_namespaceObject.mergeWith)({}, base, user, mergeTreesCustomizer);
- }
- const cleanEmptyObject = object => {
- if (!(0,external_lodash_namespaceObject.isObject)(object) || Array.isArray(object)) {
- return object;
- }
- const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), external_lodash_namespaceObject.identity);
- return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
- };
- function useGlobalStylesUserConfig() {
- const {
- globalStylesId,
- settings,
- styles
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId();
- const record = _globalStylesId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
- return {
- globalStylesId: _globalStylesId,
- settings: record === null || record === void 0 ? void 0 : record.settings,
- styles: record === null || record === void 0 ? void 0 : record.styles
- };
- }, []);
- const {
- getEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
- const {
- editEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return {
- settings: settings !== null && settings !== void 0 ? settings : {},
- styles: styles !== null && styles !== void 0 ? styles : {}
- };
- }, [settings, styles]);
- const setConfig = (0,external_wp_element_namespaceObject.useCallback)(callback => {
- var _record$styles, _record$settings;
- const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
- const currentConfig = {
- styles: (_record$styles = record === null || record === void 0 ? void 0 : record.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
- settings: (_record$settings = record === null || record === void 0 ? void 0 : record.settings) !== null && _record$settings !== void 0 ? _record$settings : {}
- };
- const updatedConfig = callback(currentConfig);
- editEntityRecord('root', 'globalStyles', globalStylesId, {
- styles: cleanEmptyObject(updatedConfig.styles) || {},
- settings: cleanEmptyObject(updatedConfig.settings) || {}
- });
- }, [globalStylesId]);
- return [!!settings || !!styles, config, setConfig];
- }
- function useGlobalStylesBaseConfig() {
- const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles();
- }, []);
- return [!!baseConfig, baseConfig];
- }
- function useGlobalStylesContext() {
- const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
- const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
- const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!baseConfig || !userConfig) {
- return {};
- }
- return mergeBaseAndUserConfigs(baseConfig, userConfig);
- }, [userConfig, baseConfig]);
- const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return {
- isReady: isUserConfigReady && isBaseConfigReady,
- user: userConfig,
- base: baseConfig,
- merged: mergedConfig,
- setUserConfig
- };
- }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
- return context;
- }
- function GlobalStylesProvider(_ref) {
- let {
- children
- } = _ref;
- const context = useGlobalStylesContext();
- if (!context.isReady) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, {
- value: context
- }, children);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function compareVariations(a, b) {
- return (0,external_lodash_namespaceObject.isEqual)(a.styles, b.styles) && (0,external_lodash_namespaceObject.isEqual)(a.settings, b.settings);
- }
- function Variation(_ref) {
- let {
- variation
- } = _ref;
- const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- base,
- user,
- setUserConfig
- } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
- const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
- var _variation$settings, _variation$styles;
- return {
- user: {
- settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
- styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
- },
- base,
- merged: mergeBaseAndUserConfigs(base, variation),
- setUserConfig: () => {}
- };
- }, [variation, base]);
- const selectVariation = () => {
- setUserConfig(() => {
- return {
- settings: variation.settings,
- styles: variation.styles
- };
- });
- };
- const selectOnEnter = event => {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
- event.preventDefault();
- selectVariation();
- }
- };
- const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return compareVariations(user, variation);
- }, [user, variation]);
- return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, {
- value: context
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()('edit-site-global-styles-variations_item', {
- 'is-active': isActive
- }),
- role: "button",
- onClick: selectVariation,
- onKeyDown: selectOnEnter,
- tabIndex: "0",
- "aria-label": variation === null || variation === void 0 ? void 0 : variation.title,
- onFocus: () => setIsFocused(true),
- onBlur: () => setIsFocused(false)
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-global-styles-variations_item-preview"
- }, (0,external_wp_element_namespaceObject.createElement)(preview, {
- label: variation === null || variation === void 0 ? void 0 : variation.title,
- isFocused: isFocused
- }))));
- }
- function ScreenStyleVariations() {
- const {
- variations
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return {
- variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()
- };
- }, []);
- const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => {
- return [{
- title: (0,external_wp_i18n_namespaceObject.__)('Default'),
- settings: {},
- styles: {}
- }, ...variations];
- }, [variations]);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
- back: "/",
- title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'),
- description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles')
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
- size: "small",
- isBorderless: true
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
- columns: 2
- }, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0,external_wp_element_namespaceObject.createElement)(Variation, {
- key: index,
- variation: variation
- }))))));
- }
- /* harmony default export */ var screen_style_variations = (ScreenStyleVariations);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function GlobalStylesNavigationScreen(_ref) {
- let {
- className,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, extends_extends({
- className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ')
- }, props));
- }
- function ContextScreens(_ref2) {
- let {
- name
- } = _ref2;
- const parentMenu = name === undefined ? '' : '/blocks/' + name;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/typography'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_typography, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/typography/text'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
- name: name,
- element: "text"
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/typography/link'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
- name: name,
- element: "link"
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_colors, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors/palette'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_color_palette, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors/background'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_background_color, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors/text'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_text_color, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/colors/link'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_link_color, {
- name: name
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: parentMenu + '/layout'
- }, (0,external_wp_element_namespaceObject.createElement)(screen_layout, {
- name: name
- })));
- }
- function GlobalStylesUI() {
- const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)();
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
- className: "edit-site-global-styles-sidebar__navigator-provider",
- initialPath: "/"
- }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: "/"
- }, (0,external_wp_element_namespaceObject.createElement)(screen_root, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: "/variations"
- }, (0,external_wp_element_namespaceObject.createElement)(screen_style_variations, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- path: "/blocks"
- }, (0,external_wp_element_namespaceObject.createElement)(screen_block_list, null)), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
- key: 'menu-block-' + block.name,
- path: '/blocks/' + block.name
- }, (0,external_wp_element_namespaceObject.createElement)(screen_block, {
- name: block.name
- }))), (0,external_wp_element_namespaceObject.createElement)(ContextScreens, null), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(ContextScreens, {
- key: 'screens-block-' + block.name,
- name: block.name
- })));
- }
- /* harmony default export */ var ui = (GlobalStylesUI);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/global-styles-sidebar.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function GlobalStylesSidebar() {
- const [canReset, onReset] = useGlobalStylesReset();
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- return (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, {
- className: "edit-site-global-styles-sidebar",
- identifier: "edit-site/global-styles",
- title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
- icon: library_styles,
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'),
- panelClassName: "edit-site-global-styles-sidebar__panel",
- header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_wp_element_namespaceObject.createElement)("span", {
- className: "edit-site-global-styles-sidebar__beta"
- }, (0,external_wp_i18n_namespaceObject.__)('Beta'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'),
- controls: [{
- title: (0,external_wp_i18n_namespaceObject.__)('Reset to defaults'),
- onClick: onReset,
- isDisabled: !canReset
- }, {
- title: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'),
- onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
- }]
- })))
- }, (0,external_wp_element_namespaceObject.createElement)(ui, null));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js
- /**
- * WordPress dependencies
- */
- const ALLOWED_BLOCKS = {
- 'core/navigation': ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'],
- 'core/social-links': ['core/social-link'],
- 'core/navigation-submenu': ['core/navigation-link', 'core/navigation-submenu'],
- 'core/navigation-link': ['core/navigation-link', 'core/navigation-submenu']
- };
- function navigation_menu_NavigationMenu(_ref) {
- let {
- innerBlocks,
- id
- } = _ref;
- const {
- updateBlockListSettings
- } = useDispatch(blockEditorStore); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
- //Think through a better way of doing this, possible with adding allowed blocks to block library metadata
- useEffect(() => {
- updateBlockListSettings('', {
- allowedBlocks: ALLOWED_BLOCKS['core/navigation']
- });
- innerBlocks.forEach(block => {
- if (ALLOWED_BLOCKS[block.name]) {
- updateBlockListSettings(block.clientId, {
- allowedBlocks: ALLOWED_BLOCKS[block.name]
- });
- }
- });
- }, [updateBlockListSettings, innerBlocks]);
- return createElement(Fragment, null, createElement(ListView, {
- id: id,
- showNestedBlocks: true,
- expandNested: false,
- __experimentalFeatures: true,
- __experimentalPersistentListViewFeatures: true
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const NAVIGATION_MENUS_QUERY = [{
- per_page: -1,
- status: 'publish'
- }];
- function navigation_inspector_NavigationInspector() {
- var _navigationMenus$;
- const {
- selectedNavigationBlockId,
- clientIdToRef,
- navigationMenus,
- isResolvingNavigationMenus,
- hasResolvedNavigationMenus,
- firstNavigationBlockId
- } = useSelect(select => {
- const {
- __experimentalGetActiveBlockIdByBlockNames,
- __experimentalGetGlobalBlocksByName,
- getBlock
- } = select(blockEditorStore);
- const {
- getEntityRecords,
- hasFinishedResolution,
- isResolving
- } = select(coreStore);
- const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY[0]]; // Get the active Navigation block (if present).
- const selectedNavId = __experimentalGetActiveBlockIdByBlockNames('core/navigation'); // Get all Navigation blocks currently within the editor canvas.
- const navBlockIds = __experimentalGetGlobalBlocksByName('core/navigation');
- const idToRef = {};
- navBlockIds.forEach(id => {
- var _getBlock, _getBlock$attributes;
- idToRef[id] = (_getBlock = getBlock(id)) === null || _getBlock === void 0 ? void 0 : (_getBlock$attributes = _getBlock.attributes) === null || _getBlock$attributes === void 0 ? void 0 : _getBlock$attributes.ref;
- });
- return {
- selectedNavigationBlockId: selectedNavId,
- firstNavigationBlockId: navBlockIds === null || navBlockIds === void 0 ? void 0 : navBlockIds[0],
- clientIdToRef: idToRef,
- navigationMenus: getEntityRecords(...navigationMenusQuery),
- isResolvingNavigationMenus: isResolving('getEntityRecords', navigationMenusQuery),
- hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
- };
- }, []);
- const navMenuListId = useInstanceId(NavigationMenu, 'edit-site-navigation-inspector-menu');
- const firstNavRefInTemplate = clientIdToRef[firstNavigationBlockId];
- const firstNavigationMenuRef = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id; // Default Navigation Menu is either:
- // - the Navigation Menu referenced by the first Nav block within the template.
- // - the first of the available Navigation Menus (`wp_navigation`) posts.
- const defaultNavigationMenuId = firstNavRefInTemplate || firstNavigationMenuRef; // The Navigation Menu manually selected by the user within the Nav inspector.
- const [currentMenuId, setCurrentMenuId] = useState(firstNavRefInTemplate); // If a Nav block is selected within the canvas then set the
- // Navigation Menu referenced by it's `ref` attribute to be
- // active within the Navigation sidebar.
- useEffect(() => {
- if (selectedNavigationBlockId) {
- setCurrentMenuId(clientIdToRef[selectedNavigationBlockId]);
- }
- }, [selectedNavigationBlockId]);
- let options = [];
- if (navigationMenus) {
- options = navigationMenus.map(_ref => {
- let {
- id,
- title
- } = _ref;
- return {
- value: id,
- label: title.rendered
- };
- });
- }
- const [innerBlocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_navigation', {
- id: currentMenuId || defaultNavigationMenuId
- });
- const {
- isLoadingInnerBlocks,
- hasLoadedInnerBlocks
- } = useSelect(select => {
- const {
- isResolving,
- hasFinishedResolution
- } = select(coreStore);
- return {
- isLoadingInnerBlocks: isResolving('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]),
- hasLoadedInnerBlocks: hasFinishedResolution('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId])
- };
- }, [currentMenuId, defaultNavigationMenuId]);
- const isLoading = !(hasResolvedNavigationMenus && hasLoadedInnerBlocks);
- const hasMoreThanOneNavigationMenu = (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 1;
- const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length); // Entity block editor will return entities that are not currently published.
- // Guard by only allowing their usage if there are published Nav Menus.
- const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : [];
- const hasInnerBlocks = !!(publishedInnerBlocks !== null && publishedInnerBlocks !== void 0 && publishedInnerBlocks.length);
- useEffect(() => {
- if (isResolvingNavigationMenus) {
- speak('Loading Navigation sidebar menus.');
- }
- if (hasResolvedNavigationMenus) {
- speak('Navigation sidebar menus have loaded.');
- }
- }, [isResolvingNavigationMenus, hasResolvedNavigationMenus]);
- useEffect(() => {
- if (isLoadingInnerBlocks) {
- speak('Loading Navigation sidebar selected menu items.');
- }
- if (hasLoadedInnerBlocks) {
- speak('Navigation sidebar selected menu items have loaded.');
- }
- }, [isLoadingInnerBlocks, hasLoadedInnerBlocks]);
- return createElement("div", {
- className: "edit-site-navigation-inspector"
- }, hasResolvedNavigationMenus && !hasNavigationMenus && createElement("p", {
- className: "edit-site-navigation-inspector__empty-msg"
- }, __('There are no Navigation Menus.')), !hasResolvedNavigationMenus && createElement("div", {
- className: "edit-site-navigation-inspector__placeholder"
- }), hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && createElement(SelectControl, {
- "aria-controls": // aria-controls should only apply when referenced element is in DOM
- hasLoadedInnerBlocks ? navMenuListId : undefined,
- value: currentMenuId || defaultNavigationMenuId,
- options: options,
- onChange: newMenuId => setCurrentMenuId(Number(newMenuId))
- }), isLoading && createElement(Fragment, null, createElement("div", {
- className: "edit-site-navigation-inspector__placeholder is-child"
- }), createElement("div", {
- className: "edit-site-navigation-inspector__placeholder is-child"
- }), createElement("div", {
- className: "edit-site-navigation-inspector__placeholder is-child"
- })), hasInnerBlocks && !isLoading && createElement(BlockEditorProvider, {
- value: publishedInnerBlocks,
- onChange: onChange,
- onInput: onInput
- }, createElement(NavigationMenu, {
- id: navMenuListId,
- innerBlocks: publishedInnerBlocks
- })), !hasInnerBlocks && !isLoading && createElement("p", {
- className: "edit-site-navigation-inspector__empty-msg"
- }, __('Navigation Menu is empty.')));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function NavigationMenuSidebar() {
- return createElement(DefaultSidebar, {
- className: "edit-site-navigation-menu-sidebar",
- identifier: "edit-site/navigation-menu",
- title: __('Navigation Menus'),
- icon: navigation,
- closeLabel: __('Close navigation menu sidebar'),
- panelClassName: "edit-site-navigation-menu-sidebar__panel",
- header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus'))))
- }, createElement(NavigationInspector, null));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/constants.js
- const SIDEBAR_TEMPLATE = 'edit-site/template';
- const SIDEBAR_BLOCK = 'edit-site/block-inspector';
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/settings-header/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const SettingsHeader = _ref => {
- let {
- sidebarName
- } = _ref;
- const {
- enableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE);
- const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
- const [templateAriaLabel, templateActiveClass] = sidebarName === SIDEBAR_TEMPLATE ? // translators: ARIA label for the Template sidebar tab, selected.
- [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : // translators: ARIA label for the Template Settings Sidebar tab, not selected.
- [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
- const [blockAriaLabel, blockActiveClass] = sidebarName === SIDEBAR_BLOCK ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
- [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
- [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
- /* Use a list so screen readers will announce how many tabs there are. */
- return (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: openTemplateSettings,
- className: `edit-site-sidebar__panel-tab ${templateActiveClass}`,
- "aria-label": templateAriaLabel // translators: Data label for the Template Settings Sidebar tab.
- ,
- "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
- }, // translators: Text label for the Template Settings Sidebar tab.
- (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- onClick: openBlockSettings,
- className: `edit-site-sidebar__panel-tab ${blockActiveClass}`,
- "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
- ,
- "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
- }, // translators: Text label for the Block Settings Sidebar tab.
- (0,external_wp_i18n_namespaceObject.__)('Block'))));
- };
- /* harmony default export */ var settings_header = (SettingsHeader);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/template-areas.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TemplateAreaItem(_ref) {
- let {
- area,
- clientId
- } = _ref;
- const {
- selectBlock,
- toggleBlockHighlight
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
- return defaultAreas.find(defaultArea => defaultArea.area === area);
- }, [area]);
- const highlightBlock = () => toggleBlockHighlight(clientId, true);
- const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-template-card__template-areas-item",
- icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
- onMouseOver: highlightBlock,
- onMouseLeave: cancelHighlightBlock,
- onFocus: highlightBlock,
- onBlur: cancelHighlightBlock,
- onClick: () => {
- selectBlock(clientId);
- }
- }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label);
- }
- function template_areas_TemplateAreas() {
- const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []);
- if (!templateParts.length) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)("section", {
- className: "edit-site-template-card__template-areas"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 3,
- className: "edit-site-template-card__template-areas-title"
- }, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_wp_element_namespaceObject.createElement)("ul", {
- className: "edit-site-template-card__template-areas-list"
- }, templateParts.map(_ref2 => {
- let {
- templatePart,
- block
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)("li", {
- key: templatePart.slug
- }, (0,external_wp_element_namespaceObject.createElement)(TemplateAreaItem, {
- area: templatePart.area,
- clientId: block.clientId
- }));
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TemplateCard() {
- const {
- title,
- description,
- icon
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType,
- getEditedPostId
- } = select(store_store);
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- __experimentalGetTemplateInfo: getTemplateInfo
- } = select(external_wp_editor_namespaceObject.store);
- const postType = getEditedPostType();
- const postId = getEditedPostId();
- const record = getEntityRecord('postType', postType, postId);
- const info = record ? getTemplateInfo(record) : {};
- return info;
- }, []);
- if (!title && !description) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-template-card"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- className: "edit-site-template-card__icon",
- icon: icon
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-template-card__content"
- }, (0,external_wp_element_namespaceObject.createElement)("h2", {
- className: "edit-site-template-card__title"
- }, title), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-template-card__description"
- }, description), (0,external_wp_element_namespaceObject.createElement)(template_areas_TemplateAreas, null)));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const {
- Slot: InspectorSlot,
- Fill: InspectorFill
- } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector');
- const SidebarInspectorFill = InspectorFill;
- function SidebarComplementaryAreaFills() {
- const {
- sidebar,
- isEditorSidebarOpened,
- hasBlockSelection
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const _sidebar = select(store).getActiveComplementaryArea(STORE_NAME);
- const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar);
- return {
- sidebar: _sidebar,
- isEditorSidebarOpened: _isEditorSidebarOpened,
- hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()
- };
- }, []);
- const {
- enableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!isEditorSidebarOpened) return;
- if (hasBlockSelection) {
- enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
- } else {
- enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE);
- }
- }, [hasBlockSelection, isEditorSidebarOpened]);
- let sidebarName = sidebar;
- if (!isEditorSidebarOpened) {
- sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;
- } // Conditionally include NavMenu sidebar in Plugin only.
- // Optimise for dead code elimination.
- // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
- let MaybeNavigationMenuSidebar = external_wp_element_namespaceObject.Fragment;
- if (false) {}
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, {
- identifier: sidebarName,
- title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
- icon: library_cog,
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings sidebar'),
- header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
- sidebarName: sidebarName
- }),
- headerClassName: "edit-site-sidebar__panel-tabs"
- }, sidebarName === SIDEBAR_TEMPLATE && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && (0,external_wp_element_namespaceObject.createElement)(InspectorSlot, {
- bubblesVirtually: true
- })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesSidebar, null), (0,external_wp_element_namespaceObject.createElement)(MaybeNavigationMenuSidebar, null));
- }
- ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
- var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
- /**
- * WordPress dependencies
- */
- const home = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
- }));
- /* harmony default export */ var library_home = (home);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
- /**
- * WordPress dependencies
- */
- const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.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-17.6 1L10 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"
- }));
- /* harmony default export */ var symbol_filled = (symbolFilled);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/main-dashboard-button/index.js
- /**
- * WordPress dependencies
- */
- const slotName = '__experimentalMainDashboardButton';
- const {
- Fill,
- Slot: MainDashboardButtonSlot
- } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
- const MainDashboardButton = Fill;
- const main_dashboard_button_Slot = _ref => {
- let {
- children
- } = _ref;
- const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
- const hasFills = Boolean(slot.fills && slot.fills.length);
- if (!hasFills) {
- return children;
- }
- return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
- bubblesVirtually: true
- });
- };
- MainDashboardButton.Slot = main_dashboard_button_Slot;
- /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const SITE_EDITOR_KEY = 'site-editor';
- function NavLink(_ref) {
- let {
- params,
- replace,
- ...props
- } = _ref;
- const linkProps = useLink(params, replace);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationItem, extends_extends({}, linkProps, props));
- }
- const NavigationPanel = _ref2 => {
- let {
- activeItem = SITE_EDITOR_KEY
- } = _ref2;
- const {
- homeTemplate,
- isNavigationOpen,
- siteTitle
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const {
- getSettings,
- isNavigationOpened
- } = select(store_store);
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
- return {
- siteTitle: siteData.name,
- homeTemplate: getSettings().__unstableHomeTemplate,
- isNavigationOpen: isNavigationOpened()
- };
- }, []);
- const {
- setIsNavigationPanelOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const closeOnEscape = event => {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
- event.preventDefault();
- setIsNavigationPanelOpened(false);
- }
- };
- return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
- (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()(`edit-site-navigation-panel`, {
- 'is-open': isNavigationOpen
- }),
- onKeyDown: closeOnEscape
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-navigation-panel__inner"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-navigation-panel__site-title-container"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-navigation-panel__site-title"
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-navigation-panel__scroll-container"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigation, {
- activeItem: activeItem
- }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationBackButton, {
- backButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Dashboard'),
- className: "edit-site-navigation-panel__back-to-dashboard",
- href: "index.php"
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationMenu, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationGroup, {
- title: (0,external_wp_i18n_namespaceObject.__)('Editor')
- }, (0,external_wp_element_namespaceObject.createElement)(NavLink, {
- icon: library_home,
- title: (0,external_wp_i18n_namespaceObject.__)('Site'),
- item: SITE_EDITOR_KEY,
- params: {
- postId: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postId,
- postType: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postType
- }
- }), (0,external_wp_element_namespaceObject.createElement)(NavLink, {
- icon: library_layout,
- title: (0,external_wp_i18n_namespaceObject.__)('Templates'),
- item: "wp_template",
- params: {
- postId: undefined,
- postType: 'wp_template'
- }
- }), (0,external_wp_element_namespaceObject.createElement)(NavLink, {
- icon: symbol_filled,
- title: (0,external_wp_i18n_namespaceObject.__)('Template Parts'),
- item: "wp_template_part",
- params: {
- postId: undefined,
- postType: 'wp_template_part'
- }
- })))))))
- );
- };
- /* harmony default export */ var navigation_panel = (NavigationPanel);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
- /**
- * WordPress dependencies
- */
- const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "-2 -2 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
- }));
- /* harmony default export */ var library_wordpress = (wordpress);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-toggle/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function NavigationToggle(_ref) {
- let {
- icon
- } = _ref;
- const {
- isNavigationOpen,
- isRequestingSiteIcon,
- siteIconUrl
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEntityRecord,
- isResolving
- } = select(external_wp_coreData_namespaceObject.store);
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
- return {
- isNavigationOpen: select(store_store).isNavigationOpened(),
- isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
- siteIconUrl: siteData.site_icon_url
- };
- }, []);
- const {
- setIsNavigationPanelOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
- const navigationToggleRef = (0,external_wp_element_namespaceObject.useRef)();
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // TODO: Remove this effect when alternative solution is merged.
- // See: https://github.com/WordPress/gutenberg/pull/37314
- if (!isNavigationOpen) {
- navigationToggleRef.current.focus();
- }
- }, [isNavigationOpen]);
- const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen);
- let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- size: "36px",
- icon: library_wordpress
- });
- const effect = {
- expand: {
- scale: 1.25,
- transition: {
- type: 'tween',
- duration: '0.3'
- }
- }
- };
- if (siteIconUrl) {
- buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
- variants: !disableMotion && effect,
- alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
- className: "edit-site-navigation-toggle__site-icon",
- src: siteIconUrl
- });
- } else if (isRequestingSiteIcon) {
- buttonIcon = null;
- } else if (icon) {
- buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- size: "36px",
- icon: icon
- });
- }
- const classes = classnames_default()({
- 'edit-site-navigation-toggle__button': true,
- 'has-icon': siteIconUrl
- });
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
- className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''),
- whileHover: "expand"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: classes,
- label: (0,external_wp_i18n_namespaceObject.__)('Toggle navigation'),
- ref: navigationToggleRef // isPressed will add unwanted styles.
- ,
- "aria-pressed": isNavigationOpen,
- onClick: toggleNavigationPanel,
- showTooltip: true
- }, buttonIcon));
- }
- /* harmony default export */ var navigation_toggle = (NavigationToggle);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const {
- Fill: NavigationPanelPreviewFill,
- Slot: NavigationPanelPreviewSlot
- } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationPanelPreview');
- const {
- Fill: NavigationSidebarFill,
- Slot: NavigationSidebarSlot
- } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationSidebar');
- function NavigationSidebar(_ref) {
- let {
- isDefaultOpen = false,
- activeTemplateType
- } = _ref;
- const isDesktopViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
- const {
- setIsNavigationPanelOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- (0,external_wp_element_namespaceObject.useEffect)(function autoOpenNavigationPanelOnViewportChange() {
- setIsNavigationPanelOpened(isDefaultOpen && isDesktopViewport);
- }, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]);
- return (0,external_wp_element_namespaceObject.createElement)(NavigationSidebarFill, null, (0,external_wp_element_namespaceObject.createElement)(navigation_toggle, null), (0,external_wp_element_namespaceObject.createElement)(navigation_panel, {
- activeItem: activeTemplateType
- }), (0,external_wp_element_namespaceObject.createElement)(NavigationPanelPreviewSlot, null));
- }
- NavigationSidebar.Slot = NavigationSidebarSlot;
- /* harmony default export */ var navigation_sidebar = (NavigationSidebar);
- ;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
- var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js
- /**
- * WordPress dependencies
- */
- function ConvertToRegularBlocks(_ref) {
- let {
- clientId
- } = _ref;
- const {
- getBlocks
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
- const {
- replaceBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]);
- if (!canRemove) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
- let {
- onClose
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- replaceBlocks(clientId, getBlocks(clientId));
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Detach blocks from template part'));
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/create-template-part-modal/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function CreateTemplatePartModal(_ref) {
- let {
- closeModal,
- onCreate
- } = _ref;
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
- const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(TEMPLATE_PART_AREA_GENERAL);
- const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
- const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Create a template part'),
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
- onRequestClose: closeModal,
- overlayClassName: "edit-site-create-template-part-modal"
- }, (0,external_wp_element_namespaceObject.createElement)("form", {
- onSubmit: async event => {
- event.preventDefault();
- if (!title) {
- return;
- }
- setIsSubmitting(true);
- await onCreate({
- title,
- area
- });
- }
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- required: true
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Area'),
- id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
- className: "edit-site-create-template-part-modal__area-base-control"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Area'),
- className: "edit-site-create-template-part-modal__area-radio-group",
- id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
- onChange: setArea,
- checked: area
- }, templatePartAreas.map(_ref2 => {
- let {
- icon,
- label,
- area: value,
- description
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadio, {
- key: label,
- value: value,
- className: "edit-site-create-template-part-modal__area-radio"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
- align: "start",
- justify: "start"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: icon
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, {
- className: "edit-site-create-template-part-modal__option-label"
- }, label, (0,external_wp_element_namespaceObject.createElement)("div", null, description)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
- className: "edit-site-create-template-part-modal__checkbox"
- }, area === value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: library_check
- }))));
- }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "edit-site-create-template-part-modal__modal-actions",
- justify: "flex-end"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- onClick: () => {
- closeModal();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit",
- disabled: !title,
- isBusy: isSubmitting
- }, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ConvertToTemplatePart(_ref) {
- let {
- clientIds,
- blocks
- } = _ref;
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- replaceBlocks
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const onConvert = async _ref2 => {
- let {
- title,
- area
- } = _ref2;
- // Currently template parts only allow latin chars.
- // Fallback slug will receive suffix by default.
- const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
- const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
- slug: cleanSlug,
- title,
- content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
- area
- });
- replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', {
- slug: templatePart.slug,
- theme: templatePart.theme
- }));
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), {
- type: 'snackbar'
- }); // The modal and this component will be unmounted because of `replaceBlocks` above,
- // so no need to call `closeModal` or `onClose`.
- };
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- setIsModalOpen(true);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Make template part'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, {
- closeModal: () => {
- setIsModalOpen(false);
- },
- onCreate: onConvert
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TemplatePartConverter() {
- var _blocks$;
- const {
- clientIds,
- blocks
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSelectedBlockClientIds,
- getBlocksByClientId
- } = select(external_wp_blockEditor_namespaceObject.store);
- const selectedBlockClientIds = getSelectedBlockClientIds();
- return {
- clientIds: selectedBlockClientIds,
- blocks: getBlocksByClientId(selectedBlockClientIds)
- };
- }, []); // Allow converting a single template part to standard blocks.
- if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') {
- return (0,external_wp_element_namespaceObject.createElement)(ConvertToRegularBlocks, {
- clientId: clientIds[0]
- });
- }
- return (0,external_wp_element_namespaceObject.createElement)(ConvertToTemplatePart, {
- clientIds: clientIds,
- blocks: blocks
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
- /**
- * WordPress dependencies
- */
- const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
- }));
- /* harmony default export */ var library_pencil = (pencil);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
- /**
- * Internal dependencies
- */
- /* harmony default export */ var edit = (library_pencil);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigate-to-link/index.js
- /**
- * WordPress dependencies
- */
- function NavigateToLink(_ref) {
- let {
- type,
- id,
- activePage,
- onActivePageChange
- } = _ref;
- const post = (0,external_wp_data_namespaceObject.useSelect)(select => type && id && type !== 'URL' && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', type, id), [type, id]);
- const onClick = (0,external_wp_element_namespaceObject.useMemo)(() => {
- if (!(post !== null && post !== void 0 && post.link)) return null;
- const path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(post.link);
- if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null;
- return () => onActivePageChange({
- type,
- slug: post.slug,
- path,
- context: {
- postType: post.type,
- postId: post.id
- }
- });
- }, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]);
- return onClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- icon: edit,
- label: (0,external_wp_i18n_namespaceObject.__)('Edit Page Template'),
- onClick: onClick
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/block-inspector-button.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function BlockInspectorButton(_ref) {
- let {
- onClick = () => {}
- } = _ref;
- const {
- shortcut,
- isBlockInspectorOpen
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-block-settings-sidebar'),
- isBlockInspectorOpen: select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK
- }), []);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const label = isBlockInspectorOpen ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- if (isBlockInspectorOpen) {
- disableComplementaryArea(STORE_NAME);
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
- } else {
- enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
- } // Close dropdown menu.
- onClick();
- },
- shortcut: shortcut
- }, label);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/edit-template-part-menu-button/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditTemplatePartMenuButton() {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref => {
- let {
- selectedClientIds,
- onClose
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuItem, {
- selectedClientId: selectedClientIds[0],
- onClose: onClose
- });
- });
- }
- function EditTemplatePartMenuItem(_ref2) {
- let {
- selectedClientId,
- onClose
- } = _ref2;
- const {
- params
- } = useLocation();
- const selectedTemplatePart = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const block = select(external_wp_blockEditor_namespaceObject.store).getBlock(selectedClientId);
- if (block && (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) {
- const {
- theme,
- slug
- } = block.attributes;
- return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API.
- `${theme}//${slug}`);
- }
- }, [selectedClientId]);
- const linkProps = useLink({
- postId: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.id,
- postType: selectedTemplatePart === null || selectedTemplatePart === void 0 ? void 0 : selectedTemplatePart.type
- }, {
- fromTemplateId: params.postId
- });
- if (!selectedTemplatePart) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, linkProps, {
- onClick: event => {
- linkProps.onClick(event);
- onClose();
- }
- }),
- /* translators: %s: template part title */
- (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Edit %s'), selectedTemplatePart.slug));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
- /**
- * WordPress dependencies
- */
- const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
- }));
- /* harmony default export */ var arrow_left = (arrowLeft);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/back-button.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function BackButton() {
- var _location$state;
- const location = useLocation();
- const history = useHistory();
- const isTemplatePart = location.params.postType === 'wp_template_part';
- const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId;
- if (!isTemplatePart || !previousTemplateId) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- className: "edit-site-visual-editor__back-button",
- icon: arrow_left,
- onClick: () => {
- history.back();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Back'));
- }
- /* harmony default export */ var back_button = (BackButton);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resize-handle.js
- /**
- * WordPress dependencies
- */
- const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
- function ResizeHandle(_ref) {
- let {
- direction,
- resizeWidthBy
- } = _ref;
- function handleKeyDown(event) {
- const {
- keyCode
- } = event;
- if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
- resizeWidthBy(DELTA_DISTANCE);
- } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) {
- resizeWidthBy(-DELTA_DISTANCE);
- }
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("button", {
- className: `resizable-editor__drag-handle is-${direction}`,
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
- "aria-describedby": `resizable-editor__resize-help-${direction}`,
- onKeyDown: handleKeyDown
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- id: `resizable-editor__resize-help-${direction}`
- }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.')));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resizable-editor.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const DEFAULT_STYLES = {
- width: '100%',
- height: '100%'
- }; // Removes the inline styles in the drag handles.
- const HANDLE_STYLES_OVERRIDE = {
- position: undefined,
- userSelect: undefined,
- cursor: undefined,
- width: undefined,
- height: undefined,
- top: undefined,
- right: undefined,
- bottom: undefined,
- left: undefined
- };
- function ResizableEditor(_ref) {
- let {
- enableResizing,
- settings,
- children,
- ...props
- } = _ref;
- const deviceType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetPreviewDeviceType(), []);
- const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType);
- const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.width);
- const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.height);
- const iframeRef = (0,external_wp_element_namespaceObject.useRef)();
- const mouseMoveTypingResetRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
- const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, mouseMoveTypingResetRef]);
- (0,external_wp_element_namespaceObject.useEffect)(function autoResizeIframeHeight() {
- const iframe = iframeRef.current;
- if (!iframe || !enableResizing) {
- return;
- }
- let animationFrame = null;
- function resizeHeight() {
- if (!animationFrame) {
- // Throttle the updates on animation frame.
- animationFrame = iframe.contentWindow.requestAnimationFrame(() => {
- setHeight(iframe.contentDocument.documentElement.scrollHeight);
- animationFrame = null;
- });
- }
- }
- let resizeObserver;
- function registerObserver() {
- var _resizeObserver;
- (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
- resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter
- // gets destroyed and remounted after initialization in <Iframe>.
- resizeObserver.observe(iframe.contentDocument.documentElement);
- resizeHeight();
- } // This is only required in Firefox for some unknown reasons.
- iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari.
- registerObserver();
- return () => {
- var _iframe$contentWindow, _resizeObserver2;
- (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame);
- (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
- iframe.removeEventListener('load', registerObserver);
- };
- }, [enableResizing]);
- const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => {
- if (iframeRef.current) {
- setWidth(iframeRef.current.offsetWidth + deltaPixels);
- }
- }, []);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
- size: {
- width,
- height
- },
- onResizeStop: (event, direction, element) => {
- setWidth(element.style.width);
- },
- minWidth: 300,
- maxWidth: "100%",
- maxHeight: "100%",
- enable: {
- right: enableResizing,
- left: enableResizing
- },
- showHandle: enableResizing // The editor is centered horizontally, resizing it only
- // moves half the distance. Hence double the ratio to correctly
- // align the cursor to the resizer handle.
- ,
- resizeRatio: 2,
- handleComponent: {
- left: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, {
- direction: "left",
- resizeWidthBy: resizeWidthBy
- }),
- right: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, {
- direction: "right",
- resizeWidthBy: resizeWidthBy
- })
- },
- handleClasses: undefined,
- handleStyles: {
- left: HANDLE_STYLES_OVERRIDE,
- right: HANDLE_STYLES_OVERRIDE
- }
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, extends_extends({
- style: enableResizing ? undefined : deviceStyles,
- head: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
- styles: settings.styles
- }), (0,external_wp_element_namespaceObject.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing.
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
- `.is-root-container { display: flow-root; }`), enableResizing && (0,external_wp_element_namespaceObject.createElement)("style", null, // Force the <html> and <body>'s heights to fit the content.
- `html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container,
- // which isn't a requirement in auto resize mode.
- `.is-root-container { min-height: 0 !important; }`)),
- assets: settings.__unstableResolvedAssets,
- ref: ref,
- name: "editor-canvas",
- className: "edit-site-visual-editor__editor-canvas"
- }, props), settings.svgFilters, children));
- }
- /* harmony default export */ var resizable_editor = (ResizableEditor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const LAYOUT = {
- type: 'default',
- // At the root level of the site editor, no alignments should be allowed.
- alignments: []
- };
- function BlockEditor(_ref) {
- var _storedSettings$__exp, _storedSettings$__exp2;
- let {
- setIsInserterOpen
- } = _ref;
- const {
- storedSettings,
- templateType,
- templateId,
- page
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getSettings,
- getEditedPostType,
- getEditedPostId,
- getPage
- } = select(store_store);
- return {
- storedSettings: getSettings(setIsInserterOpen),
- templateType: getEditedPostType(),
- templateId: getEditedPostId(),
- page: getPage()
- };
- }, [setIsInserterOpen]);
- const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
- storedSettings.__experimentalBlockPatterns; // WP 5.9
- const settingsBlockPatternCategories = (_storedSettings$__exp2 = storedSettings.__experimentalAdditionalBlockPatternCategories) !== null && _storedSettings$__exp2 !== void 0 ? _storedSettings$__exp2 : // WP 6.0
- storedSettings.__experimentalBlockPatternCategories; // WP 5.9
- const {
- restBlockPatterns,
- restBlockPatternCategories
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
- restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
- }), []);
- const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatterns, restBlockPatterns, 'name'), [settingsBlockPatterns, restBlockPatterns]);
- const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatternCategories, restBlockPatternCategories, 'name'), [settingsBlockPatternCategories, restBlockPatternCategories]);
- const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.omit)(storedSettings, ['__experimentalAdditionalBlockPatterns', '__experimentalAdditionalBlockPatternCategories']),
- __experimentalBlockPatterns: blockPatterns,
- __experimentalBlockPatternCategories: blockPatternCategories
- }), [storedSettings, blockPatterns, blockPatternCategories]);
- const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType);
- const {
- setPage
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- enableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const openNavigationSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => {
- enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu');
- }, [enableComplementaryArea]);
- const contentRef = (0,external_wp_element_namespaceObject.useRef)();
- const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)()]);
- const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
- const {
- clearSelectedBlock
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- const isTemplatePart = templateType === 'wp_template_part';
- const hasBlocks = blocks.length !== 0;
- const NavMenuSidebarToggle = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
- className: "components-toolbar__control",
- label: (0,external_wp_i18n_namespaceObject.__)('Open list view'),
- onClick: openNavigationSidebar,
- icon: list_view
- })); // Conditionally include NavMenu sidebar in Plugin only.
- // Optimise for dead code elimination.
- // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
- let MaybeNavMenuSidebarToggle = external_wp_element_namespaceObject.Fragment;
- if (false) {}
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
- settings: settings,
- value: blocks,
- onInput: onInput,
- onChange: onChange,
- useSubRegistry: false
- }, (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuButton, null), (0,external_wp_element_namespaceObject.createElement)(TemplatePartConverter, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl.ViewerFill, null, (0,external_wp_element_namespaceObject.useCallback)(fillProps => (0,external_wp_element_namespaceObject.createElement)(NavigateToLink, extends_extends({}, fillProps, {
- activePage: page,
- onActivePageChange: setPage
- })), [page])), (0,external_wp_element_namespaceObject.createElement)(SidebarInspectorFill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
- className: classnames_default()('edit-site-visual-editor', {
- 'is-focus-mode': isTemplatePart
- }),
- __unstableContentRef: contentRef,
- onClick: event => {
- // Clear selected block when clicking on the gray background.
- if (event.target === event.currentTarget) {
- clearSelectedBlock();
- }
- }
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(back_button, null), (0,external_wp_element_namespaceObject.createElement)(resizable_editor // Reinitialize the editor and reset the states when the template changes.
- , {
- key: templateId,
- enableResizing: isTemplatePart && // Disable resizing in mobile viewport.
- !isMobileViewport,
- settings: settings,
- contentRef: mergedRefs
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
- className: "edit-site-block-editor__block-list wp-site-blocks",
- __experimentalLayout: LAYOUT,
- renderAppender: isTemplatePart && hasBlocks ? false : undefined
- })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref2 => {
- let {
- onClose
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorButton, {
- onClick: onClose
- });
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0,external_wp_element_namespaceObject.createElement)(MaybeNavMenuSidebarToggle, null)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null));
- }
- // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
- var lib = __webpack_require__(773);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/code-editor-text-area.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * WordPress dependencies
- */
- function CodeEditorTextArea(_ref) {
- let {
- value,
- onChange,
- onInput
- } = _ref;
- const [stateValue, setStateValue] = (0,external_wp_element_namespaceObject.useState)(value);
- const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false);
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditorTextArea);
- if (!isDirty && stateValue !== value) {
- setStateValue(value);
- }
- /**
- * Handles a textarea change event to notify the onChange prop callback and
- * reflect the new value in the component's own state. This marks the start
- * of the user's edits, if not already changed, preventing future props
- * changes to value from replacing the rendered value. This is expected to
- * be followed by a reset to dirty state via `stopEditing`.
- *
- * @see stopEditing
- *
- * @param {Event} event Change event.
- */
- const onChangeHandler = event => {
- const newValue = event.target.value;
- onInput(newValue);
- setStateValue(newValue);
- setIsDirty(true);
- };
- /**
- * Function called when the user has completed their edits, responsible for
- * ensuring that changes, if made, are surfaced to the onPersist prop
- * callback and resetting dirty state.
- */
- const stopEditing = () => {
- if (isDirty) {
- onChange(stateValue);
- setIsDirty(false);
- }
- };
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
- as: "label",
- htmlFor: `code-editor-text-area-${instanceId}`
- }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
- autoComplete: "off",
- dir: "auto",
- value: stateValue,
- onChange: onChangeHandler,
- onBlur: stopEditing,
- className: "edit-site-code-editor-text-area",
- id: `code-editor-text-area-${instanceId}`,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function CodeEditor() {
- const {
- templateType,
- shortcut
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- getEditedPostType
- } = select(store_store);
- const {
- getShortcutRepresentation
- } = select(external_wp_keyboardShortcuts_namespaceObject.store);
- return {
- templateType: getEditedPostType(),
- shortcut: getShortcutRepresentation('core/edit-site/toggle-mode')
- };
- }, []);
- const [contentStructure, setContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', templateType, 'content');
- const [blocks,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType);
- const content = contentStructure instanceof Function ? contentStructure({
- blocks
- }) : contentStructure;
- const {
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- return (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-code-editor"
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-code-editor__toolbar"
- }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => switchEditorMode('visual'),
- shortcut: shortcut
- }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-code-editor__body"
- }, (0,external_wp_element_namespaceObject.createElement)(CodeEditorTextArea, {
- value: content,
- onChange: newContent => {
- onChange((0,external_wp_blocks_namespaceObject.parse)(newContent), {
- selection: undefined
- });
- },
- onInput: setContent
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function KeyboardShortcuts(_ref) {
- let {
- openEntitiesSavedStates
- } = _ref;
- const {
- __experimentalGetDirtyEntityRecords,
- isSavingEntityRecord
- } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
- const {
- getEditorMode
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const isListViewOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isListViewOpened(), []);
- const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []);
- const {
- redo,
- undo
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- setIsListViewOpened,
- switchEditorMode
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- enableComplementaryArea,
- disableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => {
- event.preventDefault();
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- const isDirty = !!dirtyEntityRecords.length;
- const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
- if (!isSaving && isDirty) {
- openEntitiesSavedStates();
- }
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/undo', event => {
- undo();
- event.preventDefault();
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/redo', event => {
- redo();
- event.preventDefault();
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-list-view', () => {
- setIsListViewOpened(!isListViewOpen);
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => {
- // This shortcut has no known clashes, but use preventDefault to prevent any
- // obscure shortcuts from triggering.
- event.preventDefault();
- if (isBlockInspectorOpen) {
- disableComplementaryArea(STORE_NAME);
- } else {
- enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
- }
- });
- (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => {
- switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
- });
- return null;
- }
- function KeyboardShortcutsRegister() {
- // Registering the shortcuts.
- const {
- registerShortcut
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- registerShortcut({
- name: 'core/edit-site/save',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
- keyCombination: {
- modifier: 'primary',
- character: 's'
- }
- });
- registerShortcut({
- name: 'core/edit-site/undo',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
- keyCombination: {
- modifier: 'primary',
- character: 'z'
- }
- });
- registerShortcut({
- name: 'core/edit-site/redo',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
- keyCombination: {
- modifier: 'primaryShift',
- character: 'z'
- }
- });
- registerShortcut({
- name: 'core/edit-site/toggle-list-view',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
- keyCombination: {
- modifier: 'access',
- character: 'o'
- }
- });
- registerShortcut({
- name: 'core/edit-site/toggle-block-settings-sidebar',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the block settings sidebar.'),
- keyCombination: {
- modifier: 'primaryShift',
- character: ','
- }
- });
- registerShortcut({
- name: 'core/edit-site/keyboard-shortcuts',
- category: 'main',
- description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
- keyCombination: {
- modifier: 'access',
- character: 'h'
- }
- });
- registerShortcut({
- name: 'core/edit-site/next-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
- keyCombination: {
- modifier: 'ctrl',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'n'
- }]
- });
- registerShortcut({
- name: 'core/edit-site/previous-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
- keyCombination: {
- modifier: 'ctrlShift',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'p'
- }]
- });
- registerShortcut({
- name: 'core/edit-site/toggle-mode',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
- keyCombination: {
- modifier: 'secondary',
- character: 'm'
- }
- });
- }, [registerShortcut]);
- return null;
- }
- KeyboardShortcuts.Register = KeyboardShortcutsRegister;
- /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/url-query-controller/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function URLQueryController() {
- const {
- setTemplate,
- setTemplatePart,
- setPage
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- params: {
- postId,
- postType
- }
- } = useLocation(); // Set correct entity on page navigation.
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if ('page' === postType || 'post' === postType) {
- setPage({
- context: {
- postType,
- postId
- }
- }); // Resolves correct template based on ID.
- } else if ('wp_template' === postType) {
- setTemplate(postId);
- } else if ('wp_template_part' === postType) {
- setTemplatePart(postId);
- }
- }, [postId, postType]);
- return null;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
- /**
- * WordPress dependencies
- */
- const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
- }));
- /* harmony default export */ var library_close = (close_close);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/inserter-sidebar.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function InserterSidebar() {
- const {
- setIsInserterOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetInsertionPoint(), []);
- const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
- const TagName = !isMobile ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
- const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
- onClose: () => setIsInserterOpened(false),
- focusOnMount: null
- });
- const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- libraryRef.current.focusSearch();
- }, []);
- return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
- ref: inserterDialogRef
- }, inserterDialogProps, {
- className: "edit-site-editor__inserter-panel"
- }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
- className: "edit-site-editor__inserter-panel-header"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- icon: library_close,
- label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
- onClick: () => setIsInserterOpened(false)
- })), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-editor__inserter-panel-content"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
- showInserterHelpPanel: true,
- shouldFocusBlock: isMobile,
- rootClientId: insertionPoint.rootClientId,
- __experimentalInsertionIndex: insertionPoint.insertionIndex,
- __experimentalFilterValue: insertionPoint.filterValue,
- ref: libraryRef
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/list-view-sidebar.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function ListViewSidebar() {
- const {
- setIsListViewOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
- const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
- const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
- function closeOnEscape(event) {
- if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
- setIsListViewOpened(false);
- }
- }
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
- const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`;
- return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
- (0,external_wp_element_namespaceObject.createElement)("div", {
- "aria-labelledby": labelId,
- className: "edit-site-editor__list-view-panel",
- onKeyDown: closeOnEscape
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-editor__list-view-panel-header",
- ref: headerFocusReturnRef
- }, (0,external_wp_element_namespaceObject.createElement)("strong", {
- id: labelId
- }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- icon: close_small,
- label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
- onClick: () => setIsListViewOpened(false)
- })), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-editor__list-view-panel-content",
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
- showNestedBlocks: true,
- __experimentalFeatures: true,
- __experimentalPersistentListViewFeatures: true
- })))
- );
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js
- /**
- * WordPress dependencies
- */
- function CopyButton(_ref) {
- let {
- text,
- children
- } = _ref;
- const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- ref: ref
- }, children);
- }
- function ErrorBoundaryWarning(_ref2) {
- let {
- message,
- error,
- reboot,
- dashboardLink
- } = _ref2;
- const actions = [];
- if (reboot) {
- actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- key: "recovery",
- onClick: reboot,
- variant: "secondary"
- }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')));
- }
- if (error) {
- actions.push((0,external_wp_element_namespaceObject.createElement)(CopyButton, {
- key: "copy-error",
- text: error.stack
- }, (0,external_wp_i18n_namespaceObject.__)('Copy Error')));
- }
- if (dashboardLink) {
- actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- key: "back-to-dashboard",
- variant: "secondary",
- href: dashboardLink
- }, (0,external_wp_i18n_namespaceObject.__)('Back to dashboard')));
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
- className: "editor-error-boundary",
- actions: actions
- }, message);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- class ErrorBoundary extends external_wp_element_namespaceObject.Component {
- constructor() {
- super(...arguments);
- this.reboot = this.reboot.bind(this);
- this.state = {
- error: null
- };
- }
- static getDerivedStateFromError(error) {
- return {
- error
- };
- }
- reboot() {
- this.props.onError();
- }
- render() {
- const {
- error
- } = this.state;
- if (!error) {
- return this.props.children;
- }
- return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, {
- message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'),
- error: error,
- reboot: this.reboot
- });
- }
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js
- function WelcomeGuideImage(_ref) {
- let {
- nonAnimatedSrc,
- animatedSrc
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)("picture", {
- className: "edit-site-welcome-guide__image"
- }, (0,external_wp_element_namespaceObject.createElement)("source", {
- srcSet: nonAnimatedSrc,
- media: "(prefers-reduced-motion: reduce)"
- }), (0,external_wp_element_namespaceObject.createElement)("img", {
- src: animatedSrc,
- width: "312",
- height: "240",
- alt: ""
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function WelcomeGuideEditor() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), []);
- if (!isActive) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide",
- contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'),
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuide'),
- pages: [{
- image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
- }),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), {
- StylesIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
- alt: (0,external_wp_i18n_namespaceObject.__)('styles'),
- src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"
- })
- })))
- }]
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function WelcomeGuideStyles() {
- const {
- toggle
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
- const {
- isActive,
- isStylesOpen
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const sidebar = select(store).getActiveComplementaryArea(store_store.name);
- return {
- isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'),
- isStylesOpen: sidebar === 'edit-site/global-styles'
- };
- }, []);
- if (!isActive || !isStylesOpen) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
- className: "edit-site-welcome-guide",
- contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to styles'),
- finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'),
- onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'),
- pages: [{
- image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
- }),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.')))
- }, {
- image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
- }),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ')))
- }, {
- image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
- animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
- }),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.')))
- }, {
- image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
- nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
- animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
- }),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
- className: "edit-site-welcome-guide__heading"
- }, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_wp_element_namespaceObject.createElement)("p", {
- className: "edit-site-welcome-guide__text"
- }, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
- href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/styles-overview/')
- }, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.'))))
- }]
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js
- /**
- * Internal dependencies
- */
- function WelcomeGuide() {
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideEditor, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideStyles, null));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/global-styles-renderer.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Internal dependencies
- */
- function useGlobalStylesRenderer() {
- const [styles, settings, svgFilters] = useGlobalStylesOutput();
- const {
- getSettings
- } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
- const {
- updateSettings
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (!styles || !settings) {
- return;
- }
- const currentStoreSettings = getSettings();
- const nonGlobalStyles = (0,external_lodash_namespaceObject.filter)(currentStoreSettings.styles, style => !style.isGlobalStyles);
- updateSettings({ ...currentStoreSettings,
- styles: [...nonGlobalStyles, ...styles],
- svgFilters,
- __experimentalFeatures: settings
- });
- }, [styles, settings]);
- }
- function GlobalStylesRenderer() {
- useGlobalStylesRenderer();
- return null;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function useTitle(title) {
- const location = useLocation();
- const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _select$getEntityReco;
- return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title;
- }, []);
- const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- isInitialLocationRef.current = false;
- }, [location]);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- // Don't update or announce the title for initial page load.
- if (isInitialLocationRef.current) {
- return;
- }
- if (title && siteTitle) {
- // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
- const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
- (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s — WordPress'), title, siteTitle);
- document.title = formattedTitle; // Announce title on route change for screen readers.
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: The page title that is currently displaying. */
- (0,external_wp_i18n_namespaceObject.__)('Now displaying: %s'), document.title), 'assertive');
- }
- }, [title, siteTitle, location]);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const interfaceLabels = {
- drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar')
- };
- function Editor(_ref) {
- let {
- onError
- } = _ref;
- const {
- isInserterOpen,
- isListViewOpen,
- sidebarIsOpened,
- settings,
- entityId,
- templateType,
- page,
- template,
- templateResolved,
- isNavigationOpen,
- previousShortcut,
- nextShortcut,
- editorMode,
- showIconLabels
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- const {
- isInserterOpened,
- isListViewOpened,
- getSettings,
- getEditedPostType,
- getEditedPostId,
- getPage,
- isNavigationOpened,
- getEditorMode
- } = select(store_store);
- const {
- hasFinishedResolution,
- getEntityRecord
- } = select(external_wp_coreData_namespaceObject.store);
- const postType = getEditedPostType();
- const postId = getEditedPostId(); // The currently selected entity to display. Typically template or template part.
- return {
- isInserterOpen: isInserterOpened(),
- isListViewOpen: isListViewOpened(),
- sidebarIsOpened: !!select(store).getActiveComplementaryArea(store_store.name),
- settings: getSettings(),
- templateType: postType,
- page: getPage(),
- template: postId ? getEntityRecord('postType', postType, postId) : null,
- templateResolved: postId ? hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) : false,
- entityId: postId,
- isNavigationOpen: isNavigationOpened(),
- previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
- nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
- editorMode: getEditorMode(),
- showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'showIconLabels')
- };
- }, []);
- const {
- setPage,
- setIsInserterOpened
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- enableComplementaryArea
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
- const [isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setIsEntitiesSavedStatesOpen(true), []);
- const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => {
- setIsEntitiesSavedStatesOpen(false);
- }, []);
- const blockContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(page === null || page === void 0 ? void 0 : page.context),
- queryContext: [(page === null || page === void 0 ? void 0 : page.context.queryContext) || {
- page: 1
- }, newQueryContext => setPage({ ...page,
- context: { ...(page === null || page === void 0 ? void 0 : page.context),
- queryContext: { ...(page === null || page === void 0 ? void 0 : page.context.queryContext),
- ...newQueryContext
- }
- }
- })]
- }), [page === null || page === void 0 ? void 0 : page.context]);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- if (isNavigationOpen) {
- document.body.classList.add('is-navigation-sidebar-open');
- } else {
- document.body.classList.remove('is-navigation-sidebar-open');
- }
- }, [isNavigationOpen]);
- (0,external_wp_element_namespaceObject.useEffect)(function openGlobalStylesOnLoad() {
- const searchParams = new URLSearchParams(window.location.search);
- if (searchParams.get('styles') === 'open') {
- enableComplementaryArea('core/edit-site', 'edit-site/global-styles');
- }
- }, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded.
- const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined;
- const secondarySidebarLabel = isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
- const secondarySidebar = () => {
- if (editorMode === 'visual' && isInserterOpen) {
- return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
- }
- if (editorMode === 'visual' && isListViewOpen) {
- return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
- }
- return null;
- }; // Only announce the title once the editor is ready to prevent "Replace"
- // action in <URlQueryController> from double-announcing.
- useTitle(isReady && (0,external_wp_i18n_namespaceObject.__)('Editor (beta)'));
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(URLQueryController, null), isReady && (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
- kind: "root",
- type: "site"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
- kind: "postType",
- type: templateType,
- id: entityId
- }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
- value: blockContext
- }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesRenderer, null), (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, {
- onError: onError
- }, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarComplementaryAreaFills, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
- labels: { ...interfaceLabels,
- secondarySidebar: secondarySidebarLabel
- },
- className: showIconLabels && 'show-icon-labels',
- secondarySidebar: secondarySidebar(),
- sidebar: sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
- scope: "core/edit-site"
- }),
- drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null),
- header: (0,external_wp_element_namespaceObject.createElement)(Header, {
- openEntitiesSavedStates: openEntitiesSavedStates,
- showIconLabels: showIconLabels
- }),
- notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
- content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
- scope: "core/block-inspector"
- }), editorMode === 'visual' && template && (0,external_wp_element_namespaceObject.createElement)(BlockEditor, {
- setIsInserterOpen: setIsInserterOpened
- }), editorMode === 'text' && template && (0,external_wp_element_namespaceObject.createElement)(CodeEditor, null), templateResolved && !template && (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && entityId && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
- status: "warning",
- isDismissible: false
- }, (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, {
- openEntitiesSavedStates: openEntitiesSavedStates
- })),
- actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen ? (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
- close: closeEntitiesSavedStates
- }) : (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-editor__toggle-save-panel"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "secondary",
- className: "edit-site-editor__toggle-save-panel-button",
- onClick: openEntitiesSavedStates,
- "aria-expanded": false
- }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')))),
- footer: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
- rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Template')
- }),
- shortcuts: {
- previous: previousShortcut,
- next: nextShortcut
- }
- }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null))))))));
- }
- /* harmony default export */ var editor = (Editor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/use-register-shortcuts.js
- /**
- * WordPress dependencies
- */
- function useRegisterShortcuts() {
- const {
- registerShortcut
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
- (0,external_wp_element_namespaceObject.useEffect)(() => {
- registerShortcut({
- name: 'core/edit-site/next-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
- keyCombination: {
- modifier: 'ctrl',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'n'
- }]
- });
- registerShortcut({
- name: 'core/edit-site/previous-region',
- category: 'global',
- description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
- keyCombination: {
- modifier: 'ctrlShift',
- character: '`'
- },
- aliases: [{
- modifier: 'access',
- character: 'p'
- }]
- });
- }, []);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
- /**
- * WordPress dependencies
- */
- const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"
- }));
- /* harmony default export */ var library_post = (post);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
- /**
- * WordPress dependencies
- */
- const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"
- }));
- /* harmony default export */ var library_page = (page);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js
- /**
- * WordPress dependencies
- */
- const archive = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z"
- }));
- /* harmony default export */ var library_archive = (archive);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
- /**
- * WordPress dependencies
- */
- const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"
- }));
- /* harmony default export */ var library_search = (search);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js
- /**
- * WordPress dependencies
- */
- const notFound = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"
- }));
- /* harmony default export */ var not_found = (notFound);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js
- /**
- * WordPress dependencies
- */
- const list = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"
- }));
- /* harmony default export */ var library_list = (list);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
- /**
- * WordPress dependencies
- */
- const category = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",
- fillRule: "evenodd",
- clipRule: "evenodd"
- }));
- /* harmony default export */ var library_category = (category);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js
- /**
- * WordPress dependencies
- */
- const postAuthor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",
- fillRule: "evenodd",
- clipRule: "evenodd"
- }));
- /* harmony default export */ var post_author = (postAuthor);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js
- /**
- * WordPress dependencies
- */
- const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- "fill-rule": "evenodd",
- d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",
- "clip-rule": "evenodd"
- }));
- /* harmony default export */ var block_meta = (blockDefault);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-date.js
- /**
- * WordPress dependencies
- */
- const postDate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z"
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"
- }));
- /* harmony default export */ var post_date = (postDate);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
- /**
- * WordPress dependencies
- */
- const tag = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z"
- }));
- /* harmony default export */ var library_tag = (tag);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
- /**
- * WordPress dependencies
- */
- const media = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z"
- }));
- /* harmony default export */ var library_media = (media);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
- const TEMPLATE_ICONS = {
- 'front-page': library_home,
- 'single-post': library_post,
- page: library_page,
- archive: library_archive,
- search: library_search,
- 404: not_found,
- index: library_list,
- category: library_category,
- author: post_author,
- taxonomy: block_meta,
- date: post_date,
- tag: library_tag,
- attachment: library_media
- };
- function NewTemplate(_ref) {
- let {
- postType
- } = _ref;
- const history = useHistory();
- const {
- templates,
- defaultTemplateTypes
- } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
- templates: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
- per_page: -1
- }),
- defaultTemplateTypes: select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes()
- }), []);
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- setTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- async function createTemplate(_ref2) {
- let {
- slug
- } = _ref2;
- try {
- const {
- title,
- description
- } = (0,external_lodash_namespaceObject.find)(defaultTemplateTypes, {
- slug
- });
- const template = await saveEntityRecord('postType', 'wp_template', {
- excerpt: description,
- // Slugs need to be strings, so this is for template `404`
- slug: slug.toString(),
- status: 'publish',
- title
- }, {
- throwOnError: true
- }); // Set template before navigating away to avoid initial stale value.
- setTemplate(template.id, template.slug); // Navigate to the created template editor.
- history.push({
- postId: template.id,
- postType: template.type
- }); // TODO: Add a success notice?
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- const existingTemplateSlugs = (0,external_lodash_namespaceObject.map)(templates, 'slug');
- const missingTemplates = (0,external_lodash_namespaceObject.filter)(defaultTemplateTypes, template => (0,external_lodash_namespaceObject.includes)(DEFAULT_TEMPLATE_SLUGS, template.slug) && !(0,external_lodash_namespaceObject.includes)(existingTemplateSlugs, template.slug));
- if (!missingTemplates.length) {
- return null;
- } // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
- missingTemplates.sort((template1, template2) => {
- return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
- });
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- className: "edit-site-new-template-dropdown",
- icon: null,
- text: postType.labels.add_new,
- label: postType.labels.add_new_item,
- popoverProps: {
- noArrow: false
- },
- toggleProps: {
- variant: 'primary'
- }
- }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, {
- className: "edit-site-new-template-dropdown__popover"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: postType.labels.add_new_item
- }, (0,external_lodash_namespaceObject.map)(missingTemplates, _ref3 => {
- let {
- title,
- description,
- slug
- } = _ref3;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: TEMPLATE_ICONS[slug],
- iconPosition: "left",
- info: description,
- key: slug,
- onClick: () => {
- createTemplate({
- slug
- }); // We will be navigated way so no need to close the dropdown.
- }
- }, title);
- }))));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template-part.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function NewTemplatePart(_ref) {
- let {
- postType
- } = _ref;
- const history = useHistory();
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const {
- saveEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- async function createTemplatePart(_ref2) {
- let {
- title,
- area
- } = _ref2;
- if (!title) {
- createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Title is not defined.'), {
- type: 'snackbar'
- });
- return;
- }
- try {
- // Currently template parts only allow latin chars.
- // Fallback slug will receive suffix by default.
- const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
- const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
- slug: cleanSlug,
- title,
- content: '',
- area
- }, {
- throwOnError: true
- });
- setIsModalOpen(false); // Navigate to the created template part editor.
- history.push({
- postId: templatePart.id,
- postType: templatePart.type
- }); // TODO: Add a success notice?
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- setIsModalOpen(false);
- }
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- onClick: () => {
- setIsModalOpen(true);
- }
- }, postType.labels.add_new), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, {
- closeModal: () => setIsModalOpen(false),
- onCreate: createTemplatePart
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function AddNewTemplate(_ref) {
- let {
- templateType = 'wp_template'
- } = _ref;
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
- if (!postType) {
- return null;
- }
- if (templateType === 'wp_template') {
- return (0,external_wp_element_namespaceObject.createElement)(NewTemplate, {
- postType: postType
- });
- } else if (templateType === 'wp_template_part') {
- return (0,external_wp_element_namespaceObject.createElement)(NewTemplatePart, {
- postType: postType
- });
- }
- return null;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/header.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function header_Header(_ref) {
- var _postType$labels;
- let {
- templateType
- } = _ref;
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
- if (!postType) {
- return null;
- }
- return (0,external_wp_element_namespaceObject.createElement)("header", {
- className: "edit-site-list-header"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 1,
- className: "edit-site-list-header__title"
- }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), (0,external_wp_element_namespaceObject.createElement)("div", {
- className: "edit-site-list-header__right"
- }, (0,external_wp_element_namespaceObject.createElement)(AddNewTemplate, {
- templateType: templateType
- })));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js
- /**
- * Check if a template is removable.
- *
- * @param {Object} template The template entity to check.
- * @return {boolean} Whether the template is revertable.
- */
- function isTemplateRemovable(template) {
- if (!template) {
- return false;
- }
- return template.source === 'custom' && !template.has_theme_file;
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/rename-menu-item.js
- /**
- * WordPress dependencies
- */
- function RenameMenuItem(_ref) {
- let {
- template,
- onClose
- } = _ref;
- const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => template.title.rendered);
- const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
- const {
- editEntityRecord,
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- if (!template.is_custom) {
- return null;
- }
- async function onTemplateRename(event) {
- event.preventDefault();
- try {
- await editEntityRecord('postType', template.type, template.id, {
- title
- }); // Update state before saving rerenders the list.
- setTitle('');
- setIsModalOpen(false);
- onClose(); // Persist edited entity.
- await saveEditedEntityRecord('postType', template.type, template.id, {
- throwOnError: true
- });
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity renamed.'), {
- type: 'snackbar'
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the entity.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => {
- setIsModalOpen(true);
- setTitle(template.title.rendered);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
- closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
- onRequestClose: () => {
- setIsModalOpen(false);
- },
- overlayClassName: "edit-site-list__rename-modal"
- }, (0,external_wp_element_namespaceObject.createElement)("form", {
- onSubmit: onTemplateRename
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
- align: "flex-start",
- gap: 8
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- required: true
- }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
- className: "edit-site-list__rename-modal-actions",
- justify: "flex-end",
- expanded: false
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- setIsModalOpen(false);
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit"
- }, (0,external_wp_i18n_namespaceObject.__)('Save')))))));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function Actions(_ref) {
- let {
- template
- } = _ref;
- const {
- removeTemplate,
- revertTemplate
- } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
- const {
- saveEditedEntityRecord
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
- const {
- createSuccessNotice,
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- const isRemovable = isTemplateRemovable(template);
- const isRevertable = isTemplateRevertable(template);
- if (!isRemovable && !isRevertable) {
- return null;
- }
- async function revertAndSaveTemplate() {
- try {
- await revertTemplate(template, {
- allowUndo: false
- });
- await saveEditedEntityRecord('postType', template.type, template.id);
- createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity reverted.'), {
- type: 'snackbar'
- });
- } catch (error) {
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the entity.');
- createErrorNotice(errorMessage, {
- type: 'snackbar'
- });
- }
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: more_vertical,
- label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
- className: "edit-site-list-table__actions"
- }, _ref2 => {
- let {
- onClose
- } = _ref2;
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRemovable && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(RenameMenuItem, {
- template: template,
- onClose: onClose
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- isDestructive: true,
- isTertiary: true,
- onClick: () => {
- removeTemplate(template);
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Delete'))), isRevertable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- info: (0,external_wp_i18n_namespaceObject.__)('Restore to default state'),
- onClick: () => {
- revertAndSaveTemplate();
- onClose();
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')));
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
- /**
- * WordPress dependencies
- */
- const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
- }));
- /* harmony default export */ var library_plugins = (plugins);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
- /**
- * WordPress dependencies
- */
- const commentAuthorAvatar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- fillRule: "evenodd",
- d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
- clipRule: "evenodd"
- }));
- /* harmony default export */ var comment_author_avatar = (commentAuthorAvatar);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js
- /**
- * WordPress dependencies
- */
- const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"
- }));
- /* harmony default export */ var library_globe = (globe);
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/added-by.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part'];
- function CustomizedTooltip(_ref) {
- let {
- isCustomized,
- children
- } = _ref;
- if (!isCustomized) {
- return children;
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
- text: (0,external_wp_i18n_namespaceObject.__)('This template has been customized')
- }, children);
- }
- function BaseAddedBy(_ref2) {
- let {
- text,
- icon,
- imageUrl,
- isCustomized
- } = _ref2;
- const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- alignment: "left"
- }, (0,external_wp_element_namespaceObject.createElement)(CustomizedTooltip, {
- isCustomized: isCustomized
- }, imageUrl ? (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()('edit-site-list-added-by__avatar', {
- 'is-loaded': isImageLoaded
- })
- }, (0,external_wp_element_namespaceObject.createElement)("img", {
- onLoad: () => setIsImageLoaded(true),
- alt: "",
- src: imageUrl
- })) : (0,external_wp_element_namespaceObject.createElement)("div", {
- className: classnames_default()('edit-site-list-added-by__icon', {
- 'is-customized': isCustomized
- })
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
- icon: icon
- }))), (0,external_wp_element_namespaceObject.createElement)("span", null, text));
- }
- function AddedByTheme(_ref3) {
- var _theme$name;
- let {
- slug,
- isCustomized
- } = _ref3;
- const theme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTheme(slug), [slug]);
- return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
- icon: library_layout,
- text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug,
- isCustomized: isCustomized
- });
- }
- function AddedByPlugin(_ref4) {
- let {
- slug,
- isCustomized
- } = _ref4;
- const plugin = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPlugin(slug), [slug]);
- return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
- icon: library_plugins,
- text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug,
- isCustomized: isCustomized
- });
- }
- function AddedByAuthor(_ref5) {
- var _user$avatar_urls;
- let {
- id
- } = _ref5;
- const user = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getUser(id), [id]);
- return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
- icon: comment_author_avatar,
- imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48],
- text: user === null || user === void 0 ? void 0 : user.nickname
- });
- }
- function AddedBySite() {
- const {
- name,
- logoURL
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- var _getMedia;
- const {
- getEntityRecord,
- getMedia
- } = select(external_wp_coreData_namespaceObject.store);
- const siteData = getEntityRecord('root', '__unstableBase');
- return {
- name: siteData === null || siteData === void 0 ? void 0 : siteData.name,
- logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined
- };
- }, []);
- return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
- icon: library_globe,
- imageUrl: logoURL,
- text: name
- });
- }
- function AddedBy(_ref6) {
- let {
- templateType,
- template
- } = _ref6;
- if (!template) {
- return;
- }
- if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) {
- // Template originally provided by a theme, but customized by a user.
- // Templates originally didn't have the 'origin' field so identify
- // older customized templates by checking for no origin and a 'theme'
- // or 'custom' source.
- if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) {
- return (0,external_wp_element_namespaceObject.createElement)(AddedByTheme, {
- slug: template.theme,
- isCustomized: template.source === 'custom'
- });
- } // Template originally provided by a plugin, but customized by a user.
- if (template.has_theme_file && template.origin === 'plugin') {
- return (0,external_wp_element_namespaceObject.createElement)(AddedByPlugin, {
- slug: template.theme,
- isCustomized: template.source === 'custom'
- });
- } // Template was created from scratch, but has no author. Author support
- // was only added to templates in WordPress 5.9. Fallback to showing the
- // site logo and title.
- if (!template.has_theme_file && template.source === 'custom' && !template.author) {
- return (0,external_wp_element_namespaceObject.createElement)(AddedBySite, null);
- }
- } // Simply show the author for templates created from scratch that have an
- // author or for any other post type.
- return (0,external_wp_element_namespaceObject.createElement)(AddedByAuthor, {
- id: template.author
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/table.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function Table(_ref) {
- let {
- templateType
- } = _ref;
- const {
- records: templates,
- isResolving: isLoading
- } = (0,external_wp_coreData_namespaceObject.__experimentalUseEntityRecords)('postType', templateType, {
- per_page: -1
- });
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
- if (!templates || isLoading) {
- return null;
- }
- if (!templates.length) {
- var _postType$labels, _postType$labels$name;
- return (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_i18n_namespaceObject.sprintf)( // translators: The template type name, should be either "templates" or "template parts".
- (0,external_wp_i18n_namespaceObject.__)('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase()));
- }
- return (// These explicit aria roles are needed for Safari.
- // See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
- (0,external_wp_element_namespaceObject.createElement)("table", {
- className: "edit-site-list-table",
- role: "table"
- }, (0,external_wp_element_namespaceObject.createElement)("thead", null, (0,external_wp_element_namespaceObject.createElement)("tr", {
- className: "edit-site-list-table-head",
- role: "row"
- }, (0,external_wp_element_namespaceObject.createElement)("th", {
- className: "edit-site-list-table-column",
- role: "columnheader"
- }, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)("th", {
- className: "edit-site-list-table-column",
- role: "columnheader"
- }, (0,external_wp_i18n_namespaceObject.__)('Added by')), (0,external_wp_element_namespaceObject.createElement)("th", {
- className: "edit-site-list-table-column",
- role: "columnheader"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Actions'))))), (0,external_wp_element_namespaceObject.createElement)("tbody", null, templates.map(template => {
- var _template$title;
- return (0,external_wp_element_namespaceObject.createElement)("tr", {
- key: template.id,
- className: "edit-site-list-table-row",
- role: "row"
- }, (0,external_wp_element_namespaceObject.createElement)("td", {
- className: "edit-site-list-table-column",
- role: "cell"
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
- level: 4
- }, (0,external_wp_element_namespaceObject.createElement)(Link, {
- params: {
- postId: template.id,
- postType: template.type
- }
- }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug))), template.description), (0,external_wp_element_namespaceObject.createElement)("td", {
- className: "edit-site-list-table-column",
- role: "cell"
- }, (0,external_wp_element_namespaceObject.createElement)(AddedBy, {
- templateType: templateType,
- template: template
- })), (0,external_wp_element_namespaceObject.createElement)("td", {
- className: "edit-site-list-table-column",
- role: "cell"
- }, (0,external_wp_element_namespaceObject.createElement)(Actions, {
- template: template
- })));
- })))
- );
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function List() {
- var _postType$labels, _postType$labels2;
- const {
- params: {
- postType: templateType
- }
- } = useLocation();
- useRegisterShortcuts();
- const {
- previousShortcut,
- nextShortcut,
- isNavigationOpen
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
- return {
- previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
- nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
- isNavigationOpen: select(store_store).isNavigationOpened()
- };
- }, []);
- const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
- useTitle(postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name); // `postType` could load in asynchronously. Only provide the detailed region labels if
- // the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.
- const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list;
- const detailedRegionLabels = postType ? {
- header: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page.
- (0,external_wp_i18n_namespaceObject.__)('%s - Header'), itemsListLabel),
- body: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Content' as in the content area of that page.
- (0,external_wp_i18n_namespaceObject.__)('%s - Content'), itemsListLabel)
- } : undefined;
- return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
- className: classnames_default()('edit-site-list', {
- 'is-navigation-open': isNavigationOpen
- }),
- labels: {
- drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar'),
- ...detailedRegionLabels
- },
- header: (0,external_wp_element_namespaceObject.createElement)(header_Header, {
- templateType: templateType
- }),
- drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null),
- notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
- content: (0,external_wp_element_namespaceObject.createElement)(Table, {
- templateType: templateType
- }),
- shortcuts: {
- previous: previousShortcut,
- next: nextShortcut
- }
- });
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-is-list-page.js
- /**
- * Returns if the params match the list page route.
- *
- * @param {Object} params The search params.
- * @param {string} params.postId The post ID.
- * @param {string} params.postType The post type.
- * @return {boolean} Is list page or not.
- */
- function getIsListPage(_ref) {
- let {
- postId,
- postType
- } = _ref;
- return !!(!postId && postType);
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditSiteApp(_ref) {
- let {
- reboot
- } = _ref;
- const {
- createErrorNotice
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
- function onPluginAreaError(name) {
- createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
- /* translators: %s: plugin name */
- (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
- }
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(Routes, null, _ref2 => {
- let {
- params
- } = _ref2;
- const isListPage = getIsListPage(params);
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage ? (0,external_wp_element_namespaceObject.createElement)(List, null) : (0,external_wp_element_namespaceObject.createElement)(editor, {
- onError: reboot
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
- onError: onPluginAreaError
- }), (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar // Open the navigation sidebar by default when in the list page.
- , {
- isDefaultOpen: !!isListPage,
- activeTemplateType: isListPage ? params.postType : undefined
- }));
- }));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/plugin-sidebar/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
- * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
- * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
- *
- * ```js
- * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
- * ```
- *
- * @see PluginSidebarMoreMenuItem
- *
- * @param {Object} props Element props.
- * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
- * @param {string} [props.className] An optional class name added to the sidebar body.
- * @param {string} props.title Title displayed at the top of the sidebar.
- * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var el = wp.element.createElement;
- * var PanelBody = wp.components.PanelBody;
- * var PluginSidebar = wp.editSite.PluginSidebar;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function MyPluginSidebar() {
- * return el(
- * PluginSidebar,
- * {
- * name: 'my-sidebar',
- * title: 'My sidebar title',
- * icon: moreIcon,
- * },
- * el(
- * PanelBody,
- * {},
- * __( 'My sidebar content' )
- * )
- * );
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PanelBody } from '@wordpress/components';
- * import { PluginSidebar } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * const MyPluginSidebar = () => (
- * <PluginSidebar
- * name="my-sidebar"
- * title="My sidebar title"
- * icon={ more }
- * >
- * <PanelBody>
- * { __( 'My sidebar content' ) }
- * </PanelBody>
- * </PluginSidebar>
- * );
- * ```
- */
- function PluginSidebarEditSite(_ref) {
- let {
- className,
- ...props
- } = _ref;
- return (0,external_wp_element_namespaceObject.createElement)(complementary_area, extends_extends({
- panelClassName: className,
- className: "edit-site-sidebar",
- scope: "core/edit-site"
- }, props));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-sidebar-more-menu-item/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Renders a menu item in `Plugins` group in `More Menu` drop down,
- * and can be used to activate the corresponding `PluginSidebar` component.
- * The text within the component appears as the menu item label.
- *
- * @param {Object} props Component props.
- * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function MySidebarMoreMenuItem() {
- * return wp.element.createElement(
- * PluginSidebarMoreMenuItem,
- * {
- * target: 'my-sidebar',
- * icon: moreIcon,
- * },
- * __( 'My sidebar title' )
- * )
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * const MySidebarMoreMenuItem = () => (
- * <PluginSidebarMoreMenuItem
- * target="my-sidebar"
- * icon={ more }
- * >
- * { __( 'My sidebar title' ) }
- * </PluginSidebarMoreMenuItem>
- * );
- * ```
- *
- * @return {WPComponent} The component to be rendered.
- */
- function PluginSidebarMoreMenuItem(props) {
- return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
- // @see https://github.com/WordPress/gutenberg/issues/14457
- , extends_extends({
- __unstableExplicitMenuItem: true,
- scope: "core/edit-site"
- }, props));
- }
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-more-menu-item/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
- * The text within the component appears as the menu item label.
- *
- * @param {Object} props Component properties.
- * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
- * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
- * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
- *
- * @example
- * ```js
- * // Using ES5 syntax
- * var __ = wp.i18n.__;
- * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem;
- * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
- *
- * function onButtonClick() {
- * alert( 'Button clicked.' );
- * }
- *
- * function MyButtonMoreMenuItem() {
- * return wp.element.createElement(
- * PluginMoreMenuItem,
- * {
- * icon: moreIcon,
- * onClick: onButtonClick,
- * },
- * __( 'My button title' )
- * );
- * }
- * ```
- *
- * @example
- * ```jsx
- * // Using ESNext syntax
- * import { __ } from '@wordpress/i18n';
- * import { PluginMoreMenuItem } from '@wordpress/edit-site';
- * import { more } from '@wordpress/icons';
- *
- * function onButtonClick() {
- * alert( 'Button clicked.' );
- * }
- *
- * const MyButtonMoreMenuItem = () => (
- * <PluginMoreMenuItem
- * icon={ more }
- * onClick={ onButtonClick }
- * >
- * { __( 'My button title' ) }
- * </PluginMoreMenuItem>
- * );
- * ```
- *
- * @return {WPComponent} The component to be rendered.
- */
- /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
- var _ownProps$as;
- return {
- as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
- icon: ownProps.icon || context.icon,
- name: 'core/edit-site/plugin-more-menu'
- };
- }))(action_item));
- ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Reinitializes the editor after the user chooses to reboot the editor after
- * an unhandled error occurs, replacing previously mounted editor element using
- * an initial state from prior to the crash.
- *
- * @param {Element} target DOM node in which editor is rendered.
- * @param {?Object} settings Editor settings object.
- */
- function reinitializeEditor(target, settings) {
- // Display warning if editor wasn't able to resolve homepage template.
- if (!settings.__unstableHomeTemplate) {
- (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, {
- message: (0,external_wp_i18n_namespaceObject.__)('The editor is unable to find a block template for the homepage.'),
- dashboardLink: "index.php"
- }), target);
- return;
- } // This will be a no-op if the target doesn't have any React nodes.
- (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
- const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
- // so that we won't trigger unnecessary re-renders with useEffect.
- {
- (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', {
- editorMode: 'visual',
- fixedToolbar: false,
- focusMode: false,
- keepCaretInsideBlock: false,
- welcomeGuide: true,
- welcomeGuideStyles: true
- });
- (0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
- // so that they can be selected with core/editor selectors in any editor.
- // This is needed because edit-site doesn't initialize with EditorProvider,
- // which internally uses updateEditorSettings as well.
- (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({
- defaultTemplateTypes: settings.defaultTemplateTypes,
- defaultTemplatePartAreas: settings.defaultTemplatePartAreas
- });
- const isLandingOnListPage = getIsListPage((0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href));
- if (isLandingOnListPage) {
- // Default the navigation panel to be opened when we're in a bigger
- // screen and land in the list screen.
- (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsNavigationPanelOpened((0,external_wp_data_namespaceObject.select)(external_wp_viewport_namespaceObject.store).isViewportMatch('medium'));
- }
- }
- (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(EditSiteApp, {
- reboot: reboot
- }), target);
- }
- /**
- * Initializes the site editor screen.
- *
- * @param {string} id ID of the root element to render the screen in.
- * @param {Object} settings Editor settings.
- */
- function initializeEditor(id, settings) {
- settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
- settings.__experimentalFetchRichUrlData = external_wp_coreData_namespaceObject.__experimentalFetchUrlData;
- settings.__experimentalSpotlightEntityBlocks = ['core/template-part'];
- const target = document.getElementById(id);
- (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
- (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
- if (false) {}
- reinitializeEditor(target, settings);
- }
- }();
- (window.wp = window.wp || {}).editSite = __webpack_exports__;
- /******/ })()
- ;
|