strapi-admin-portal 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # Strapi Admin Portal
2
+
3
+ > The Portal Gun for Strapi Admin. Seamlessly mount React components into specific DOM selectors across any admin route.
4
+
5
+ ## Introduction
6
+
7
+ `strapi-admin-portal` allows you to inject React components into any part of the Strapi Admin interface using DOM selectors. While Strapi provides built-in injection zones, they don't cover every use case. This library gives you the power to place your custom components exactly where you need them—whether it's inside a specific form, next to a button, or in the sidebar—by targeting DOM elements directly.
8
+
9
+ It handles:
10
+ - **Route Monitoring**: Only specific components mount when the admin route matches.
11
+ - **Lazy Loading**: Components are loaded dynamically.
12
+ - **Context**: Injected components have access to the Strapi Redux store and configurations via wrapped providers.
13
+ - **Cleanup**: Automatically unmounts React roots to prevent memory leaks.
14
+
15
+ ## Requirements
16
+
17
+ - Strapi v5+ (This package uses the new admin APIs)
18
+ - React 17/18
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install strapi-admin-portal
24
+ # or
25
+ yarn add strapi-admin-portal
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ### 1. Initialize the Plugin
31
+
32
+ In your Strapi Admin's entry point (usually `src/admin/app.tsx` or `src/admin/app.js`), initialize the injection system during the `register` or `bootstrap` phase.
33
+
34
+ ```tsx
35
+ import type { StrapiApp } from '@strapi/strapi/admin';
36
+ import { initialiseInjections } from 'strapi-admin-portal';
37
+
38
+ export default {
39
+ config: {
40
+ locales: [],
41
+ },
42
+ bootstrap(app: StrapiApp) {
43
+ // Initialize the portal system and get the helper methods
44
+ const { registerRoute } = initialiseInjections(app);
45
+
46
+ // Register your custom injections here
47
+ registerRoute({
48
+ // 1. The admin route where the component should appear
49
+ route: '/me',
50
+
51
+ // 2. The CSS selector for the element to mount AFTER
52
+ // Warning: Selectors can be fragile if Strapi changes its internal DOM structure
53
+ selector: 'main form button[type="submit"]',
54
+
55
+ // 3. Dynamic import of your component
56
+ Component: () => import('./components/MyCustomButton'),
57
+ });
58
+ },
59
+ };
60
+ ```
61
+
62
+ ### 2. Creating an Injected Component
63
+
64
+ Your component is a standard React component. It will automatically be wrapped with Strapi's core providers (Store, Intl, etc.), so you can use standard hooks like `useIntl` or select from the store.
65
+
66
+ ```tsx
67
+ // src/admin/components/MyCustomButton.tsx
68
+ import React from 'react';
69
+ import { Button } from '@strapi/design-system';
70
+
71
+ const MyCustomButton = () => {
72
+ return (
73
+ <div style={{ marginTop: '1rem' }}>
74
+ <Button variant="secondary" onClick={() => alert('Clicked!')}>
75
+ Wait, I'm new here!
76
+ </Button>
77
+ </div>
78
+ );
79
+ };
80
+
81
+ export default MyCustomButton;
82
+ ```
83
+
84
+ ## API Reference
85
+
86
+ ### `initialiseInjections(app)`
87
+
88
+ Initializes the portal system on the Strapi app instance.
89
+
90
+ - **app**: The `StrapiApp` instance provided by `bootstrap` or `register`.
91
+ - **Returns**: An object containing `registerRoute`, `unregisterRoute`, and internal state accessors.
92
+
93
+ ### `registerRoute(options)`
94
+
95
+ Registers a component to be injected.
96
+
97
+ #### Options:
98
+
99
+ | Property | Type | Description |
100
+ |----------|------|-------------|
101
+ | `route` | `string` | The exact path in the admin panel to target (e.g., `/content-manager/collection-types/...`). |
102
+ | `selector` | `string` | A valid CSS selector. The library waits for this element to appear in the DOM and mounts your component **after** it. |
103
+ | `Component` | `() => Promise<any>` | A function that returns a dynamic import of your component. |
104
+ | `id` | `string` (optional) | A unique identifier. If not provided, one is generated. Useful if you need to programmatically unregister the route later. |
105
+
106
+ ### `unregisterRoute(id)`
107
+
108
+ Removes a registered injection route.
109
+
110
+ - **id**: The unique identifier of the route to remove.
111
+
112
+ ## Visual Example
113
+
114
+ Imagine you want to add a "Terms of Service" reminder below the "Save" button on the user profile page (`/me`).
115
+
116
+ 1. **Find the Selector**: Inspect the DOM on the `/me` page. Find the "Save" button. Let's say it's reachable via `form button[type="submit"]`.
117
+ 2. **Register**:
118
+ ```ts
119
+ registerRoute({
120
+ route: '/me',
121
+ selector: 'form button[type="submit"]',
122
+ Component: () => import('./components/TermsReminder'),
123
+ });
124
+ ```
125
+ 3. **Result**: When you navigate to `/me`, the library watches for the selector. Once found, it creates a new React root next to it and renders your component.
126
+
127
+ ## Caveats
128
+
129
+ - **DOM Fragility**: Because this library relies on CSS selectors to find insertion points, updates to Strapi's UI (class names, structure) might break your selectors. Always double-check your selectors when upgrading Strapi versions.
130
+ - **Performance**: The library uses `MutationObserver` to watch for DOM elements. While optimized, avoid watching broad selectors or having too many active watchers if possible.
131
+
132
+ ## License
133
+
134
+ MIT
@@ -0,0 +1,35 @@
1
+ import { Root } from 'react-dom/client';
2
+ import { StrapiApp } from '@strapi/strapi/admin';
3
+
4
+ type StrapiExtenedApp = StrapiApp & {
5
+ domInjections?: domInjectionsProps;
6
+ };
7
+ type InjectionRoute = InjectRouteOptions & {
8
+ id: string;
9
+ };
10
+ type InjectRouteOptions = {
11
+ id?: string;
12
+ route: string;
13
+ selector: string;
14
+ Component: () => Promise<{
15
+ default: React.ComponentType<unknown>;
16
+ }>;
17
+ };
18
+ interface domInjectionsProps {
19
+ routes: InjectionRoute[];
20
+ roots: Record<string, Root>;
21
+ registerRoute: (options: InjectRouteOptions) => void;
22
+ unregisterRoute: (id: string) => void;
23
+ getRoot: (id: string) => Root | undefined;
24
+ setRoot: (id: string, root: Root) => void;
25
+ removeRoot: (id: string) => void;
26
+ }
27
+
28
+ /**
29
+ * Initialise the injection system by adding the necessary properties and methods to the Strapi app instance
30
+ * @param app the Strapi app instance
31
+ * @returns the injection system object with methods to register and unregister injection routes
32
+ */
33
+ declare const initialiseInjections: (app: StrapiExtenedApp) => domInjectionsProps;
34
+
35
+ export { initialiseInjections };
@@ -0,0 +1,35 @@
1
+ import { Root } from 'react-dom/client';
2
+ import { StrapiApp } from '@strapi/strapi/admin';
3
+
4
+ type StrapiExtenedApp = StrapiApp & {
5
+ domInjections?: domInjectionsProps;
6
+ };
7
+ type InjectionRoute = InjectRouteOptions & {
8
+ id: string;
9
+ };
10
+ type InjectRouteOptions = {
11
+ id?: string;
12
+ route: string;
13
+ selector: string;
14
+ Component: () => Promise<{
15
+ default: React.ComponentType<unknown>;
16
+ }>;
17
+ };
18
+ interface domInjectionsProps {
19
+ routes: InjectionRoute[];
20
+ roots: Record<string, Root>;
21
+ registerRoute: (options: InjectRouteOptions) => void;
22
+ unregisterRoute: (id: string) => void;
23
+ getRoot: (id: string) => Root | undefined;
24
+ setRoot: (id: string, root: Root) => void;
25
+ removeRoot: (id: string) => void;
26
+ }
27
+
28
+ /**
29
+ * Initialise the injection system by adding the necessary properties and methods to the Strapi app instance
30
+ * @param app the Strapi app instance
31
+ * @returns the injection system object with methods to register and unregister injection routes
32
+ */
33
+ declare const initialiseInjections: (app: StrapiExtenedApp) => domInjectionsProps;
34
+
35
+ export { initialiseInjections };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var ni=Object.create;var G=Object.defineProperty;var ii=Object.getOwnPropertyDescriptor;var oi=Object.getOwnPropertyNames;var ai=Object.getPrototypeOf,si=Object.prototype.hasOwnProperty;var i=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),ui=(e,r)=>{for(var t in r)G(e,t,{get:r[t],enumerable:!0})},de=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of oi(r))!si.call(e,o)&&o!==t&&G(e,o,{get:()=>r[o],enumerable:!(n=ii(r,o))||n.enumerable});return e};var ci=(e,r,t)=>(t=e!=null?ni(ai(e)):{},de(r||!e||!e.__esModule?G(t,"default",{value:e,enumerable:!0}):t,e)),pi=e=>de(G({},"__esModule",{value:!0}),e);var B=i((op,ge)=>{"use strict";function fi(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}ge.exports=fi});var $=i((ap,he)=>{"use strict";function li(e){return e}he.exports=li});var me=i((sp,ye)=>{"use strict";var di=B(),ve=Math.max;function gi(e,r,t){return r=ve(r===void 0?e.length-1:r,0),function(){for(var n=arguments,o=-1,a=ve(n.length-r,0),u=Array(a);++o<a;)u[o]=n[r+o];o=-1;for(var s=Array(r+1);++o<r;)s[o]=n[o];return s[r]=t(u),di(e,this,s)}}ye.exports=gi});var qe=i((up,be)=>{"use strict";function hi(e){return function(){return e}}be.exports=hi});var K=i((cp,xe)=>{"use strict";var vi=typeof global=="object"&&global&&global.Object===Object&&global;xe.exports=vi});var v=i((pp,je)=>{"use strict";var yi=K(),mi=typeof self=="object"&&self&&self.Object===Object&&self,bi=yi||mi||Function("return this")();je.exports=bi});var V=i((fp,_e)=>{"use strict";var qi=v(),xi=qi.Symbol;_e.exports=xi});var Se=i((lp,Te)=>{"use strict";var Ie=V(),Oe=Object.prototype,ji=Oe.hasOwnProperty,_i=Oe.toString,S=Ie?Ie.toStringTag:void 0;function Ii(e){var r=ji.call(e,S),t=e[S];try{e[S]=void 0;var n=!0}catch{}var o=_i.call(e);return n&&(r?e[S]=t:delete e[S]),o}Te.exports=Ii});var Ae=i((dp,Pe)=>{"use strict";var Oi=Object.prototype,Ti=Oi.toString;function Si(e){return Ti.call(e)}Pe.exports=Si});var P=i((gp,Re)=>{"use strict";var we=V(),Pi=Se(),Ai=Ae(),wi="[object Null]",Ci="[object Undefined]",Ce=we?we.toStringTag:void 0;function Ri(e){return e==null?e===void 0?Ci:wi:Ce&&Ce in Object(e)?Pi(e):Ai(e)}Re.exports=Ri});var d=i((hp,Ee)=>{"use strict";function Ei(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}Ee.exports=Ei});var N=i((vp,Me)=>{"use strict";var Mi=P(),Di=d(),Li="[object AsyncFunction]",Fi="[object Function]",Gi="[object GeneratorFunction]",Ni="[object Proxy]";function zi(e){if(!Di(e))return!1;var r=Mi(e);return r==Fi||r==Gi||r==Li||r==Ni}Me.exports=zi});var Le=i((yp,De)=>{"use strict";var Ui=v(),Hi=Ui["__core-js_shared__"];De.exports=Hi});var Ne=i((mp,Ge)=>{"use strict";var W=Le(),Fe=(function(){var e=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Bi(e){return!!Fe&&Fe in e}Ge.exports=Bi});var Ue=i((bp,ze)=>{"use strict";var $i=Function.prototype,Ki=$i.toString;function Vi(e){if(e!=null){try{return Ki.call(e)}catch{}try{return e+""}catch{}}return""}ze.exports=Vi});var Be=i((qp,He)=>{"use strict";var Wi=N(),Ji=Ne(),Qi=d(),Xi=Ue(),Yi=/[\\^$.*+?()[\]{}|]/g,Zi=/^\[object .+?Constructor\]$/,ki=Function.prototype,eo=Object.prototype,ro=ki.toString,to=eo.hasOwnProperty,no=RegExp("^"+ro.call(to).replace(Yi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function io(e){if(!Qi(e)||Ji(e))return!1;var r=Wi(e)?no:Zi;return r.test(Xi(e))}He.exports=io});var Ke=i((xp,$e)=>{"use strict";function oo(e,r){return e?.[r]}$e.exports=oo});var z=i((jp,Ve)=>{"use strict";var ao=Be(),so=Ke();function uo(e,r){var t=so(e,r);return ao(t)?t:void 0}Ve.exports=uo});var J=i((_p,We)=>{"use strict";var co=z(),po=(function(){try{var e=co(Object,"defineProperty");return e({},"",{}),e}catch{}})();We.exports=po});var Xe=i((Ip,Qe)=>{"use strict";var fo=qe(),Je=J(),lo=$(),go=Je?function(e,r){return Je(e,"toString",{configurable:!0,enumerable:!1,value:fo(r),writable:!0})}:lo;Qe.exports=go});var Ze=i((Op,Ye)=>{"use strict";var ho=800,vo=16,yo=Date.now;function mo(e){var r=0,t=0;return function(){var n=yo(),o=vo-(n-t);if(t=n,o>0){if(++r>=ho)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}Ye.exports=mo});var er=i((Tp,ke)=>{"use strict";var bo=Xe(),qo=Ze(),xo=qo(bo);ke.exports=xo});var Q=i((Sp,rr)=>{"use strict";var jo=$(),_o=me(),Io=er();function Oo(e,r){return Io(_o(e,r,jo),e+"")}rr.exports=Oo});var nr=i((Pp,tr)=>{"use strict";function To(){this.__data__=[],this.size=0}tr.exports=To});var A=i((Ap,ir)=>{"use strict";function So(e,r){return e===r||e!==e&&r!==r}ir.exports=So});var w=i((wp,or)=>{"use strict";var Po=A();function Ao(e,r){for(var t=e.length;t--;)if(Po(e[t][0],r))return t;return-1}or.exports=Ao});var sr=i((Cp,ar)=>{"use strict";var wo=w(),Co=Array.prototype,Ro=Co.splice;function Eo(e){var r=this.__data__,t=wo(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():Ro.call(r,t,1),--this.size,!0}ar.exports=Eo});var cr=i((Rp,ur)=>{"use strict";var Mo=w();function Do(e){var r=this.__data__,t=Mo(r,e);return t<0?void 0:r[t][1]}ur.exports=Do});var fr=i((Ep,pr)=>{"use strict";var Lo=w();function Fo(e){return Lo(this.__data__,e)>-1}pr.exports=Fo});var dr=i((Mp,lr)=>{"use strict";var Go=w();function No(e,r){var t=this.__data__,n=Go(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}lr.exports=No});var C=i((Dp,gr)=>{"use strict";var zo=nr(),Uo=sr(),Ho=cr(),Bo=fr(),$o=dr();function m(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}m.prototype.clear=zo;m.prototype.delete=Uo;m.prototype.get=Ho;m.prototype.has=Bo;m.prototype.set=$o;gr.exports=m});var vr=i((Lp,hr)=>{"use strict";var Ko=C();function Vo(){this.__data__=new Ko,this.size=0}hr.exports=Vo});var mr=i((Fp,yr)=>{"use strict";function Wo(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}yr.exports=Wo});var qr=i((Gp,br)=>{"use strict";function Jo(e){return this.__data__.get(e)}br.exports=Jo});var jr=i((Np,xr)=>{"use strict";function Qo(e){return this.__data__.has(e)}xr.exports=Qo});var X=i((zp,_r)=>{"use strict";var Xo=z(),Yo=v(),Zo=Xo(Yo,"Map");_r.exports=Zo});var R=i((Up,Ir)=>{"use strict";var ko=z(),ea=ko(Object,"create");Ir.exports=ea});var Sr=i((Hp,Tr)=>{"use strict";var Or=R();function ra(){this.__data__=Or?Or(null):{},this.size=0}Tr.exports=ra});var Ar=i((Bp,Pr)=>{"use strict";function ta(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}Pr.exports=ta});var Cr=i(($p,wr)=>{"use strict";var na=R(),ia="__lodash_hash_undefined__",oa=Object.prototype,aa=oa.hasOwnProperty;function sa(e){var r=this.__data__;if(na){var t=r[e];return t===ia?void 0:t}return aa.call(r,e)?r[e]:void 0}wr.exports=sa});var Er=i((Kp,Rr)=>{"use strict";var ua=R(),ca=Object.prototype,pa=ca.hasOwnProperty;function fa(e){var r=this.__data__;return ua?r[e]!==void 0:pa.call(r,e)}Rr.exports=fa});var Dr=i((Vp,Mr)=>{"use strict";var la=R(),da="__lodash_hash_undefined__";function ga(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=la&&r===void 0?da:r,this}Mr.exports=ga});var Fr=i((Wp,Lr)=>{"use strict";var ha=Sr(),va=Ar(),ya=Cr(),ma=Er(),ba=Dr();function b(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}b.prototype.clear=ha;b.prototype.delete=va;b.prototype.get=ya;b.prototype.has=ma;b.prototype.set=ba;Lr.exports=b});var zr=i((Jp,Nr)=>{"use strict";var Gr=Fr(),qa=C(),xa=X();function ja(){this.size=0,this.__data__={hash:new Gr,map:new(xa||qa),string:new Gr}}Nr.exports=ja});var Hr=i((Qp,Ur)=>{"use strict";function _a(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}Ur.exports=_a});var E=i((Xp,Br)=>{"use strict";var Ia=Hr();function Oa(e,r){var t=e.__data__;return Ia(r)?t[typeof r=="string"?"string":"hash"]:t.map}Br.exports=Oa});var Kr=i((Yp,$r)=>{"use strict";var Ta=E();function Sa(e){var r=Ta(this,e).delete(e);return this.size-=r?1:0,r}$r.exports=Sa});var Wr=i((Zp,Vr)=>{"use strict";var Pa=E();function Aa(e){return Pa(this,e).get(e)}Vr.exports=Aa});var Qr=i((kp,Jr)=>{"use strict";var wa=E();function Ca(e){return wa(this,e).has(e)}Jr.exports=Ca});var Yr=i((ef,Xr)=>{"use strict";var Ra=E();function Ea(e,r){var t=Ra(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}Xr.exports=Ea});var kr=i((rf,Zr)=>{"use strict";var Ma=zr(),Da=Kr(),La=Wr(),Fa=Qr(),Ga=Yr();function q(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}q.prototype.clear=Ma;q.prototype.delete=Da;q.prototype.get=La;q.prototype.has=Fa;q.prototype.set=Ga;Zr.exports=q});var rt=i((tf,et)=>{"use strict";var Na=C(),za=X(),Ua=kr(),Ha=200;function Ba(e,r){var t=this.__data__;if(t instanceof Na){var n=t.__data__;if(!za||n.length<Ha-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new Ua(n)}return t.set(e,r),this.size=t.size,this}et.exports=Ba});var nt=i((nf,tt)=>{"use strict";var $a=C(),Ka=vr(),Va=mr(),Wa=qr(),Ja=jr(),Qa=rt();function x(e){var r=this.__data__=new $a(e);this.size=r.size}x.prototype.clear=Ka;x.prototype.delete=Va;x.prototype.get=Wa;x.prototype.has=Ja;x.prototype.set=Qa;tt.exports=x});var U=i((of,ot)=>{"use strict";var it=J();function Xa(e,r,t){r=="__proto__"&&it?it(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}ot.exports=Xa});var Y=i((af,at)=>{"use strict";var Ya=U(),Za=A();function ka(e,r,t){(t!==void 0&&!Za(e[r],t)||t===void 0&&!(r in e))&&Ya(e,r,t)}at.exports=ka});var ut=i((sf,st)=>{"use strict";function es(e){return function(r,t,n){for(var o=-1,a=Object(r),u=n(r),s=u.length;s--;){var c=u[e?s:++o];if(t(a[c],c,a)===!1)break}return r}}st.exports=es});var pt=i((uf,ct)=>{"use strict";var rs=ut(),ts=rs();ct.exports=ts});var ht=i((M,j)=>{"use strict";var ns=v(),gt=typeof M=="object"&&M&&!M.nodeType&&M,ft=gt&&typeof j=="object"&&j&&!j.nodeType&&j,is=ft&&ft.exports===gt,lt=is?ns.Buffer:void 0,dt=lt?lt.allocUnsafe:void 0;function os(e,r){if(r)return e.slice();var t=e.length,n=dt?dt(t):new e.constructor(t);return e.copy(n),n}j.exports=os});var yt=i((cf,vt)=>{"use strict";var as=v(),ss=as.Uint8Array;vt.exports=ss});var qt=i((pf,bt)=>{"use strict";var mt=yt();function us(e){var r=new e.constructor(e.byteLength);return new mt(r).set(new mt(e)),r}bt.exports=us});var jt=i((ff,xt)=>{"use strict";var cs=qt();function ps(e,r){var t=r?cs(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}xt.exports=ps});var It=i((lf,_t)=>{"use strict";function fs(e,r){var t=-1,n=e.length;for(r||(r=Array(n));++t<n;)r[t]=e[t];return r}_t.exports=fs});var St=i((df,Tt)=>{"use strict";var ls=d(),Ot=Object.create,ds=(function(){function e(){}return function(r){if(!ls(r))return{};if(Ot)return Ot(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}})();Tt.exports=ds});var At=i((gf,Pt)=>{"use strict";function gs(e,r){return function(t){return e(r(t))}}Pt.exports=gs});var Z=i((hf,wt)=>{"use strict";var hs=At(),vs=hs(Object.getPrototypeOf,Object);wt.exports=vs});var k=i((vf,Ct)=>{"use strict";var ys=Object.prototype;function ms(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||ys;return e===t}Ct.exports=ms});var Et=i((yf,Rt)=>{"use strict";var bs=St(),qs=Z(),xs=k();function js(e){return typeof e.constructor=="function"&&!xs(e)?bs(qs(e)):{}}Rt.exports=js});var _=i((mf,Mt)=>{"use strict";function _s(e){return e!=null&&typeof e=="object"}Mt.exports=_s});var Lt=i((bf,Dt)=>{"use strict";var Is=P(),Os=_(),Ts="[object Arguments]";function Ss(e){return Os(e)&&Is(e)==Ts}Dt.exports=Ss});var ee=i((qf,Nt)=>{"use strict";var Ft=Lt(),Ps=_(),Gt=Object.prototype,As=Gt.hasOwnProperty,ws=Gt.propertyIsEnumerable,Cs=Ft((function(){return arguments})())?Ft:function(e){return Ps(e)&&As.call(e,"callee")&&!ws.call(e,"callee")};Nt.exports=Cs});var re=i((xf,zt)=>{"use strict";var Rs=Array.isArray;zt.exports=Rs});var te=i((jf,Ut)=>{"use strict";var Es=9007199254740991;function Ms(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Es}Ut.exports=Ms});var H=i((_f,Ht)=>{"use strict";var Ds=N(),Ls=te();function Fs(e){return e!=null&&Ls(e.length)&&!Ds(e)}Ht.exports=Fs});var $t=i((If,Bt)=>{"use strict";var Gs=H(),Ns=_();function zs(e){return Ns(e)&&Gs(e)}Bt.exports=zs});var Vt=i((Of,Kt)=>{"use strict";function Us(){return!1}Kt.exports=Us});var ne=i((D,I)=>{"use strict";var Hs=v(),Bs=Vt(),Qt=typeof D=="object"&&D&&!D.nodeType&&D,Wt=Qt&&typeof I=="object"&&I&&!I.nodeType&&I,$s=Wt&&Wt.exports===Qt,Jt=$s?Hs.Buffer:void 0,Ks=Jt?Jt.isBuffer:void 0,Vs=Ks||Bs;I.exports=Vs});var Zt=i((Tf,Yt)=>{"use strict";var Ws=P(),Js=Z(),Qs=_(),Xs="[object Object]",Ys=Function.prototype,Zs=Object.prototype,Xt=Ys.toString,ks=Zs.hasOwnProperty,eu=Xt.call(Object);function ru(e){if(!Qs(e)||Ws(e)!=Xs)return!1;var r=Js(e);if(r===null)return!0;var t=ks.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Xt.call(t)==eu}Yt.exports=ru});var en=i((Sf,kt)=>{"use strict";var tu=P(),nu=te(),iu=_(),ou="[object Arguments]",au="[object Array]",su="[object Boolean]",uu="[object Date]",cu="[object Error]",pu="[object Function]",fu="[object Map]",lu="[object Number]",du="[object Object]",gu="[object RegExp]",hu="[object Set]",vu="[object String]",yu="[object WeakMap]",mu="[object ArrayBuffer]",bu="[object DataView]",qu="[object Float32Array]",xu="[object Float64Array]",ju="[object Int8Array]",_u="[object Int16Array]",Iu="[object Int32Array]",Ou="[object Uint8Array]",Tu="[object Uint8ClampedArray]",Su="[object Uint16Array]",Pu="[object Uint32Array]",p={};p[qu]=p[xu]=p[ju]=p[_u]=p[Iu]=p[Ou]=p[Tu]=p[Su]=p[Pu]=!0;p[ou]=p[au]=p[mu]=p[su]=p[bu]=p[uu]=p[cu]=p[pu]=p[fu]=p[lu]=p[du]=p[gu]=p[hu]=p[vu]=p[yu]=!1;function Au(e){return iu(e)&&nu(e.length)&&!!p[tu(e)]}kt.exports=Au});var tn=i((Pf,rn)=>{"use strict";function wu(e){return function(r){return e(r)}}rn.exports=wu});var on=i((L,O)=>{"use strict";var Cu=K(),nn=typeof L=="object"&&L&&!L.nodeType&&L,F=nn&&typeof O=="object"&&O&&!O.nodeType&&O,Ru=F&&F.exports===nn,ie=Ru&&Cu.process,Eu=(function(){try{var e=F&&F.require&&F.require("util").types;return e||ie&&ie.binding&&ie.binding("util")}catch{}})();O.exports=Eu});var oe=i((Af,un)=>{"use strict";var Mu=en(),Du=tn(),an=on(),sn=an&&an.isTypedArray,Lu=sn?Du(sn):Mu;un.exports=Lu});var ae=i((wf,cn)=>{"use strict";function Fu(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}cn.exports=Fu});var fn=i((Cf,pn)=>{"use strict";var Gu=U(),Nu=A(),zu=Object.prototype,Uu=zu.hasOwnProperty;function Hu(e,r,t){var n=e[r];(!(Uu.call(e,r)&&Nu(n,t))||t===void 0&&!(r in e))&&Gu(e,r,t)}pn.exports=Hu});var dn=i((Rf,ln)=>{"use strict";var Bu=fn(),$u=U();function Ku(e,r,t,n){var o=!t;t||(t={});for(var a=-1,u=r.length;++a<u;){var s=r[a],c=n?n(t[s],e[s],s,t,e):void 0;c===void 0&&(c=e[s]),o?$u(t,s,c):Bu(t,s,c)}return t}ln.exports=Ku});var hn=i((Ef,gn)=>{"use strict";function Vu(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}gn.exports=Vu});var se=i((Mf,vn)=>{"use strict";var Wu=9007199254740991,Ju=/^(?:0|[1-9]\d*)$/;function Qu(e,r){var t=typeof e;return r=r??Wu,!!r&&(t=="number"||t!="symbol"&&Ju.test(e))&&e>-1&&e%1==0&&e<r}vn.exports=Qu});var mn=i((Df,yn)=>{"use strict";var Xu=hn(),Yu=ee(),Zu=re(),ku=ne(),ec=se(),rc=oe(),tc=Object.prototype,nc=tc.hasOwnProperty;function ic(e,r){var t=Zu(e),n=!t&&Yu(e),o=!t&&!n&&ku(e),a=!t&&!n&&!o&&rc(e),u=t||n||o||a,s=u?Xu(e.length,String):[],c=s.length;for(var l in e)(r||nc.call(e,l))&&!(u&&(l=="length"||o&&(l=="offset"||l=="parent")||a&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||ec(l,c)))&&s.push(l);return s}yn.exports=ic});var qn=i((Lf,bn)=>{"use strict";function oc(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}bn.exports=oc});var jn=i((Ff,xn)=>{"use strict";var ac=d(),sc=k(),uc=qn(),cc=Object.prototype,pc=cc.hasOwnProperty;function fc(e){if(!ac(e))return uc(e);var r=sc(e),t=[];for(var n in e)n=="constructor"&&(r||!pc.call(e,n))||t.push(n);return t}xn.exports=fc});var ue=i((Gf,_n)=>{"use strict";var lc=mn(),dc=jn(),gc=H();function hc(e){return gc(e)?lc(e,!0):dc(e)}_n.exports=hc});var On=i((Nf,In)=>{"use strict";var vc=dn(),yc=ue();function mc(e){return vc(e,yc(e))}In.exports=mc});var Cn=i((zf,wn)=>{"use strict";var Tn=Y(),bc=ht(),qc=jt(),xc=It(),jc=Et(),Sn=ee(),Pn=re(),_c=$t(),Ic=ne(),Oc=N(),Tc=d(),Sc=Zt(),Pc=oe(),An=ae(),Ac=On();function wc(e,r,t,n,o,a,u){var s=An(e,t),c=An(r,t),l=u.get(c);if(l){Tn(e,t,l);return}var f=a?a(s,c,t+"",e,r,u):void 0,h=f===void 0;if(h){var y=Pn(c),T=!y&&Ic(c),le=!y&&!T&&Pc(c);f=c,y||T||le?Pn(s)?f=s:_c(s)?f=xc(s):T?(h=!1,f=bc(c,!0)):le?(h=!1,f=qc(c,!0)):f=[]:Sc(c)||Sn(c)?(f=s,Sn(s)?f=Ac(s):(!Tc(s)||Oc(s))&&(f=jc(c))):h=!1}h&&(u.set(c,f),o(f,c,n,a,u),u.delete(c)),Tn(e,t,f)}wn.exports=wc});var ce=i((Uf,En)=>{"use strict";var Cc=nt(),Rc=Y(),Ec=pt(),Mc=Cn(),Dc=d(),Lc=ue(),Fc=ae();function Rn(e,r,t,n,o){e!==r&&Ec(r,function(a,u){if(o||(o=new Cc),Dc(a))Mc(e,r,u,t,Rn,n,o);else{var s=n?n(Fc(e,u),a,u+"",e,r,o):void 0;s===void 0&&(s=a),Rc(e,u,s)}},Lc)}En.exports=Rn});var Fn=i((Hf,Ln)=>{"use strict";var Gc=ce(),Mn=d();function Dn(e,r,t,n,o,a){return Mn(e)&&Mn(r)&&(a.set(r,e),Gc(e,r,void 0,Dn,a),a.delete(r)),e}Ln.exports=Dn});var Nn=i((Bf,Gn)=>{"use strict";var Nc=A(),zc=H(),Uc=se(),Hc=d();function Bc(e,r,t){if(!Hc(t))return!1;var n=typeof r;return(n=="number"?zc(t)&&Uc(r,t.length):n=="string"&&r in t)?Nc(t[r],e):!1}Gn.exports=Bc});var Un=i(($f,zn)=>{"use strict";var $c=Q(),Kc=Nn();function Vc(e){return $c(function(r,t){var n=-1,o=t.length,a=o>1?t[o-1]:void 0,u=o>2?t[2]:void 0;for(a=e.length>3&&typeof a=="function"?(o--,a):void 0,u&&Kc(t[0],t[1],u)&&(a=o<3?void 0:a,o=1),r=Object(r);++n<o;){var s=t[n];s&&e(r,s,n,a)}return r})}zn.exports=Vc});var Bn=i((Kf,Hn)=>{"use strict";var Wc=ce(),Jc=Un(),Qc=Jc(function(e,r,t,n){Wc(e,r,t,n)});Hn.exports=Qc});var Kn=i((Vf,$n)=>{"use strict";var Xc=B(),Yc=Q(),Zc=Fn(),kc=Bn(),ep=Yc(function(e){return e.push(void 0,Zc),Xc(kc,void 0,e)});$n.exports=ep});var np={};ui(np,{initialiseInjections:()=>tp});module.exports=pi(np);var Xn=require("react-dom/client");var g=require("react"),Vn=require("react-intl"),Wn=require("@strapi/design-system"),Jn=ci(Kn()),pe=require("react/jsx-runtime"),rp=({children:e,store:r,configurations:t})=>{let n=(0,g.useSyncExternalStore)(r.subscribe,r.getState),o=n.admin_app.theme.currentTheme||"light",a=n.admin_app.language.locale||"en",u=t.translations||{},[s,c]=(0,g.useState)(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");(0,g.useEffect)(()=>{let h=matchMedia("(prefers-color-scheme: dark)"),y=T=>{c(T.matches?"dark":"light")};return h.addEventListener("change",y),()=>h.removeEventListener("change",y)},[]);let l=(0,g.useMemo)(()=>(0,Jn.default)(u[a],u.en),[a,u]),f=(0,g.useMemo)(()=>t.themes[o==="system"?s:o],[o,s,t.themes]);return(0,pe.jsx)(Wn.DesignSystemProvider,{theme:f,locale:a,children:(0,pe.jsx)(Vn.IntlProvider,{locale:a,messages:l,children:e})})},Qn=rp;var fe=require("react/jsx-runtime"),Yn=async(e,r,t)=>{let n=r.domInjections;if(!n){console.warn("Injection system not initialised. Please call initialiseInjections(app) before registering injection routes.");return}if(document.querySelector(`#${t.id}`)||n.removeRoot(t.id),e.location.pathname!==t.route)return;let a=t.Component(),u=await Zn(t.selector);if(!u||window.location.pathname!==t.route)return;if(!n.getRoot(t.id)){let f=document.getElementById(t.id);f||(f=document.createElement("div"),f.id=t.id,u.after(f)),n.setRoot(t.id,(0,Xn.createRoot)(f))}let c=(await a).default,l=n.getRoot(t.id);l&&l.render((0,fe.jsx)(Qn,{store:r.store,configurations:r.configurations,children:(0,fe.jsx)(c,{})}))};var ei=async e=>{let r=e.router,t=0;for(;!r?.router?.state?.location&&t<100;)await new Promise(n=>setTimeout(n,10)),t++;if(!r?.router?.state?.location){console.warn("Strapi router not ready after 5s, skipping injection initialization.");return}r.router.subscribe(n=>kn(n,e)),kn(r.router.state,e)},kn=(e,r)=>{let t=r.domInjections?.routes||[];Promise.all(t.map(n=>Yn(e,r,n)))},Zn=(e,r=5e3)=>new Promise(t=>{let n=document.querySelector(e);if(n)return t(n);let o=new MutationObserver(()=>{let a=document.querySelector(e);a&&(o.disconnect(),t(a))});o.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{o.disconnect(),t(null)},r)}),ri=(e,r)=>{if(!r.domInjections?.routes){console.warn("Injection system not initialised. Please call initialiseInjections(app) before registering injection routes.");return}let{id:t,...n}=e;if(t&&r.domInjections.routes.some(a=>a.id===t)){console.warn(`Injection route with id ${t} already exists. Skipping registration.`);return}let o=t||`injection-${Math.random().toString(36).substring(2,9)}`;r.domInjections.routes.push({id:o,...n})},ti=(e,r)=>{if(!r.domInjections?.routes){console.warn("Injection system not initialised. Please call initialiseInjections(app) before unregistering injection routes.");return}let t=r.domInjections.routes.findIndex(n=>n.id===e);if(t===-1){console.warn(`Injection route with id ${e} does not exist. Skipping unregistration.`);return}r.domInjections.routes.splice(t,1),r.domInjections.removeRoot(e)};var tp=e=>{let r=e.domInjections;if(r)return r;ei(e);let t={routes:[],roots:{},registerRoute:n=>ri(n,e),unregisterRoute:n=>ti(n,e),getRoot:n=>e.domInjections?.roots[n],setRoot:(n,o)=>{e.domInjections&&(e.domInjections.roots[n]=o)},removeRoot:n=>{if(!e.domInjections)return;let o=e.domInjections.roots[n];o&&(setTimeout(()=>o.unmount(),0),delete e.domInjections.roots[n])}};return e.domInjections=t,t};0&&(module.exports={initialiseInjections});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var kn=Object.create;var ce=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var ri=Object.getOwnPropertyNames;var ti=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty;var i=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ii=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of ri(r))!ni.call(e,o)&&o!==t&&ce(e,o,{get:()=>r[o],enumerable:!(n=ei(r,o))||n.enumerable});return e};var oi=(e,r,t)=>(t=e!=null?kn(ti(e)):{},ii(r||!e||!e.__esModule?ce(t,"default",{value:e,enumerable:!0}):t,e));var U=i((ip,pe)=>{"use strict";function ai(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}pe.exports=ai});var H=i((op,fe)=>{"use strict";function si(e){return e}fe.exports=si});var ge=i((ap,de)=>{"use strict";var ui=U(),le=Math.max;function ci(e,r,t){return r=le(r===void 0?e.length-1:r,0),function(){for(var n=arguments,o=-1,a=le(n.length-r,0),u=Array(a);++o<a;)u[o]=n[r+o];o=-1;for(var s=Array(r+1);++o<r;)s[o]=n[o];return s[r]=t(u),ui(e,this,s)}}de.exports=ci});var ve=i((sp,he)=>{"use strict";function pi(e){return function(){return e}}he.exports=pi});var B=i((up,ye)=>{"use strict";var fi=typeof global=="object"&&global&&global.Object===Object&&global;ye.exports=fi});var h=i((cp,me)=>{"use strict";var li=B(),di=typeof self=="object"&&self&&self.Object===Object&&self,gi=li||di||Function("return this")();me.exports=gi});var $=i((pp,be)=>{"use strict";var hi=h(),vi=hi.Symbol;be.exports=vi});var _e=i((fp,je)=>{"use strict";var qe=$(),xe=Object.prototype,yi=xe.hasOwnProperty,mi=xe.toString,T=qe?qe.toStringTag:void 0;function bi(e){var r=yi.call(e,T),t=e[T];try{e[T]=void 0;var n=!0}catch{}var o=mi.call(e);return n&&(r?e[T]=t:delete e[T]),o}je.exports=bi});var Oe=i((lp,Ie)=>{"use strict";var qi=Object.prototype,xi=qi.toString;function ji(e){return xi.call(e)}Ie.exports=ji});var S=i((dp,Pe)=>{"use strict";var Te=$(),_i=_e(),Ii=Oe(),Oi="[object Null]",Ti="[object Undefined]",Se=Te?Te.toStringTag:void 0;function Si(e){return e==null?e===void 0?Ti:Oi:Se&&Se in Object(e)?_i(e):Ii(e)}Pe.exports=Si});var d=i((gp,Ae)=>{"use strict";function Pi(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}Ae.exports=Pi});var F=i((hp,we)=>{"use strict";var Ai=S(),wi=d(),Ci="[object AsyncFunction]",Ri="[object Function]",Ei="[object GeneratorFunction]",Mi="[object Proxy]";function Di(e){if(!wi(e))return!1;var r=Ai(e);return r==Ri||r==Ei||r==Ci||r==Mi}we.exports=Di});var Re=i((vp,Ce)=>{"use strict";var Li=h(),Fi=Li["__core-js_shared__"];Ce.exports=Fi});var De=i((yp,Me)=>{"use strict";var K=Re(),Ee=(function(){var e=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Gi(e){return!!Ee&&Ee in e}Me.exports=Gi});var Fe=i((mp,Le)=>{"use strict";var Ni=Function.prototype,zi=Ni.toString;function Ui(e){if(e!=null){try{return zi.call(e)}catch{}try{return e+""}catch{}}return""}Le.exports=Ui});var Ne=i((bp,Ge)=>{"use strict";var Hi=F(),Bi=De(),$i=d(),Ki=Fe(),Vi=/[\\^$.*+?()[\]{}|]/g,Wi=/^\[object .+?Constructor\]$/,Ji=Function.prototype,Qi=Object.prototype,Xi=Ji.toString,Yi=Qi.hasOwnProperty,Zi=RegExp("^"+Xi.call(Yi).replace(Vi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ki(e){if(!$i(e)||Bi(e))return!1;var r=Hi(e)?Zi:Wi;return r.test(Ki(e))}Ge.exports=ki});var Ue=i((qp,ze)=>{"use strict";function eo(e,r){return e?.[r]}ze.exports=eo});var G=i((xp,He)=>{"use strict";var ro=Ne(),to=Ue();function no(e,r){var t=to(e,r);return ro(t)?t:void 0}He.exports=no});var V=i((jp,Be)=>{"use strict";var io=G(),oo=(function(){try{var e=io(Object,"defineProperty");return e({},"",{}),e}catch{}})();Be.exports=oo});var Ve=i((_p,Ke)=>{"use strict";var ao=ve(),$e=V(),so=H(),uo=$e?function(e,r){return $e(e,"toString",{configurable:!0,enumerable:!1,value:ao(r),writable:!0})}:so;Ke.exports=uo});var Je=i((Ip,We)=>{"use strict";var co=800,po=16,fo=Date.now;function lo(e){var r=0,t=0;return function(){var n=fo(),o=po-(n-t);if(t=n,o>0){if(++r>=co)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}We.exports=lo});var Xe=i((Op,Qe)=>{"use strict";var go=Ve(),ho=Je(),vo=ho(go);Qe.exports=vo});var W=i((Tp,Ye)=>{"use strict";var yo=H(),mo=ge(),bo=Xe();function qo(e,r){return bo(mo(e,r,yo),e+"")}Ye.exports=qo});var ke=i((Sp,Ze)=>{"use strict";function xo(){this.__data__=[],this.size=0}Ze.exports=xo});var P=i((Pp,er)=>{"use strict";function jo(e,r){return e===r||e!==e&&r!==r}er.exports=jo});var A=i((Ap,rr)=>{"use strict";var _o=P();function Io(e,r){for(var t=e.length;t--;)if(_o(e[t][0],r))return t;return-1}rr.exports=Io});var nr=i((wp,tr)=>{"use strict";var Oo=A(),To=Array.prototype,So=To.splice;function Po(e){var r=this.__data__,t=Oo(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():So.call(r,t,1),--this.size,!0}tr.exports=Po});var or=i((Cp,ir)=>{"use strict";var Ao=A();function wo(e){var r=this.__data__,t=Ao(r,e);return t<0?void 0:r[t][1]}ir.exports=wo});var sr=i((Rp,ar)=>{"use strict";var Co=A();function Ro(e){return Co(this.__data__,e)>-1}ar.exports=Ro});var cr=i((Ep,ur)=>{"use strict";var Eo=A();function Mo(e,r){var t=this.__data__,n=Eo(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}ur.exports=Mo});var w=i((Mp,pr)=>{"use strict";var Do=ke(),Lo=nr(),Fo=or(),Go=sr(),No=cr();function y(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}y.prototype.clear=Do;y.prototype.delete=Lo;y.prototype.get=Fo;y.prototype.has=Go;y.prototype.set=No;pr.exports=y});var lr=i((Dp,fr)=>{"use strict";var zo=w();function Uo(){this.__data__=new zo,this.size=0}fr.exports=Uo});var gr=i((Lp,dr)=>{"use strict";function Ho(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}dr.exports=Ho});var vr=i((Fp,hr)=>{"use strict";function Bo(e){return this.__data__.get(e)}hr.exports=Bo});var mr=i((Gp,yr)=>{"use strict";function $o(e){return this.__data__.has(e)}yr.exports=$o});var J=i((Np,br)=>{"use strict";var Ko=G(),Vo=h(),Wo=Ko(Vo,"Map");br.exports=Wo});var C=i((zp,qr)=>{"use strict";var Jo=G(),Qo=Jo(Object,"create");qr.exports=Qo});var _r=i((Up,jr)=>{"use strict";var xr=C();function Xo(){this.__data__=xr?xr(null):{},this.size=0}jr.exports=Xo});var Or=i((Hp,Ir)=>{"use strict";function Yo(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}Ir.exports=Yo});var Sr=i((Bp,Tr)=>{"use strict";var Zo=C(),ko="__lodash_hash_undefined__",ea=Object.prototype,ra=ea.hasOwnProperty;function ta(e){var r=this.__data__;if(Zo){var t=r[e];return t===ko?void 0:t}return ra.call(r,e)?r[e]:void 0}Tr.exports=ta});var Ar=i(($p,Pr)=>{"use strict";var na=C(),ia=Object.prototype,oa=ia.hasOwnProperty;function aa(e){var r=this.__data__;return na?r[e]!==void 0:oa.call(r,e)}Pr.exports=aa});var Cr=i((Kp,wr)=>{"use strict";var sa=C(),ua="__lodash_hash_undefined__";function ca(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=sa&&r===void 0?ua:r,this}wr.exports=ca});var Er=i((Vp,Rr)=>{"use strict";var pa=_r(),fa=Or(),la=Sr(),da=Ar(),ga=Cr();function m(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}m.prototype.clear=pa;m.prototype.delete=fa;m.prototype.get=la;m.prototype.has=da;m.prototype.set=ga;Rr.exports=m});var Lr=i((Wp,Dr)=>{"use strict";var Mr=Er(),ha=w(),va=J();function ya(){this.size=0,this.__data__={hash:new Mr,map:new(va||ha),string:new Mr}}Dr.exports=ya});var Gr=i((Jp,Fr)=>{"use strict";function ma(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}Fr.exports=ma});var R=i((Qp,Nr)=>{"use strict";var ba=Gr();function qa(e,r){var t=e.__data__;return ba(r)?t[typeof r=="string"?"string":"hash"]:t.map}Nr.exports=qa});var Ur=i((Xp,zr)=>{"use strict";var xa=R();function ja(e){var r=xa(this,e).delete(e);return this.size-=r?1:0,r}zr.exports=ja});var Br=i((Yp,Hr)=>{"use strict";var _a=R();function Ia(e){return _a(this,e).get(e)}Hr.exports=Ia});var Kr=i((Zp,$r)=>{"use strict";var Oa=R();function Ta(e){return Oa(this,e).has(e)}$r.exports=Ta});var Wr=i((kp,Vr)=>{"use strict";var Sa=R();function Pa(e,r){var t=Sa(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}Vr.exports=Pa});var Qr=i((ef,Jr)=>{"use strict";var Aa=Lr(),wa=Ur(),Ca=Br(),Ra=Kr(),Ea=Wr();function b(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}b.prototype.clear=Aa;b.prototype.delete=wa;b.prototype.get=Ca;b.prototype.has=Ra;b.prototype.set=Ea;Jr.exports=b});var Yr=i((rf,Xr)=>{"use strict";var Ma=w(),Da=J(),La=Qr(),Fa=200;function Ga(e,r){var t=this.__data__;if(t instanceof Ma){var n=t.__data__;if(!Da||n.length<Fa-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new La(n)}return t.set(e,r),this.size=t.size,this}Xr.exports=Ga});var kr=i((tf,Zr)=>{"use strict";var Na=w(),za=lr(),Ua=gr(),Ha=vr(),Ba=mr(),$a=Yr();function q(e){var r=this.__data__=new Na(e);this.size=r.size}q.prototype.clear=za;q.prototype.delete=Ua;q.prototype.get=Ha;q.prototype.has=Ba;q.prototype.set=$a;Zr.exports=q});var N=i((nf,rt)=>{"use strict";var et=V();function Ka(e,r,t){r=="__proto__"&&et?et(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}rt.exports=Ka});var Q=i((of,tt)=>{"use strict";var Va=N(),Wa=P();function Ja(e,r,t){(t!==void 0&&!Wa(e[r],t)||t===void 0&&!(r in e))&&Va(e,r,t)}tt.exports=Ja});var it=i((af,nt)=>{"use strict";function Qa(e){return function(r,t,n){for(var o=-1,a=Object(r),u=n(r),s=u.length;s--;){var c=u[e?s:++o];if(t(a[c],c,a)===!1)break}return r}}nt.exports=Qa});var at=i((sf,ot)=>{"use strict";var Xa=it(),Ya=Xa();ot.exports=Ya});var ft=i((E,x)=>{"use strict";var Za=h(),pt=typeof E=="object"&&E&&!E.nodeType&&E,st=pt&&typeof x=="object"&&x&&!x.nodeType&&x,ka=st&&st.exports===pt,ut=ka?Za.Buffer:void 0,ct=ut?ut.allocUnsafe:void 0;function es(e,r){if(r)return e.slice();var t=e.length,n=ct?ct(t):new e.constructor(t);return e.copy(n),n}x.exports=es});var dt=i((uf,lt)=>{"use strict";var rs=h(),ts=rs.Uint8Array;lt.exports=ts});var vt=i((cf,ht)=>{"use strict";var gt=dt();function ns(e){var r=new e.constructor(e.byteLength);return new gt(r).set(new gt(e)),r}ht.exports=ns});var mt=i((pf,yt)=>{"use strict";var is=vt();function os(e,r){var t=r?is(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}yt.exports=os});var qt=i((ff,bt)=>{"use strict";function as(e,r){var t=-1,n=e.length;for(r||(r=Array(n));++t<n;)r[t]=e[t];return r}bt.exports=as});var _t=i((lf,jt)=>{"use strict";var ss=d(),xt=Object.create,us=(function(){function e(){}return function(r){if(!ss(r))return{};if(xt)return xt(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}})();jt.exports=us});var Ot=i((df,It)=>{"use strict";function cs(e,r){return function(t){return e(r(t))}}It.exports=cs});var X=i((gf,Tt)=>{"use strict";var ps=Ot(),fs=ps(Object.getPrototypeOf,Object);Tt.exports=fs});var Y=i((hf,St)=>{"use strict";var ls=Object.prototype;function ds(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||ls;return e===t}St.exports=ds});var At=i((vf,Pt)=>{"use strict";var gs=_t(),hs=X(),vs=Y();function ys(e){return typeof e.constructor=="function"&&!vs(e)?gs(hs(e)):{}}Pt.exports=ys});var j=i((yf,wt)=>{"use strict";function ms(e){return e!=null&&typeof e=="object"}wt.exports=ms});var Rt=i((mf,Ct)=>{"use strict";var bs=S(),qs=j(),xs="[object Arguments]";function js(e){return qs(e)&&bs(e)==xs}Ct.exports=js});var Z=i((bf,Dt)=>{"use strict";var Et=Rt(),_s=j(),Mt=Object.prototype,Is=Mt.hasOwnProperty,Os=Mt.propertyIsEnumerable,Ts=Et((function(){return arguments})())?Et:function(e){return _s(e)&&Is.call(e,"callee")&&!Os.call(e,"callee")};Dt.exports=Ts});var k=i((qf,Lt)=>{"use strict";var Ss=Array.isArray;Lt.exports=Ss});var ee=i((xf,Ft)=>{"use strict";var Ps=9007199254740991;function As(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ps}Ft.exports=As});var z=i((jf,Gt)=>{"use strict";var ws=F(),Cs=ee();function Rs(e){return e!=null&&Cs(e.length)&&!ws(e)}Gt.exports=Rs});var zt=i((_f,Nt)=>{"use strict";var Es=z(),Ms=j();function Ds(e){return Ms(e)&&Es(e)}Nt.exports=Ds});var Ht=i((If,Ut)=>{"use strict";function Ls(){return!1}Ut.exports=Ls});var re=i((M,_)=>{"use strict";var Fs=h(),Gs=Ht(),Kt=typeof M=="object"&&M&&!M.nodeType&&M,Bt=Kt&&typeof _=="object"&&_&&!_.nodeType&&_,Ns=Bt&&Bt.exports===Kt,$t=Ns?Fs.Buffer:void 0,zs=$t?$t.isBuffer:void 0,Us=zs||Gs;_.exports=Us});var Jt=i((Of,Wt)=>{"use strict";var Hs=S(),Bs=X(),$s=j(),Ks="[object Object]",Vs=Function.prototype,Ws=Object.prototype,Vt=Vs.toString,Js=Ws.hasOwnProperty,Qs=Vt.call(Object);function Xs(e){if(!$s(e)||Hs(e)!=Ks)return!1;var r=Bs(e);if(r===null)return!0;var t=Js.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Vt.call(t)==Qs}Wt.exports=Xs});var Xt=i((Tf,Qt)=>{"use strict";var Ys=S(),Zs=ee(),ks=j(),eu="[object Arguments]",ru="[object Array]",tu="[object Boolean]",nu="[object Date]",iu="[object Error]",ou="[object Function]",au="[object Map]",su="[object Number]",uu="[object Object]",cu="[object RegExp]",pu="[object Set]",fu="[object String]",lu="[object WeakMap]",du="[object ArrayBuffer]",gu="[object DataView]",hu="[object Float32Array]",vu="[object Float64Array]",yu="[object Int8Array]",mu="[object Int16Array]",bu="[object Int32Array]",qu="[object Uint8Array]",xu="[object Uint8ClampedArray]",ju="[object Uint16Array]",_u="[object Uint32Array]",p={};p[hu]=p[vu]=p[yu]=p[mu]=p[bu]=p[qu]=p[xu]=p[ju]=p[_u]=!0;p[eu]=p[ru]=p[du]=p[tu]=p[gu]=p[nu]=p[iu]=p[ou]=p[au]=p[su]=p[uu]=p[cu]=p[pu]=p[fu]=p[lu]=!1;function Iu(e){return ks(e)&&Zs(e.length)&&!!p[Ys(e)]}Qt.exports=Iu});var Zt=i((Sf,Yt)=>{"use strict";function Ou(e){return function(r){return e(r)}}Yt.exports=Ou});var en=i((D,I)=>{"use strict";var Tu=B(),kt=typeof D=="object"&&D&&!D.nodeType&&D,L=kt&&typeof I=="object"&&I&&!I.nodeType&&I,Su=L&&L.exports===kt,te=Su&&Tu.process,Pu=(function(){try{var e=L&&L.require&&L.require("util").types;return e||te&&te.binding&&te.binding("util")}catch{}})();I.exports=Pu});var ne=i((Pf,nn)=>{"use strict";var Au=Xt(),wu=Zt(),rn=en(),tn=rn&&rn.isTypedArray,Cu=tn?wu(tn):Au;nn.exports=Cu});var ie=i((Af,on)=>{"use strict";function Ru(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}on.exports=Ru});var sn=i((wf,an)=>{"use strict";var Eu=N(),Mu=P(),Du=Object.prototype,Lu=Du.hasOwnProperty;function Fu(e,r,t){var n=e[r];(!(Lu.call(e,r)&&Mu(n,t))||t===void 0&&!(r in e))&&Eu(e,r,t)}an.exports=Fu});var cn=i((Cf,un)=>{"use strict";var Gu=sn(),Nu=N();function zu(e,r,t,n){var o=!t;t||(t={});for(var a=-1,u=r.length;++a<u;){var s=r[a],c=n?n(t[s],e[s],s,t,e):void 0;c===void 0&&(c=e[s]),o?Nu(t,s,c):Gu(t,s,c)}return t}un.exports=zu});var fn=i((Rf,pn)=>{"use strict";function Uu(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}pn.exports=Uu});var oe=i((Ef,ln)=>{"use strict";var Hu=9007199254740991,Bu=/^(?:0|[1-9]\d*)$/;function $u(e,r){var t=typeof e;return r=r??Hu,!!r&&(t=="number"||t!="symbol"&&Bu.test(e))&&e>-1&&e%1==0&&e<r}ln.exports=$u});var gn=i((Mf,dn)=>{"use strict";var Ku=fn(),Vu=Z(),Wu=k(),Ju=re(),Qu=oe(),Xu=ne(),Yu=Object.prototype,Zu=Yu.hasOwnProperty;function ku(e,r){var t=Wu(e),n=!t&&Vu(e),o=!t&&!n&&Ju(e),a=!t&&!n&&!o&&Xu(e),u=t||n||o||a,s=u?Ku(e.length,String):[],c=s.length;for(var l in e)(r||Zu.call(e,l))&&!(u&&(l=="length"||o&&(l=="offset"||l=="parent")||a&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Qu(l,c)))&&s.push(l);return s}dn.exports=ku});var vn=i((Df,hn)=>{"use strict";function ec(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}hn.exports=ec});var mn=i((Lf,yn)=>{"use strict";var rc=d(),tc=Y(),nc=vn(),ic=Object.prototype,oc=ic.hasOwnProperty;function ac(e){if(!rc(e))return nc(e);var r=tc(e),t=[];for(var n in e)n=="constructor"&&(r||!oc.call(e,n))||t.push(n);return t}yn.exports=ac});var ae=i((Ff,bn)=>{"use strict";var sc=gn(),uc=mn(),cc=z();function pc(e){return cc(e)?sc(e,!0):uc(e)}bn.exports=pc});var xn=i((Gf,qn)=>{"use strict";var fc=cn(),lc=ae();function dc(e){return fc(e,lc(e))}qn.exports=dc});var Sn=i((Nf,Tn)=>{"use strict";var jn=Q(),gc=ft(),hc=mt(),vc=qt(),yc=At(),_n=Z(),In=k(),mc=zt(),bc=re(),qc=F(),xc=d(),jc=Jt(),_c=ne(),On=ie(),Ic=xn();function Oc(e,r,t,n,o,a,u){var s=On(e,t),c=On(r,t),l=u.get(c);if(l){jn(e,t,l);return}var f=a?a(s,c,t+"",e,r,u):void 0,g=f===void 0;if(g){var v=In(c),O=!v&&bc(c),ue=!v&&!O&&_c(c);f=c,v||O||ue?In(s)?f=s:mc(s)?f=vc(s):O?(g=!1,f=gc(c,!0)):ue?(g=!1,f=hc(c,!0)):f=[]:jc(c)||_n(c)?(f=s,_n(s)?f=Ic(s):(!xc(s)||qc(s))&&(f=yc(c))):g=!1}g&&(u.set(c,f),o(f,c,n,a,u),u.delete(c)),jn(e,t,f)}Tn.exports=Oc});var se=i((zf,An)=>{"use strict";var Tc=kr(),Sc=Q(),Pc=at(),Ac=Sn(),wc=d(),Cc=ae(),Rc=ie();function Pn(e,r,t,n,o){e!==r&&Pc(r,function(a,u){if(o||(o=new Tc),wc(a))Ac(e,r,u,t,Pn,n,o);else{var s=n?n(Rc(e,u),a,u+"",e,r,o):void 0;s===void 0&&(s=a),Sc(e,u,s)}},Cc)}An.exports=Pn});var En=i((Uf,Rn)=>{"use strict";var Ec=se(),wn=d();function Cn(e,r,t,n,o,a){return wn(e)&&wn(r)&&(a.set(r,e),Ec(e,r,void 0,Cn,a),a.delete(r)),e}Rn.exports=Cn});var Dn=i((Hf,Mn)=>{"use strict";var Mc=P(),Dc=z(),Lc=oe(),Fc=d();function Gc(e,r,t){if(!Fc(t))return!1;var n=typeof r;return(n=="number"?Dc(t)&&Lc(r,t.length):n=="string"&&r in t)?Mc(t[r],e):!1}Mn.exports=Gc});var Fn=i((Bf,Ln)=>{"use strict";var Nc=W(),zc=Dn();function Uc(e){return Nc(function(r,t){var n=-1,o=t.length,a=o>1?t[o-1]:void 0,u=o>2?t[2]:void 0;for(a=e.length>3&&typeof a=="function"?(o--,a):void 0,u&&zc(t[0],t[1],u)&&(a=o<3?void 0:a,o=1),r=Object(r);++n<o;){var s=t[n];s&&e(r,s,n,a)}return r})}Ln.exports=Uc});var Nn=i(($f,Gn)=>{"use strict";var Hc=se(),Bc=Fn(),$c=Bc(function(e,r,t,n){Hc(e,r,t,n)});Gn.exports=$c});var Un=i((Kf,zn)=>{"use strict";var Kc=U(),Vc=W(),Wc=En(),Jc=Nn(),Qc=Vc(function(e){return e.push(void 0,Wc),Kc(Jc,void 0,e)});zn.exports=Qc});import{createRoot as tp}from"react-dom/client";var $n=oi(Un());import{useSyncExternalStore as Xc,useState as Yc,useEffect as Zc,useMemo as Hn}from"react";import{IntlProvider as kc}from"react-intl";import{DesignSystemProvider as ep}from"@strapi/design-system";import{jsx as Bn}from"react/jsx-runtime";var rp=({children:e,store:r,configurations:t})=>{let n=Xc(r.subscribe,r.getState),o=n.admin_app.theme.currentTheme||"light",a=n.admin_app.language.locale||"en",u=t.translations||{},[s,c]=Yc(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");Zc(()=>{let g=matchMedia("(prefers-color-scheme: dark)"),v=O=>{c(O.matches?"dark":"light")};return g.addEventListener("change",v),()=>g.removeEventListener("change",v)},[]);let l=Hn(()=>(0,$n.default)(u[a],u.en),[a,u]),f=Hn(()=>t.themes[o==="system"?s:o],[o,s,t.themes]);return Bn(ep,{theme:f,locale:a,children:Bn(kc,{locale:a,messages:l,children:e})})},Kn=rp;import{jsx as Vn}from"react/jsx-runtime";var Wn=async(e,r,t)=>{let n=r.domInjections;if(!n){console.warn("Injection system not initialised. Please call initialiseInjections(app) before registering injection routes.");return}if(document.querySelector(`#${t.id}`)||n.removeRoot(t.id),e.location.pathname!==t.route)return;let a=t.Component(),u=await Jn(t.selector);if(!u||window.location.pathname!==t.route)return;if(!n.getRoot(t.id)){let f=document.getElementById(t.id);f||(f=document.createElement("div"),f.id=t.id,u.after(f)),n.setRoot(t.id,tp(f))}let c=(await a).default,l=n.getRoot(t.id);l&&l.render(Vn(Kn,{store:r.store,configurations:r.configurations,children:Vn(c,{})}))};var Xn=async e=>{let r=e.router,t=0;for(;!r?.router?.state?.location&&t<100;)await new Promise(n=>setTimeout(n,10)),t++;if(!r?.router?.state?.location){console.warn("Strapi router not ready after 5s, skipping injection initialization.");return}r.router.subscribe(n=>Qn(n,e)),Qn(r.router.state,e)},Qn=(e,r)=>{let t=r.domInjections?.routes||[];Promise.all(t.map(n=>Wn(e,r,n)))},Jn=(e,r=5e3)=>new Promise(t=>{let n=document.querySelector(e);if(n)return t(n);let o=new MutationObserver(()=>{let a=document.querySelector(e);a&&(o.disconnect(),t(a))});o.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{o.disconnect(),t(null)},r)}),Yn=(e,r)=>{if(!r.domInjections?.routes){console.warn("Injection system not initialised. Please call initialiseInjections(app) before registering injection routes.");return}let{id:t,...n}=e;if(t&&r.domInjections.routes.some(a=>a.id===t)){console.warn(`Injection route with id ${t} already exists. Skipping registration.`);return}let o=t||`injection-${Math.random().toString(36).substring(2,9)}`;r.domInjections.routes.push({id:o,...n})},Zn=(e,r)=>{if(!r.domInjections?.routes){console.warn("Injection system not initialised. Please call initialiseInjections(app) before unregistering injection routes.");return}let t=r.domInjections.routes.findIndex(n=>n.id===e);if(t===-1){console.warn(`Injection route with id ${e} does not exist. Skipping unregistration.`);return}r.domInjections.routes.splice(t,1),r.domInjections.removeRoot(e)};var ol=e=>{let r=e.domInjections;if(r)return r;Xn(e);let t={routes:[],roots:{},registerRoute:n=>Yn(n,e),unregisterRoute:n=>Zn(n,e),getRoot:n=>e.domInjections?.roots[n],setRoot:(n,o)=>{e.domInjections&&(e.domInjections.roots[n]=o)},removeRoot:n=>{if(!e.domInjections)return;let o=e.domInjections.roots[n];o&&(setTimeout(()=>o.unmount(),0),delete e.domInjections.roots[n])}};return e.domInjections=t,t};export{ol as initialiseInjections};
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "strapi-admin-portal",
3
+ "version": "0.0.1",
4
+ "description": "The Portal Gun for Strapi Admin. Seamlessly mount React components into specific DOM selectors across any admin route.",
5
+ "keywords": [
6
+ "strapi",
7
+ "cms",
8
+ "admin"
9
+ ],
10
+ "homepage": "https://github.com/Link2Twenty/strapi-admin-portal#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Link2Twenty/strapi-admin-portal/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Link2Twenty/strapi-admin-portal.git"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Andrew Bone",
20
+ "type": "commonjs",
21
+ "main": "dist/index.js",
22
+ "module": "dist/index.esm.js",
23
+ "types": "dist/index.d.ts",
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean --minify",
29
+ "dev": "tsup src/index.ts --format cjs,esm --watch --dts",
30
+ "lint": "eslint src"
31
+ },
32
+ "peerDependencies": {
33
+ "@strapi/design-system": "^2.1.2",
34
+ "@strapi/strapi": "^5.0.0",
35
+ "react": "^17.0.0 || ^18.0.0",
36
+ "react-dom": "^17.0.0 || ^18.0.0",
37
+ "react-intl": "^6.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/react": "^18.3.28",
41
+ "@types/react-dom": "^18.3.7",
42
+ "prettier": "^3.8.1",
43
+ "tsup": "^8.5.1",
44
+ "typescript": "^5.9.3"
45
+ }
46
+ }