@common-stack/components-pro 8.0.1-alpha.0 → 8.1.1-alpha.0
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/LICENSE +34 -21
- package/lib/index.d.ts +3 -2
- package/lib/index.js +1 -1
- package/lib/index.native.d.ts +2 -1
- package/lib/index.native.js +1 -1
- package/lib/plugin/context.d.ts +7 -0
- package/lib/plugin/context.js +1 -0
- package/lib/plugin/context.js.map +1 -0
- package/lib/plugin/dynamic-render.d.ts +5 -0
- package/lib/plugin/dynamic-render.js +19 -0
- package/lib/plugin/dynamic-render.js.map +1 -0
- package/lib/plugin/index.d.ts +2 -0
- package/lib/plugin/index.native.d.ts +2 -0
- package/lib/plugin/loader.d.ts +7 -0
- package/lib/plugin/loader.js +20 -0
- package/lib/plugin/loader.js.map +1 -0
- package/lib/plugin/plugin-render.d.ts +13 -0
- package/lib/plugin/plugin-render.js +48 -0
- package/lib/plugin/plugin-render.js.map +1 -0
- package/lib/plugin/provider.d.ts +6 -0
- package/lib/plugin/provider.js +5 -0
- package/lib/plugin/provider.js.map +1 -0
- package/lib/plugin/provider.native.d.ts +7 -0
- package/lib/plugin/provider.native.js +3 -0
- package/lib/plugin/provider.native.js.map +1 -0
- package/lib/plugin/utils.server.d.ts +1 -0
- package/lib/slot-fill/__tests__/filler-slot.test.d.ts +1 -1
- package/lib/slot-fill/__tests__/slot-features.test.d.ts +1 -1
- package/lib/slot-fill/__tests__/slot-fill-provider.test.d.ts +1 -0
- package/lib/slot-fill/base/context.js +2 -1
- package/lib/slot-fill/base/context.js.map +1 -1
- package/lib/slot-fill/base/fill.js +18 -16
- package/lib/slot-fill/base/fill.js.map +1 -1
- package/lib/slot-fill/base/provider.d.ts +4 -21
- package/lib/slot-fill/base/provider.js +62 -84
- package/lib/slot-fill/base/provider.js.map +1 -1
- package/lib/slot-fill/base/slot.js +35 -37
- package/lib/slot-fill/base/slot.js.map +1 -1
- package/lib/slot-fill/index.js.map +1 -1
- package/lib/slot-fill/interfaces/index.d.ts +6 -0
- package/lib/slot-fill/utils/index.d.ts +7 -1
- package/lib/slot-fill/utils/index.js +9 -0
- package/lib/slot-fill/utils/index.js.map +1 -0
- package/lib/slot-fill/utils/isEmptyElement.d.ts +1 -1
- package/lib/slot-fill/utils/isEmptyElement.js +3 -0
- package/lib/slot-fill/utils/isEmptyElement.js.map +1 -1
- package/lib/slot-fill/utils/removeUniversalPortals.js.map +1 -1
- package/package.json +5 -5
- package/lib/slot-fill/utils/replaceServerFills.d.ts +0 -9
- package/lib/slot-fill/utils/replaceServerFills.js +0 -25
- package/lib/slot-fill/utils/replaceServerFills.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
IMPLIED,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
PROPRIETARY LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-2025 CDMBase LLC. All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary and confidential information of CDMBase LLC ("Confidential Information").
|
|
7
|
+
|
|
8
|
+
NOTICE: All information contained herein is, and remains the property of
|
|
9
|
+
CDMBase LLC. The intellectual and technical concepts contained herein are
|
|
10
|
+
proprietary to CDMBase LLC and may be covered by U.S. and Foreign Patents,
|
|
11
|
+
patents in process, and are protected by trade secret or copyright law.
|
|
12
|
+
|
|
13
|
+
Dissemination of this information or reproduction of this material is strictly
|
|
14
|
+
forbidden unless prior written permission is obtained from CDMBase LLC.
|
|
15
|
+
|
|
16
|
+
NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
|
|
17
|
+
PROPERTY RIGHTS ARE GRANTED BY THIS DOCUMENT.
|
|
18
|
+
|
|
19
|
+
RESTRICTIONS:
|
|
20
|
+
1. You may NOT use, copy, modify, merge, publish, distribute, sublicense,
|
|
21
|
+
and/or sell copies of the Software without explicit written permission
|
|
22
|
+
from CDMBase LLC.
|
|
23
|
+
2. You may NOT reverse engineer, decompile, or disassemble the Software.
|
|
24
|
+
3. You may NOT remove or alter any proprietary notices or labels on the Software.
|
|
25
|
+
4. The Software is licensed, not sold.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
30
|
+
CDMBASE LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
31
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
32
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
For licensing inquiries, please contact: legal@cdmbase.com
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot } from './slot-fill';
|
|
2
|
-
export { removeUniversalPortals
|
|
1
|
+
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot, } from './slot-fill';
|
|
2
|
+
export { removeUniversalPortals } from './slot-fill/utils';
|
|
3
|
+
export * from './plugin';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{removeUniversalPortals}from'./slot-fill/utils/removeUniversalPortals.js';export{
|
|
1
|
+
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{removeUniversalPortals}from'./slot-fill/utils/removeUniversalPortals.js';export{default as FillRenderProvider}from'./plugin/provider.js';export{PluginsLoader}from'./plugin/loader.js';export{default as __experimentalUseSlot}from'./slot-fill/bubbles-virtually/use-slot.js';//# sourceMappingURL=index.js.map
|
package/lib/index.native.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider
|
|
1
|
+
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider } from './slot-fill';
|
|
2
|
+
export * from './plugin/index.native';
|
package/lib/index.native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{default as FillRenderProvider}from'./plugin/provider.native.js';export{PluginsLoader}from'./plugin/loader.js';//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ILoadedPlugin } from '../slot-fill/interfaces';
|
|
3
|
+
export interface IFillRenderContext {
|
|
4
|
+
loadedPlugins: ILoadedPlugin[];
|
|
5
|
+
}
|
|
6
|
+
declare const FillRenderContext: React.Context<IFillRenderContext>;
|
|
7
|
+
export default FillRenderContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as React from'react';const FillRenderContext = React.createContext(null);export{FillRenderContext as default};//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../src/plugin/context.tsx"],"sourcesContent":[null],"names":[],"mappings":"4BAOM,MAAA,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAA4B,IAAI"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React__default,{useState,useEffect}from'react';const DynamicRender = ({ renderImporter, ...props }) => {
|
|
2
|
+
const [Component, setComponent] = useState(null);
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
if (renderImporter) {
|
|
5
|
+
renderImporter()
|
|
6
|
+
.then((module) => {
|
|
7
|
+
const ImportedComponent = module.default;
|
|
8
|
+
setComponent(() => ImportedComponent);
|
|
9
|
+
})
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
console.error(`Failed to load component from ${renderImporter}:`, error);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}, [renderImporter]);
|
|
15
|
+
if (!Component) {
|
|
16
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
17
|
+
}
|
|
18
|
+
return React__default.createElement(Component, { ...props });
|
|
19
|
+
};export{DynamicRender};//# sourceMappingURL=dynamic-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-render.js","sources":["../../src/plugin/dynamic-render.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"sDAEO,MAAM,aAAa,GAAG,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,EAAE,KAAI;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAC;IAElE,SAAS,CAAC,MAAK;QACX,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,EAAE;AACX,iBAAA,IAAI,CAAC,CAAC,MAAM,KAAI;AACb,gBAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;AACzC,gBAAA,YAAY,CAAC,MAAM,iBAAiB,CAAC,CAAC;AAC1C,aAAC,CAAC;AACD,iBAAA,KAAK,CAAC,CAAC,KAAK,KAAI;gBACb,OAAO,CAAC,KAAK,CAAC,CAAA,8BAAA,EAAiC,cAAc,CAAG,CAAA,CAAA,EAAE,KAAK,CAAC,CAAC;AAC7E,aAAC,CAAC,CAAC;SACV;AACL,KAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,IAAI,CAAC,SAAS,EAAE;AACZ,QAAA,OAAOA,2DAAK,CAAC;KAChB;AAED,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,SAAS,EAAK,EAAA,GAAA,KAAK,GAAI,CAAC;AACpC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IAppLoadContext } from '@common-stack/client-core';
|
|
2
|
+
import { IResourceParams } from '@common-stack/core';
|
|
3
|
+
export declare function PluginsLoader(plugins: any[], loaderContext: {
|
|
4
|
+
request: Request;
|
|
5
|
+
context: IAppLoadContext;
|
|
6
|
+
params: IResourceParams;
|
|
7
|
+
}): Promise<any[]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
async function PluginsLoader(plugins, loaderContext) {
|
|
2
|
+
const loadedPlugins = await Promise.all(plugins.map(async (plugin) => {
|
|
3
|
+
try {
|
|
4
|
+
if (plugin.renderImporter) {
|
|
5
|
+
const module = await plugin.renderImporter();
|
|
6
|
+
const ImportedComponent = module.default;
|
|
7
|
+
// if (module.loader && typeof module.loader === 'function') {
|
|
8
|
+
// const loaderData = await module.loader(loaderContext);
|
|
9
|
+
// return { ...plugin, Component: ImportedComponent, loaderData };
|
|
10
|
+
// }
|
|
11
|
+
return { ...plugin, Component: ImportedComponent };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error('Error in PluginsLoader', error);
|
|
16
|
+
}
|
|
17
|
+
return plugin;
|
|
18
|
+
}));
|
|
19
|
+
return loadedPlugins;
|
|
20
|
+
}export{PluginsLoader};//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sources":["../../src/plugin/loader.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGO,eAAe,aAAa,CAC/B,OAAc,EACd,aAAsF,EAAA;AAEtF,IAAA,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACnC,OAAO,CAAC,GAAG,CAAC,OAAO,MAAW,KAAI;AAC9B,QAAA,IAAI;AACA,YAAA,IAAI,MAAM,CAAC,cAAc,EAAE;AACvB,gBAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;AAC7C,gBAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;;;;;gBAMzC,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;aACtD;SACJ;QAAC,OAAO,KAAK,EAAE;AACZ,YAAA,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;SAClD;AACD,QAAA,OAAO,MAAM,CAAC;KACjB,CAAC,CACL,CAAC;AACF,IAAA,OAAO,aAAa,CAAC;AACzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ILoadedPlugin, Name } from '../slot-fill/interfaces';
|
|
3
|
+
interface IPluginRenderProps {
|
|
4
|
+
fills: ILoadedPlugin[];
|
|
5
|
+
name: Name;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export declare const ChildrenRender: ({ children, ...props }: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
children: any;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
export declare const PluginRender: (props: IPluginRenderProps) => React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React__default,{useContext}from'react';import {DynamicRender}from'./dynamic-render.js';import {isFunction}from'../slot-fill/utils/index.js';import FillRenderContext from'./context.js';const ChildrenRender = ({ children, ...props }) => {
|
|
2
|
+
return React__default.createElement(React__default.Fragment, null, isFunction(children) ? children(props) : children);
|
|
3
|
+
};
|
|
4
|
+
const PluginRender = (props) => {
|
|
5
|
+
const context = useContext(FillRenderContext);
|
|
6
|
+
if (!context?.loadedPlugins) {
|
|
7
|
+
throw new Error('PluginRender must be used within a FillRenderContext.Provider');
|
|
8
|
+
}
|
|
9
|
+
const FillRender = ({ fill, ...props }) => {
|
|
10
|
+
const plugin = context.loadedPlugins.find((plugin) => plugin.index === fill.index);
|
|
11
|
+
const loaderData = plugin?.loaderData || {};
|
|
12
|
+
if (plugin?.Component) {
|
|
13
|
+
return React__default.createElement(plugin.Component, { ...props, loaderData: loaderData });
|
|
14
|
+
}
|
|
15
|
+
else if (fill.renderImporter) {
|
|
16
|
+
return React__default.createElement(DynamicRender, { ...props, renderImporter: fill.renderImporter, loaderData: loaderData });
|
|
17
|
+
}
|
|
18
|
+
else if (plugin?.render) {
|
|
19
|
+
let children = null;
|
|
20
|
+
try {
|
|
21
|
+
const FillComponent = plugin.render(props);
|
|
22
|
+
if (React__default.isValidElement(FillComponent)) {
|
|
23
|
+
const element = FillComponent;
|
|
24
|
+
children = element.props?.children;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Error in PluginRender', error);
|
|
29
|
+
}
|
|
30
|
+
if (children) {
|
|
31
|
+
return React__default.createElement(ChildrenRender, { ...props, children: children });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (fill.children) {
|
|
35
|
+
return React__default.createElement(ChildrenRender, { ...props, children: fill.children });
|
|
36
|
+
}
|
|
37
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
38
|
+
};
|
|
39
|
+
return (React__default.createElement(React__default.Fragment, null, props.fills.map((fill, i) => {
|
|
40
|
+
if (typeof window === 'undefined') {
|
|
41
|
+
return (React__default.createElement("div", { key: i, "data-slot-name": `slot-${props.name}` },
|
|
42
|
+
React__default.createElement(FillRender, { fill: fill, ...props })));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return React__default.createElement(FillRender, { key: i, fill: fill, ...props });
|
|
46
|
+
}
|
|
47
|
+
})));
|
|
48
|
+
};export{ChildrenRender,PluginRender};//# sourceMappingURL=plugin-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-render.js","sources":["../../src/plugin/plugin-render.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"+LAiBO,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KAAI;AACrD,IAAA,OAAOA,4DAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAI,CAAC;AACpE,EAAE;AAEW,MAAA,YAAY,GAAG,CAAC,KAAyB,KAAI;AACtD,IAAA,MAAM,OAAO,GAAG,UAAU,CAAqB,iBAAiB,CAAC,CAAC;AAClE,IAAA,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;KACpF;IAED,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAmB,KAAI;QACvD,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;AACnF,QAAA,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,IAAI,EAAE,CAAC;AAE5C,QAAA,IAAI,MAAM,EAAE,SAAS,EAAE;YACnB,OAAOA,cAAA,CAAA,aAAA,CAAC,MAAM,CAAC,SAAS,EAAA,EAAA,GAAK,KAAK,EAAE,UAAU,EAAE,UAAU,EAAA,CAAI,CAAC;SAClE;AAAM,aAAA,IAAI,IAAI,CAAC,cAAc,EAAE;AAC5B,YAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAK,EAAA,GAAA,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,E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AAE,IAAI,KAAM,KAAK,EAAA,CAAI,CACnC,EACR;SACL;aAAM;AACH,YAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,UAAU,EAAC,EAAA,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;SACxD;KACJ,CAAC,CACH,EACL;AACN"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React__default from'react';import {useLoaderData}from'@remix-run/react';import FillRenderContext from'./context.js';const FillRenderProvider = ({ children }) => {
|
|
2
|
+
const loaderData = useLoaderData();
|
|
3
|
+
const loadedPlugins = loaderData?.loadedPlugins || [];
|
|
4
|
+
return React__default.createElement(FillRenderContext.Provider, { value: { loadedPlugins } }, children);
|
|
5
|
+
};export{FillRenderProvider as default};//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../src/plugin/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"2HAQA,MAAM,kBAAkB,GAAsC,CAAC,EAAE,QAAQ,EAAE,KAAI;AAC3E,IAAA,MAAM,UAAU,GAAQ,aAAa,EAAE,CAAC;AACxC,IAAA,MAAM,aAAa,GAAG,UAAU,EAAE,aAAa,IAAI,EAAE,CAAC;AAEtD,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,iBAAiB,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,EAAE,aAAa,EAAE,EAAG,EAAA,QAAQ,CAA8B,CAAC;AACzG"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React__default from'react';import FillRenderContext from'./context.js';const FillRenderProvider = ({ children, loadedPlugins = [] }) => {
|
|
2
|
+
return React__default.createElement(FillRenderContext.Provider, { value: { loadedPlugins } }, children);
|
|
3
|
+
};export{FillRenderProvider as default};//# sourceMappingURL=provider.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.native.js","sources":["../../src/plugin/provider.native.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"8EAQM,MAAA,kBAAkB,GAAsC,CAAC,EAAE,QAAQ,EAAE,aAAa,GAAG,EAAE,EAAE,KAAI;AAC/F,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,iBAAiB,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,EAAE,aAAa,EAAE,EAAG,EAAA,QAAQ,CAA8B,CAAC;AACzG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveComponent(renderImporter: string): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import 'jest';
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import 'jest';
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import*as React from'react';const SlotFillContext = React.createContext({
|
|
2
|
+
// need to add default value otherwise it will fail
|
|
2
3
|
registerSlot: () => { },
|
|
3
4
|
unregisterSlot: () => { },
|
|
4
5
|
registerFill: () => { },
|
|
5
6
|
unregisterFill: () => { },
|
|
6
7
|
getSlot: () => ({}),
|
|
7
|
-
getFills: () =>
|
|
8
|
+
getFills: () => [],
|
|
8
9
|
hasFills: () => false,
|
|
9
10
|
subscribe: () => { },
|
|
10
11
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../src/slot-fill/base/context.tsx"],"sourcesContent":[null],"names":[],"mappings":"4BAGA,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAkB
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../src/slot-fill/base/context.tsx"],"sourcesContent":[null],"names":[],"mappings":"4BAGA,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAkB;;AAEzD,IAAA,YAAY,EAAE,MAAK,GAAG;AACtB,IAAA,cAAc,EAAE,MAAK,GAAG;AACxB,IAAA,YAAY,EAAE,MAAK,GAAG;AACtB,IAAA,cAAc,EAAE,MAAK,GAAG;AACxB,IAAA,OAAO,EAAE,OAAO,EAAE,CAAQ;AAC1B,IAAA,QAAQ,EAAE,MAAM,EAAE;AAClB,IAAA,QAAQ,EAAE,MAAM,KAAK;AACrB,IAAA,SAAS,EAAE,MAAK,GAAG;AACtB,CAAA,EAAE;AACH,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React__default,{useRef}from'react';import {
|
|
1
|
+
import React__default,{useRef}from'react';import {Consumer}from'./context.js';import {useSlot}from'./use-slot.js';const FillComponent = ({ index, name, renderImporter, children, registerFill, unregisterFill, serverMode, }) => {
|
|
2
2
|
const slot = useSlot(name);
|
|
3
3
|
let useLayoutEffect;
|
|
4
|
+
const nodeProps = { index, renderImporter, children };
|
|
4
5
|
if (serverMode) {
|
|
5
6
|
useLayoutEffect = (args) => { };
|
|
6
|
-
if (!!name
|
|
7
|
-
registerFill(name,
|
|
7
|
+
if (!!name) {
|
|
8
|
+
registerFill(name, nodeProps);
|
|
8
9
|
}
|
|
9
10
|
return null;
|
|
10
11
|
}
|
|
@@ -13,33 +14,33 @@ import React__default,{useRef}from'react';import {createPortal}from'react-dom';i
|
|
|
13
14
|
}
|
|
14
15
|
const ref = useRef({
|
|
15
16
|
name,
|
|
16
|
-
|
|
17
|
+
nodeProps,
|
|
17
18
|
});
|
|
18
19
|
useLayoutEffect(() => {
|
|
19
20
|
const refValue = ref.current;
|
|
20
|
-
registerFill(name, refValue);
|
|
21
|
-
return () => unregisterFill(name, refValue);
|
|
21
|
+
registerFill(name, refValue.nodeProps);
|
|
22
|
+
return () => unregisterFill(name, refValue.nodeProps);
|
|
22
23
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
23
24
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
24
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
26
|
}, []);
|
|
26
27
|
useLayoutEffect(() => {
|
|
27
|
-
ref.current.
|
|
28
|
-
if (slot) {
|
|
28
|
+
ref.current.nodeProps = nodeProps;
|
|
29
|
+
if (slot && typeof slot.forceUpdate === 'function') {
|
|
29
30
|
slot.forceUpdate();
|
|
30
31
|
}
|
|
31
32
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
32
33
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
33
34
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
}, [children]);
|
|
35
|
+
}, [renderImporter, children]);
|
|
35
36
|
useLayoutEffect(() => {
|
|
36
37
|
if (name === ref.current.name) {
|
|
37
38
|
// ignore initial effect
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
unregisterFill(ref.current.name, ref.current);
|
|
41
|
+
unregisterFill(ref.current.name, ref.current.nodeProps);
|
|
41
42
|
ref.current.name = name;
|
|
42
|
-
registerFill(name, ref.current);
|
|
43
|
+
registerFill(name, ref.current.nodeProps);
|
|
43
44
|
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
44
45
|
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
45
46
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -48,12 +49,13 @@ import React__default,{useRef}from'react';import {createPortal}from'react-dom';i
|
|
|
48
49
|
return null;
|
|
49
50
|
}
|
|
50
51
|
// If a function is passed as a child, provide it with the fillProps.
|
|
51
|
-
if (typeof children === 'function') {
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return createPortal(children, slot.node);
|
|
52
|
+
// if (typeof children === 'function') {
|
|
53
|
+
// children = children(slot.props.fillProps);
|
|
54
|
+
// }
|
|
55
|
+
// return createPortal(children, slot.node);
|
|
56
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
55
57
|
};
|
|
56
58
|
const Fill = (props) => {
|
|
57
|
-
const serverMode =
|
|
59
|
+
const serverMode = typeof window === 'undefined';
|
|
58
60
|
return (React__default.createElement(Consumer, null, ({ registerFill, unregisterFill }) => (React__default.createElement(FillComponent, { ...props, registerFill: registerFill, unregisterFill: unregisterFill, serverMode: serverMode }))));
|
|
59
61
|
};export{Fill as default};//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.js","sources":["../../../src/slot-fill/base/fill.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fill.js","sources":["../../../src/slot-fill/base/fill.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"kHAUA,MAAM,aAAa,GAAG,CAAC,EACnB,KAAK,EACL,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,UAAU,GACS,KAAI;AACvB,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,IAAA,IAAI,eAAe,CAAC;IACpB,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;IAEtD,IAAI,UAAU,EAAE;AACZ,QAAA,eAAe,GAAG,CAAC,IAAI,KAAI,GAAG,CAAC;AAC/B,QAAA,IAAI,CAAC,CAAC,IAAI,EAAE;AACR,YAAA,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;SACjC;AACD,QAAA,OAAO,IAAI,CAAC;KACf;SAAM;AACH,QAAA,eAAe,GAAGA,cAAK,CAAC,eAAe,CAAC;KAC3C;IAED,MAAM,GAAG,GAAG,MAAM,CAAC;QACf,IAAI;QACJ,SAAS;AACZ,KAAA,CAAC,CAAC;IAEH,eAAe,CAAC,MAAK;AACjB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC;AAC7B,QAAA,YAAY,CAAC,IAAI,EAAE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E,cAAc,EAC9B,UAAU,EAAE,UAAU,EAAA,CACxB,CACL,CACM,EACb;AACN"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
3
|
-
declare class SlotFillProvider extends Component<{
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface SlotFillProviderProps {
|
|
4
3
|
children: ReactNode;
|
|
5
|
-
|
|
6
|
-
private slots;
|
|
7
|
-
private fills;
|
|
8
|
-
private listeners;
|
|
9
|
-
private contextValue;
|
|
10
|
-
private returnValue;
|
|
11
|
-
constructor(props: any);
|
|
12
|
-
registerSlot(name: any, slot: any): void;
|
|
13
|
-
registerFill(name: any, instance: any): void;
|
|
14
|
-
unregisterSlot(name: any, instance: any): void;
|
|
15
|
-
unregisterFill(name: any, instance: IFill): void;
|
|
16
|
-
getSlot(name: any): ISlot;
|
|
17
|
-
getFills(name: any, slotInstance: any): IFill[];
|
|
18
|
-
hasFills(name: any): boolean;
|
|
19
|
-
private forceUpdateSlot;
|
|
20
|
-
private triggerListeners;
|
|
21
|
-
subscribe(listener: any): () => void;
|
|
22
|
-
render(): React.JSX.Element;
|
|
4
|
+
context?: any;
|
|
23
5
|
}
|
|
6
|
+
declare const SlotFillProvider: React.FC<SlotFillProviderProps>;
|
|
24
7
|
export default SlotFillProvider;
|
|
@@ -1,100 +1,78 @@
|
|
|
1
|
-
import React__default,{
|
|
2
|
-
slots;
|
|
3
|
-
fills;
|
|
4
|
-
listeners;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.registerFill = this.registerFill.bind(this);
|
|
11
|
-
this.unregisterSlot = this.unregisterSlot.bind(this);
|
|
12
|
-
this.unregisterFill = this.unregisterFill.bind(this);
|
|
13
|
-
this.getSlot = this.getSlot.bind(this);
|
|
14
|
-
this.getFills = this.getFills.bind(this);
|
|
15
|
-
this.subscribe = this.subscribe.bind(this);
|
|
16
|
-
this.slots = {};
|
|
17
|
-
this.fills = {};
|
|
18
|
-
this.listeners = [];
|
|
19
|
-
this.contextValue = {
|
|
20
|
-
registerSlot: this.registerSlot,
|
|
21
|
-
unregisterSlot: this.unregisterSlot,
|
|
22
|
-
registerFill: this.registerFill,
|
|
23
|
-
unregisterFill: this.unregisterFill,
|
|
24
|
-
getSlot: this.getSlot,
|
|
25
|
-
getFills: this.getFills,
|
|
26
|
-
hasFills: this.hasFills,
|
|
27
|
-
subscribe: this.subscribe,
|
|
28
|
-
};
|
|
29
|
-
if (props.context) {
|
|
30
|
-
this.returnValue = props.context;
|
|
31
|
-
this.returnValue.fills = this.fills;
|
|
1
|
+
import React__default,{useRef,useCallback}from'react';import {sortBy}from'lodash-es';import {Provider}from'./context.js';const SlotFillProvider = ({ children, context }) => {
|
|
2
|
+
const slots = useRef({});
|
|
3
|
+
const fills = useRef({});
|
|
4
|
+
const listeners = useRef([]);
|
|
5
|
+
const returnValue = useRef(context);
|
|
6
|
+
const forceUpdateSlot = useCallback((name) => {
|
|
7
|
+
const slot = slots.current[name];
|
|
8
|
+
if (slot && typeof slot.forceUpdate === 'function') {
|
|
9
|
+
slot.forceUpdate();
|
|
32
10
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
}, []);
|
|
12
|
+
const triggerListeners = useCallback(() => {
|
|
13
|
+
listeners.current.forEach((listener) => listener());
|
|
14
|
+
}, []);
|
|
15
|
+
const registerSlot = useCallback((name, slot) => {
|
|
16
|
+
const previousSlot = slots.current[name];
|
|
17
|
+
slots.current[name] = slot;
|
|
18
|
+
triggerListeners();
|
|
38
19
|
// Sometimes the fills are registered after the initial render of slot
|
|
39
20
|
// But before the registerSlot call, we need to rerender the slot
|
|
40
|
-
|
|
21
|
+
forceUpdateSlot(name);
|
|
41
22
|
// If a new instance of a slot is being mounted while another with the
|
|
42
23
|
// same name exists, force its update _after_ the new slot has been
|
|
43
|
-
// assigned into the instance,
|
|
24
|
+
// assigned into the instance, such that its own rendering of children
|
|
44
25
|
// will be empty (the new Slot will subsume all fills for this name).
|
|
45
|
-
if (previousSlot) {
|
|
26
|
+
if (previousSlot && typeof previousSlot.forceUpdate === 'function') {
|
|
46
27
|
previousSlot.forceUpdate();
|
|
47
28
|
}
|
|
48
|
-
}
|
|
49
|
-
registerFill(name, instance) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
unregisterSlot(name, instance) {
|
|
29
|
+
}, [forceUpdateSlot, triggerListeners]);
|
|
30
|
+
const registerFill = useCallback((name, instance) => {
|
|
31
|
+
fills.current[name] = [...(fills.current[name] || []), instance];
|
|
32
|
+
forceUpdateSlot(name);
|
|
33
|
+
}, [forceUpdateSlot]);
|
|
34
|
+
const unregisterSlot = useCallback((name, instance) => {
|
|
54
35
|
// If a previous instance of a Slot by this name unmounts, do nothing,
|
|
55
36
|
// as the slot and its fills should only be removed for the current
|
|
56
37
|
// known instance.
|
|
57
|
-
if (
|
|
38
|
+
if (slots.current[name] !== instance) {
|
|
58
39
|
return;
|
|
59
40
|
}
|
|
60
|
-
delete
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
unregisterFill(name, instance) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
getSlot(name) {
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
getFills(name, slotInstance) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
hasFills(name) {
|
|
80
|
-
return this.fills[name] && !!this.fills[name].length;
|
|
81
|
-
}
|
|
82
|
-
forceUpdateSlot(name) {
|
|
83
|
-
const slot = this.getSlot(name);
|
|
84
|
-
if (slot) {
|
|
85
|
-
slot.forceUpdate();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
triggerListeners() {
|
|
89
|
-
this.listeners.forEach((listener) => listener());
|
|
90
|
-
}
|
|
91
|
-
subscribe(listener) {
|
|
92
|
-
this.listeners.push(listener);
|
|
41
|
+
delete slots.current[name];
|
|
42
|
+
triggerListeners();
|
|
43
|
+
}, [triggerListeners]);
|
|
44
|
+
const unregisterFill = useCallback((name, instance) => {
|
|
45
|
+
fills.current[name] = fills.current[name]?.filter((fill) => fill !== instance) ?? [];
|
|
46
|
+
forceUpdateSlot(name);
|
|
47
|
+
}, [forceUpdateSlot]);
|
|
48
|
+
const getSlot = useCallback((name) => {
|
|
49
|
+
return slots.current[name];
|
|
50
|
+
}, []);
|
|
51
|
+
const getFills = useCallback((name, slotInstance) => {
|
|
52
|
+
return sortBy(fills.current[name]);
|
|
53
|
+
}, []);
|
|
54
|
+
const hasFills = useCallback((name) => {
|
|
55
|
+
return fills.current[name] && !!fills.current[name].length;
|
|
56
|
+
}, []);
|
|
57
|
+
const subscribe = useCallback((listener) => {
|
|
58
|
+
listeners.current.push(listener);
|
|
93
59
|
return () => {
|
|
94
|
-
|
|
60
|
+
listeners.current = listeners.current.filter((l) => l !== listener);
|
|
95
61
|
};
|
|
62
|
+
}, []);
|
|
63
|
+
const contextValue = {
|
|
64
|
+
registerSlot,
|
|
65
|
+
unregisterSlot,
|
|
66
|
+
registerFill,
|
|
67
|
+
unregisterFill,
|
|
68
|
+
getSlot,
|
|
69
|
+
getFills,
|
|
70
|
+
hasFills,
|
|
71
|
+
subscribe,
|
|
72
|
+
};
|
|
73
|
+
if (context) {
|
|
74
|
+
returnValue.current = context;
|
|
75
|
+
returnValue.current.fills = fills.current;
|
|
96
76
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}export{SlotFillProvider as default};//# sourceMappingURL=provider.js.map
|
|
77
|
+
return React__default.createElement(Provider, { value: contextValue }, children);
|
|
78
|
+
};export{SlotFillProvider as default};//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sources":["../../../src/slot-fill/base/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../../src/slot-fill/base/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"yHAUM,MAAA,gBAAgB,GAAoC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAI;AAChF,IAAA,MAAM,KAAK,GAAG,MAAM,CAA2B,EAAE,CAAC,CAAC;AACnD,IAAA,MAAM,KAAK,GAAG,MAAM,CAA6B,EAAE,CAAC,CAAC;AACrD,IAAA,MAAM,SAAS,GAAG,MAAM,CAAiB,EAAE,CAAC,CAAC;AAC7C,IAAA,MAAM,WAAW,GAAG,MAAM,CAAM,OAAO,CAAC,CAAC;AAEzC,IAAA,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,IAAY,KAAI;QACjD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE;YAChD,IAAI,CAAC,WAAW,EAAE,CAAC;SACtB;KACJ,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAK;AACtC,QAAA,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC,CAAC;KACvD,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,WAAW,CAC5B,CAAC,IAAY,EAAE,IAAW,KAAI;QAC1B,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,QAAA,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,QAAA,gBAAgB,EAAE,CAAC;;;QAInB,eAAe,CAAC,IAAI,CAAC,CAAC;;;;;QAMtB,IAAI,YAAY,IAAI,OAAO,YAAY,CAAC,WAAW,KAAK,UAAU,EAAE;Y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C/D,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACtC,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,IAAY,KAAI;AAC1C,QAAA,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;KAC9D,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,QAAoB,KAAI;AACnD,QAAA,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACjC,QAAA,OAAO,MAAK;AACR,YAAA,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC;AACxE,SAAC,CAAC;KACL,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,YAAY,GAAmB;QACjC,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,cAAc;QACd,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,SAAS;KACZ,CAAC;IAEF,IAAI,OAAO,EAAE;AACT,QAAA,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;KAC7C;IAED,OAAOA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,YAAY,EAAA,EAAG,QAAQ,CAAY,CAAC;AAChE"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import React__default,{Component,Children,cloneElement}from'react';import {Consumer}from'./context.js';import {isEmptyElement}from'../utils/isEmptyElement.js'
|
|
2
|
-
* Whether the argument is a function.
|
|
3
|
-
*
|
|
4
|
-
* @param {*} maybeFunc The argument to check.
|
|
5
|
-
* @returns {boolean} True if the argument is a function, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
function isFunction(maybeFunc) {
|
|
8
|
-
return typeof maybeFunc === 'function';
|
|
9
|
-
}
|
|
10
|
-
class SlotComponent extends Component {
|
|
1
|
+
import React__default,{Component,Children,cloneElement}from'react';import {Consumer}from'./context.js';import {isFunction}from'../utils/index.js';import {PluginRender}from'../../plugin/plugin-render.js';import {isEmptyElement}from'../utils/isEmptyElement.js';class SlotComponent extends Component {
|
|
11
2
|
node;
|
|
12
3
|
isUnmounted;
|
|
13
4
|
constructor(props) {
|
|
@@ -47,41 +38,48 @@ class SlotComponent extends Component {
|
|
|
47
38
|
}
|
|
48
39
|
render() {
|
|
49
40
|
const { children, name, fillProps = {}, getFills, serverMode } = this.props;
|
|
41
|
+
const fills = getFills(name).filter((element) => !isEmptyElement(element));
|
|
42
|
+
if (fills.length > 0) {
|
|
43
|
+
if (isFunction(children)) {
|
|
44
|
+
const childrenFills = fills.map((fill) => {
|
|
45
|
+
const fillChildren = isFunction(fill.children)
|
|
46
|
+
? fill.children(fillProps)
|
|
47
|
+
: fill.children;
|
|
48
|
+
return Children.map(fillChildren, (child, childIndex) => {
|
|
49
|
+
if (!child || typeof child === 'string') {
|
|
50
|
+
return child;
|
|
51
|
+
}
|
|
52
|
+
const childKey = child.key || childIndex;
|
|
53
|
+
return cloneElement(child, { key: childKey });
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return React__default.createElement(React__default.Fragment, null, children(childrenFills));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return React__default.createElement(PluginRender, { ...fillProps, name: name, fills: fills });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/*
|
|
50
63
|
if (serverMode) {
|
|
51
64
|
const fills = (getFills(name, this) ?? [])
|
|
52
|
-
.map((fill, i) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
.map((fill: any, i) => {
|
|
66
|
+
// unregisterFill(name, fill);
|
|
67
|
+
if (typeof fill === 'function') {
|
|
68
|
+
const child = fill({...fillProps, key: i});
|
|
69
|
+
return <div data-slot-name={`slot-${name}`}>{child}</div>;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
});
|
|
60
73
|
return fills;
|
|
61
74
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
65
|
-
return Children.map(fillChildren, (child, childIndex) => {
|
|
66
|
-
if (!child || typeof child === 'string') {
|
|
67
|
-
return child;
|
|
68
|
-
}
|
|
69
|
-
const childKey = child.key || childIndex;
|
|
70
|
-
return cloneElement(child, { key: childKey });
|
|
71
|
-
});
|
|
72
|
-
})
|
|
73
|
-
.filter(
|
|
74
|
-
// In some cases fills are rendered only when some conditions apply.
|
|
75
|
-
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
76
|
-
// it allows us to render wrappers only when the fills are actually present.
|
|
77
|
-
(element) => !isEmptyElement(element));
|
|
78
|
-
return React__default.createElement(React__default.Fragment, null, isFunction(children) ? children(fills) : fills);
|
|
75
|
+
*/
|
|
76
|
+
return null;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
const Slot = (props) => {
|
|
82
|
-
const serverMode =
|
|
80
|
+
const serverMode = typeof window === 'undefined';
|
|
83
81
|
return (React__default.createElement(Consumer, null, ({ registerSlot, unregisterSlot, getFills }) => (React__default.createElement(SlotComponent, { ...props,
|
|
84
|
-
// We need to add id to fillProps with slot name,
|
|
82
|
+
// We need to add id to fillProps with slot name,
|
|
85
83
|
// so that we can use it when remove the component during hydration.
|
|
86
84
|
getFills: getFills, registerSlot: registerSlot, unregisterSlot: unregisterSlot, serverMode: serverMode }))));
|
|
87
85
|
};export{Slot as default};//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sources":["../../../src/slot-fill/base/slot.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slot.js","sources":["../../../src/slot-fill/base/slot.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"mQAUA,MAAM,aAAc,SAAQ,SAAmC,CAAA;AACnD,IAAA,IAAI,CAAU;AACd,IAAA,WAAW,CAAU;AAC7B,IAAA,WAAA,CAAY,KAA2B,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;AACb,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5C;IAEM,iBAAiB,GAAA;QACpB,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChD,IAAI,CAAC,UAAU,EAAE;YACb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SACvC;KACJ;IAEM,oBAAoB,GAAA;AACvB,QAAA,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;AACtC,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KACzC;AAEM,IAAA,kBAAkB,CAAC,SAAS,EAAA;QACgB,IAAI,CAAC,MAAM;;;;;;KAO7D;AAEM,IAAA,QAAQ,CAAC,IAAa,EAAA;AACzB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KACpB;IAED,WAAW,GAAA;AACP,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,OAAO;SACV;AACD,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACxB,KAAK,CAAC,WAAW,EAAE,CAAC;SACvB;KACJ;IAEM,M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,QAAA,OAAO,IAAI,CAAC;KACf;AACJ,CAAA;AAED,MAAM,IAAI,GAAG,CAAC,KAAiB,KAAI;AAC/B,IAAA,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AACjD,IAAA,QACIA,cAAC,CAAA,aAAA,CAAA,QAAQ,QACJ,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MACxCA,cAAC,CAAA,aAAA,CAAA,aAAa,OACN,KAAK;;;AAGT,QAAA,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,GACxB,CACL,CACM,EACb;AACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/slot-fill/index.tsx"],"sourcesContent":[null],"names":["React","BaseFill","BubblesVirtuallyFill","BaseSlot","BubblesVirtuallySlotFillProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/slot-fill/index.tsx"],"sourcesContent":[null],"names":["React","BaseFill","BubblesVirtuallyFill","BaseSlot","BubblesVirtuallySlotFillProvider"],"mappings":"6ZAaM,SAAU,IAAI,CAAC,KAAK,EAAA;;;;AAItB,IAAA,QACIA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;QACIA,cAAC,CAAA,aAAA,CAAAC,MAAQ,EAAK,EAAA,GAAA,KAAK,EAAI,CAAA;AACvB,QAAAD,cAAA,CAAA,aAAA,CAACE,MAAoB,EAAK,EAAA,GAAA,KAAK,EAAI,CAAA,CACpC,EACL;AACN,CAAC;AAEY,MAAA,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAc,EAAE,GAAG,KAAI;IAC/E,IAAI,gBAAgB,EAAE;QAClB,OAAOF,cAAA,CAAA,aAAA,CAAC,oBAAoB,EAAK,EAAA,GAAA,KAAK,EAAE,GAAG,EAAE,GAAG,EAAA,CAAI,CAAC;KACxD;AACD,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAAG,MAAQ,EAAK,EAAA,GAAA,KAAK,GAAI,CAAC;AACnC,CAAC,EAAE;AAEG,SAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAA;AAC3C,IAAA,QACIH,cAAA,CAAA,aAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA;AACvB,QAAAA,cAAA,CAAA,aAAA,CAACI,kBAAgC,EAAE,IAAA,EAAA,QAAQ,CAAoC,CAChE,EACrB;AACN,CAAC;AAEK,SAAU,cAAc,CAAkC,IAAY,EAAA;AACxE,IAAA,MAAM,aAAa,GAAG,CAAC,KAAyB,KAAKJ,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;AACrF,IAAA,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAE1C,IAAA,MAAM,aAAa,GAAG,CAAC,KAAuB,KAAKA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;AACnF,IAAA,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAC1C,IAAA,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC;IAEpC,OAAO;AACH,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,IAAI,EAAE,aAAa;KACtB,CAAC;AACN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, Component } from 'react';
|
|
2
|
+
import { IPlugin } from '@common-stack/client-core';
|
|
2
3
|
export type Name = string | Symbol;
|
|
3
4
|
export interface IFillProps {
|
|
4
5
|
name: Name;
|
|
@@ -82,3 +83,8 @@ export interface ISlotProps {
|
|
|
82
83
|
*/
|
|
83
84
|
serverMode?: boolean;
|
|
84
85
|
}
|
|
86
|
+
export interface ILoadedPlugin extends IPlugin {
|
|
87
|
+
index?: number;
|
|
88
|
+
Component?: React.ComponentType<any>;
|
|
89
|
+
loaderData?: Record<string, any>;
|
|
90
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export * from './isEmptyElement';
|
|
2
2
|
export * from './removeUniversalPortals';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Whether the argument is a function.
|
|
5
|
+
*
|
|
6
|
+
* @param {*} maybeFunc The argument to check.
|
|
7
|
+
* @returns {boolean} True if the argument is a function, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isFunction(maybeFunc: any): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the argument is a function.
|
|
3
|
+
*
|
|
4
|
+
* @param {*} maybeFunc The argument to check.
|
|
5
|
+
* @returns {boolean} True if the argument is a function, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
function isFunction(maybeFunc) {
|
|
8
|
+
return typeof maybeFunc === 'function';
|
|
9
|
+
}export{isFunction};//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/slot-fill/utils/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;;;;;AAKG;AACG,SAAU,UAAU,CAAC,SAAc,EAAA;AACrC,IAAA,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC;AAC3C"}
|
|
@@ -11,5 +11,8 @@ const isEmptyElement = (element) => {
|
|
|
11
11
|
if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
|
|
12
12
|
return !element.length;
|
|
13
13
|
}
|
|
14
|
+
if (typeof element === 'object' && element !== null) {
|
|
15
|
+
return Object.keys(element).length === 0 || Object.values(element).every((value) => isEmptyElement(value));
|
|
16
|
+
}
|
|
14
17
|
return !element;
|
|
15
18
|
};export{isEmptyElement};//# sourceMappingURL=isEmptyElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyElement.js","sources":["../../../src/slot-fill/utils/isEmptyElement.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AAEU,MAAA,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"isEmptyElement.js","sources":["../../../src/slot-fill/utils/isEmptyElement.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AAEU,MAAA,cAAc,GAAG,CAAC,OAAO,KAAI;AACtC,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,KAAK,CAAC;KAChB;AAED,IAAA,IAAI,OAAO,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAClE,QAAA,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;KAC1B;IAED,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;AACjD,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;KAC9G;IAED,OAAO,CAAC,OAAO,CAAC;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeUniversalPortals.js","sources":["../../../src/slot-fill/utils/removeUniversalPortals.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;AACU,MAAA,sBAAsB,GAAG,CAAC,KAAe,KAAI;
|
|
1
|
+
{"version":3,"file":"removeUniversalPortals.js","sources":["../../../src/slot-fill/utils/removeUniversalPortals.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;AACU,MAAA,sBAAsB,GAAG,CAAC,KAAe,KAAI;AACtD,IAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACjC,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACnB,YAAA,QAAQ,CAAC,gBAAgB,CAAC,CAAA,qBAAA,EAAwB,IAAI,CAAA,CAAA,CAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;gBACxE,IAAI,CAAC,MAAM,EAAE,CAAC;AAClB,aAAC,CAAC,CAAC;AACP,SAAC,CAAC,CAAC;KACN;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/components-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1-alpha.0",
|
|
4
4
|
"description": "browser plugin for git",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/cdmbase/fullstack-pro.git"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
13
|
+
"license": "UNLICENSED",
|
|
14
14
|
"author": "CDMBase LLC",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "lib/index.js",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"build:lib:watch": "npm run build:lib -- --watch",
|
|
25
25
|
"jest": "./node_modules/.bin/jest",
|
|
26
26
|
"prepublish": "npm run build",
|
|
27
|
-
"test": "
|
|
27
|
+
"test": "vitest",
|
|
28
28
|
"test:debug": "npm test -- --runInBand",
|
|
29
29
|
"test:watch": "npm test -- --watch",
|
|
30
30
|
"watch": "npm run build:lib:watch"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@common-stack/client-core": "8.1.1-alpha.0",
|
|
33
34
|
"@wordpress/element": "^5.30.0",
|
|
34
35
|
"@wordpress/hooks": "^3.53.0",
|
|
35
36
|
"@wordpress/is-shallow-equal": "^4.53.0",
|
|
36
37
|
"@wordpress/warning": "^2.53.0",
|
|
37
|
-
"cheerio": "^1.0.0",
|
|
38
38
|
"history-with-query": "^4.10.4",
|
|
39
39
|
"sort-keys": "^4.1.0",
|
|
40
40
|
"valtio": "^1.7.0"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"typescript": {
|
|
53
53
|
"definition": "lib/index.d.ts"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "7fc661e44322b602d561e42de8cb121048ef444f"
|
|
56
56
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replace the wrapped dom element with `[data-slot-name]` to its children,
|
|
3
|
-
* setting attrib [data-slot-name] same as parent.
|
|
4
|
-
*
|
|
5
|
-
* @param htmlContent Html content string.
|
|
6
|
-
* @param fills fill names.
|
|
7
|
-
* @returns The replaced html content string.
|
|
8
|
-
*/
|
|
9
|
-
export declare const replaceServerFills: (htmlContent: string, fills: string[]) => string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import*as cheerio from'cheerio';/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable no-param-reassign */
|
|
3
|
-
/**
|
|
4
|
-
* Replace the wrapped dom element with `[data-slot-name]` to its children,
|
|
5
|
-
* setting attrib [data-slot-name] same as parent.
|
|
6
|
-
*
|
|
7
|
-
* @param htmlContent Html content string.
|
|
8
|
-
* @param fills fill names.
|
|
9
|
-
* @returns The replaced html content string.
|
|
10
|
-
*/
|
|
11
|
-
const replaceServerFills = (htmlContent, fills) => {
|
|
12
|
-
const $ = cheerio.load(htmlContent);
|
|
13
|
-
let newContent = htmlContent;
|
|
14
|
-
fills.forEach((name) => {
|
|
15
|
-
$(`[data-slot-name=slot-${name}]`).each((i, node) => {
|
|
16
|
-
const search = $(node).prop('outerHTML');
|
|
17
|
-
node.children.forEach((child) => {
|
|
18
|
-
child.attribs['data-slot-name'] = `slot-${name}`;
|
|
19
|
-
});
|
|
20
|
-
const replace = $(node).html() || '';
|
|
21
|
-
newContent = newContent.replace(search, replace);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
return newContent;
|
|
25
|
-
};export{replaceServerFills};//# sourceMappingURL=replaceServerFills.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replaceServerFills.js","sources":["../../../src/slot-fill/utils/replaceServerFills.ts"],"sourcesContent":[null],"names":[],"mappings":"gCAAA;AACA;AAEA;;;;;;;AAOG;MACU,kBAAkB,GAAG,CAAC,WAAmB,EAAE,KAAe,KAAI;IACvE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,UAAU,GAAG,WAAW,CAAC;AAE7B,IAAA,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACnB,QAAA,CAAC,CAAC,CAAA,qBAAA,EAAwB,IAAI,CAAA,CAAA,CAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,KAAI;YAChD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;gBAC3B,KAAoC,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAA,KAAA,EAAQ,IAAI,CAAA,CAAE,CAAC;AACrF,aAAC,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YACrC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrD,SAAC,CAAC,CAAC;AACP,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,UAAU,CAAC;AACtB"}
|