@common-stack/components-pro 3.0.2-alpha.4 → 3.0.3-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/lib/index.d.ts +2 -2
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/index.native.js +1 -2
- package/lib/index.native.js.map +1 -1
- package/lib/slot-fill/base/context.js +2 -6
- package/lib/slot-fill/base/context.js.map +1 -1
- package/lib/slot-fill/base/fill.js +4 -10
- package/lib/slot-fill/base/fill.js.map +1 -1
- package/lib/slot-fill/base/provider.js +4 -10
- package/lib/slot-fill/base/provider.js.map +1 -1
- package/lib/slot-fill/base/slot.js +10 -16
- package/lib/slot-fill/base/slot.js.map +1 -1
- package/lib/slot-fill/base/use-slot.js +3 -6
- package/lib/slot-fill/base/use-slot.js.map +1 -1
- package/lib/slot-fill/bubbles-virtually/fill.js +4 -19
- package/lib/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/lib/slot-fill/bubbles-virtually/slot-fill-context.js +2 -7
- package/lib/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/lib/slot-fill/bubbles-virtually/slot-fill-provider.js +15 -21
- package/lib/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/lib/slot-fill/bubbles-virtually/slot.js +4 -20
- package/lib/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/lib/slot-fill/bubbles-virtually/use-slot.js +8 -20
- package/lib/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/lib/slot-fill/index.js +14 -39
- package/lib/slot-fill/index.js.map +1 -1
- package/lib/slot-fill/utils/isEmptyElement.js +3 -4
- package/lib/slot-fill/utils/isEmptyElement.js.map +1 -1
- package/lib/slot-fill/utils/removeUniversalPortals.js +2 -3
- package/lib/slot-fill/utils/removeUniversalPortals.js.map +1 -1
- package/lib/slot-fill/utils/replaceServerFills.js +3 -5
- package/lib/slot-fill/utils/replaceServerFills.js.map +1 -1
- package/package.json +5 -4
- package/lib/slot-fill/__tests__/filler-slot.test.js +0 -42
- package/lib/slot-fill/__tests__/filler-slot.test.js.map +0 -1
- package/lib/slot-fill/__tests__/slot-features.test.js +0 -208
- package/lib/slot-fill/__tests__/slot-features.test.js.map +0 -1
- package/lib/slot-fill/__tests__/slot-fill-provider.test.d.ts +0 -0
- package/lib/slot-fill/__tests__/slot-fill-provider.test.js +0 -58
- package/lib/slot-fill/__tests__/slot-fill-provider.test.js.map +0 -1
- package/lib/slot-fill/bubbles-virtually/use-slot-fills.js +0 -12
- package/lib/slot-fill/bubbles-virtually/use-slot-fills.js.map +0 -1
- package/lib/slot-fill/index.native.js +0 -20
- package/lib/slot-fill/index.native.js.map +0 -1
- package/lib/slot-fill/interfaces/index.js +0 -2
- package/lib/slot-fill/interfaces/index.js.map +0 -1
- package/lib/slot-fill/utils/index.js +0 -4
- package/lib/slot-fill/utils/index.js.map +0 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot
|
|
2
|
-
export { removeUniversalPortals, replaceServerFills
|
|
1
|
+
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot } from './slot-fill';
|
|
2
|
+
export { removeUniversalPortals, replaceServerFills } from './slot-fill/utils';
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { removeUniversalPortals, replaceServerFills, } from './slot-fill/utils';
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{removeUniversalPortals}from'./slot-fill/utils/removeUniversalPortals.js';export{replaceServerFills}from'./slot-fill/utils/replaceServerFills.js';export{default as __experimentalUseSlot}from'./slot-fill/bubbles-virtually/use-slot.js';//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/index.native.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';//# sourceMappingURL=index.native.js.map
|
package/lib/index.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","
|
|
1
|
+
{"version":3,"file":"index.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const SlotFillContext = React.createContext({
|
|
1
|
+
import*as React from'react';const SlotFillContext = React.createContext({
|
|
3
2
|
registerSlot: () => { },
|
|
4
3
|
unregisterSlot: () => { },
|
|
5
4
|
registerFill: () => { },
|
|
@@ -9,7 +8,4 @@ const SlotFillContext = React.createContext({
|
|
|
9
8
|
hasFills: () => false,
|
|
10
9
|
subscribe: () => { },
|
|
11
10
|
});
|
|
12
|
-
const { Provider, Consumer } = SlotFillContext;
|
|
13
|
-
export { Consumer, Provider };
|
|
14
|
-
export default SlotFillContext;
|
|
15
|
-
//# sourceMappingURL=context.js.map
|
|
11
|
+
const { Provider, Consumer } = SlotFillContext;export{Consumer,Provider,SlotFillContext as default};//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","
|
|
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;AAC3D,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,OAAO,EAAE,CAAC;AACpB,IAAA,QAAQ,EAAE,MAAM,KAAK;AACrB,IAAA,SAAS,EAAE,MAAK,GAAG;AACpB,CAAA,EAAE;AACH,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
|
-
import { Consumer } from './context';
|
|
4
|
-
import { useSlot } from './use-slot';
|
|
5
|
-
const FillComponent = ({ name, children, registerFill, unregisterFill, serverMode }) => {
|
|
1
|
+
import React__default,{useRef}from'react';import {createPortal}from'react-dom';import {Consumer}from'./context.js';import {useSlot}from'./use-slot.js';const FillComponent = ({ name, children, registerFill, unregisterFill, serverMode }) => {
|
|
6
2
|
const slot = useSlot(name);
|
|
7
3
|
let useLayoutEffect;
|
|
8
4
|
if (serverMode) {
|
|
@@ -13,7 +9,7 @@ const FillComponent = ({ name, children, registerFill, unregisterFill, serverMod
|
|
|
13
9
|
return null;
|
|
14
10
|
}
|
|
15
11
|
else {
|
|
16
|
-
useLayoutEffect =
|
|
12
|
+
useLayoutEffect = React__default.useLayoutEffect;
|
|
17
13
|
}
|
|
18
14
|
const ref = useRef({
|
|
19
15
|
name,
|
|
@@ -59,7 +55,5 @@ const FillComponent = ({ name, children, registerFill, unregisterFill, serverMod
|
|
|
59
55
|
};
|
|
60
56
|
const Fill = (props) => {
|
|
61
57
|
const serverMode = (typeof window === 'undefined');
|
|
62
|
-
return (
|
|
63
|
-
};
|
|
64
|
-
export default Fill;
|
|
65
|
-
//# sourceMappingURL=fill.js.map
|
|
58
|
+
return (React__default.createElement(Consumer, null, ({ registerFill, unregisterFill }) => (React__default.createElement(FillComponent, { ...props, registerFill: registerFill, unregisterFill: unregisterFill, serverMode: serverMode }))));
|
|
59
|
+
};export{Fill as default};//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.js","
|
|
1
|
+
{"version":3,"file":"fill.js","sources":["../../../src/slot-fill/base/fill.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"uJASA,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAyB,KAAI;AAC1G,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,IAAA,IAAI,eAAe,CAAC;AAEpB,IAAA,IAAI,UAAU,EAAE;AACZ,QAAA,eAAe,GAAG,CAAC,IAAI,KAAI,GAAG,CAAC;AAC/B,QAAA,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE;AACtB,YAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChC,SAAA;AACD,QAAA,OAAO,IAAI,CAAC;AACf,KAAA;AAAM,SAAA;AACH,QAAA,eAAe,GAAGA,cAAK,CAAC,eAAe,CAAC;AAC3C,KAAA;IAED,MAAM,GAAG,GAAG,MAAM,CAAC;QACf,IAAI;QACJ,QAAQ;AACX,KAAA,CAAC,CAAC;IAEH,eAAe,CAAC,MAAK;AACjB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC;AAC7B,QAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7B,OAAO,MAAM,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;;;;KAI/C,EAAE,EAAE,CAAC,CAAC;IAEP,eAAe,CAAC,MAAK;AACjB,QAAA,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,QAAA,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,WAAW,EAAE,CAAC;AACtB,SAAA;;;;AAIL,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,eAAe,CAAC,MAAK;AACjB,QAAA,IAAI,IAAI,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;;YAE3B,OAAO;AACV,SAAA;QACD,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AAC9C,QAAA,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,QAAA,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;AAIpC,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAEX,IAAA,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;AACf,KAAA;;AAGD,IAAA,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;QAChC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC7C,KAAA;IAED,OAAO,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAOF,MAAM,IAAI,GAAmB,CAAC,KAAK,KAAI;IACnC,MAAM,UAAU,IAAI,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC;AACnD,IAAA,QACIA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,IAAA,EACJ,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,MAC9BA,6BAAC,aAAa,EAAA,EAAA,GACN,KAAK,EACT,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EAAA,CACxB,CACL,CACM,EACb;AACN"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { sortBy } from 'lodash';
|
|
3
|
-
import { Provider } from './context';
|
|
4
|
-
class SlotFillProvider extends Component {
|
|
1
|
+
import React__default,{Component}from'react';import {sortBy}from'lodash-es';import {Provider}from'./context.js';class SlotFillProvider extends Component {
|
|
5
2
|
constructor(props) {
|
|
6
3
|
super(props);
|
|
7
4
|
this.registerSlot = this.registerSlot.bind(this);
|
|
@@ -59,8 +56,7 @@ class SlotFillProvider extends Component {
|
|
|
59
56
|
this.triggerListeners();
|
|
60
57
|
}
|
|
61
58
|
unregisterFill(name, instance) {
|
|
62
|
-
|
|
63
|
-
this.fills[name] = (_b = (_a = this.fills[name]) === null || _a === void 0 ? void 0 : _a.filter((fill) => fill !== instance)) !== null && _b !== void 0 ? _b : [];
|
|
59
|
+
this.fills[name] = this.fills[name]?.filter((fill) => fill !== instance) ?? [];
|
|
64
60
|
this.forceUpdateSlot(name);
|
|
65
61
|
}
|
|
66
62
|
getSlot(name) {
|
|
@@ -94,8 +90,6 @@ class SlotFillProvider extends Component {
|
|
|
94
90
|
};
|
|
95
91
|
}
|
|
96
92
|
render() {
|
|
97
|
-
return
|
|
93
|
+
return React__default.createElement(Provider, { value: this.contextValue }, this.props.children);
|
|
98
94
|
}
|
|
99
|
-
}
|
|
100
|
-
export default SlotFillProvider;
|
|
101
|
-
//# sourceMappingURL=provider.js.map
|
|
95
|
+
}export{SlotFillProvider as default};//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../../src/slot-fill/base/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"gHAKA,MAAM,gBAAiB,SAAQ,SAAsC,CAAA;AAMjE,IAAA,WAAA,CAAY,KAAK,EAAA;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,GAAG,IA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AI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;KACzD;AAEO,IAAA,eAAe,CAAC,IAAI,EAAA;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAA,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,WAAW,EAAE,CAAC;AACtB,SAAA;KACJ;IAEO,gBAAgB,GAAA;AACpB,QAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC,CAAC;KACpD;AAEM,IAAA,SAAS,CAAC,QAAQ,EAAA;AACrB,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE9B,QAAA,OAAO,MAAK;AACR,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAE,CAAE,CAAC,KAAM,CAAC,KAAK,QAAQ,CAAE,CAAC;AACtE,SAAC,CAAC;KACL;IAEM,MAAM,GAAA;AACT,QAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,KAAK,EAAE,IAAI,CAAC,YAAY,EAAA,EAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAY,CAAC;KAC/E;AACJ"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Consumer } from './context';
|
|
3
|
-
import { isEmptyElement } from '../utils/isEmptyElement';
|
|
4
|
-
/**
|
|
1
|
+
import React__default,{Component,Children,cloneElement}from'react';import {Consumer}from'./context.js';import {isEmptyElement}from'../utils/isEmptyElement.js';/**
|
|
5
2
|
* Whether the argument is a function.
|
|
6
3
|
*
|
|
7
4
|
* @param {*} maybeFunc The argument to check.
|
|
@@ -28,7 +25,7 @@ class SlotComponent extends Component {
|
|
|
28
25
|
unregisterSlot(this.props.name, this);
|
|
29
26
|
}
|
|
30
27
|
componentDidUpdate(prevProps) {
|
|
31
|
-
|
|
28
|
+
this.props;
|
|
32
29
|
// Commented following as we need the Slot to render at multiple places
|
|
33
30
|
// if (prevProps.name !== name) {
|
|
34
31
|
// unregisterSlot(prevProps.name);
|
|
@@ -47,21 +44,20 @@ class SlotComponent extends Component {
|
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
render() {
|
|
50
|
-
var _a, _b;
|
|
51
47
|
const { children, name, fillProps = {}, getFills, serverMode } = this.props;
|
|
52
48
|
if (serverMode) {
|
|
53
|
-
const fills = (
|
|
49
|
+
const fills = (getFills(name, this) ?? [])
|
|
54
50
|
.map((fill, i) => {
|
|
55
51
|
// unregisterFill(name, fill);
|
|
56
52
|
if (typeof fill === 'function') {
|
|
57
|
-
const child = fill(
|
|
58
|
-
return
|
|
53
|
+
const child = fill({ ...fillProps, key: i });
|
|
54
|
+
return React__default.createElement("div", { "data-slot-name": `slot-${name}` }, child);
|
|
59
55
|
}
|
|
60
56
|
return null;
|
|
61
57
|
});
|
|
62
58
|
return fills;
|
|
63
59
|
}
|
|
64
|
-
const fills = (
|
|
60
|
+
const fills = (getFills(name, this) ?? [])
|
|
65
61
|
.map((fill) => {
|
|
66
62
|
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
67
63
|
return Children.map(fillChildren, (child, childIndex) => {
|
|
@@ -77,15 +73,13 @@ class SlotComponent extends Component {
|
|
|
77
73
|
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
78
74
|
// it allows us to render wrappers only when the fills are actually present.
|
|
79
75
|
(element) => !isEmptyElement(element));
|
|
80
|
-
return
|
|
76
|
+
return React__default.createElement(React__default.Fragment, null, isFunction(children) ? children(fills) : fills);
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
const Slot = (props) => {
|
|
84
80
|
const serverMode = (typeof window === 'undefined');
|
|
85
|
-
return (
|
|
81
|
+
return (React__default.createElement(Consumer, null, ({ registerSlot, unregisterSlot, getFills }) => (React__default.createElement(SlotComponent, { ...props,
|
|
86
82
|
// We need to add id to fillProps with slot name,
|
|
87
83
|
// so that we can use it when remove the component during hydration.
|
|
88
|
-
getFills: getFills, registerSlot: registerSlot, unregisterSlot: unregisterSlot, serverMode: serverMode }))))
|
|
89
|
-
};
|
|
90
|
-
export default Slot;
|
|
91
|
-
//# sourceMappingURL=slot.js.map
|
|
84
|
+
getFills: getFills, registerSlot: registerSlot, unregisterSlot: unregisterSlot, serverMode: serverMode }))));
|
|
85
|
+
};export{Slot as default};//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","
|
|
1
|
+
{"version":3,"file":"slot.js","sources":["../../../src/slot-fill/base/slot.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"+JASA;;;;;AAKG;AACH,SAAS,UAAU,CAAC,SAAS,EAAA;AACzB,IAAA,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC;AAC3C,CAAC;AAED,MAAM,aAAc,SAAQ,SAAmC,CAAA;AAG3D,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;AACvC,SAAA;KACJ;IAEM,oBAAoB,GAAA;AACvB,QAAA,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;AACtC,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;Q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ext from'./context.js';/**
|
|
4
2
|
* React hook returning the active slot given a name.
|
|
5
3
|
*
|
|
6
4
|
* @param {string} name Slot name.
|
|
7
5
|
* @return {Object} Slot object.
|
|
8
6
|
*/
|
|
9
|
-
|
|
7
|
+
const useSlot = (name) => {
|
|
10
8
|
const { getSlot, subscribe } = useContext(SlotFillContext);
|
|
11
9
|
const [slot, setSlot] = useState(getSlot(name));
|
|
12
10
|
useEffect(() => {
|
|
@@ -20,5 +18,4 @@ export const useSlot = (name) => {
|
|
|
20
18
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
19
|
}, [name]);
|
|
22
20
|
return slot;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=use-slot.js.map
|
|
21
|
+
};export{useSlot};//# sourceMappingURL=use-slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slot.js","
|
|
1
|
+
{"version":3,"file":"use-slot.js","sources":["../../../src/slot-fill/base/use-slot.ts"],"sourcesContent":[null],"names":[],"mappings":"4FAGA;;;;;AAKG;AACU,MAAA,OAAO,GAAG,CAAC,IAAI,KAAI;IAC5B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAC3D,IAAA,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhD,SAAS,CAAC,MAAK;AACX,QAAA,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACvB,QAAA,MAAM,WAAW,GAAG,SAAS,CAAC,MAAK;AAC/B,YAAA,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3B,SAAC,CAAC,CAAC;AACH,QAAA,OAAO,WAAW,CAAC;;;;AAIvB,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACX,IAAA,OAAO,IAAI,CAAC;AAChB"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { useRef, useState, useEffect } from 'react';
|
|
13
|
-
import { createPortal } from 'react-dom';
|
|
14
|
-
import useSlot from './use-slot';
|
|
15
|
-
function useForceUpdate() {
|
|
1
|
+
import {useRef,useEffect,useState}from'react';import {createPortal}from'react-dom';import useSlot from'./use-slot.js';function useForceUpdate() {
|
|
16
2
|
const [, setState] = useState({});
|
|
17
3
|
const mounted = useRef(true);
|
|
18
4
|
useEffect(() => {
|
|
@@ -26,8 +12,8 @@ function useForceUpdate() {
|
|
|
26
12
|
}
|
|
27
13
|
};
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
15
|
+
function Fill({ name, children }) {
|
|
16
|
+
const { registerFill, unregisterFill, ...slot } = useSlot(name);
|
|
31
17
|
const ref = useRef({ rerender: useForceUpdate() });
|
|
32
18
|
useEffect(() => {
|
|
33
19
|
// We register fills so we can keep track of their existence.
|
|
@@ -55,5 +41,4 @@ export default function Fill({ name, children }) {
|
|
|
55
41
|
// </StyleProvider>
|
|
56
42
|
// );
|
|
57
43
|
return createPortal(children, slot.ref.current);
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=fill.js.map
|
|
44
|
+
}export{Fill as default};//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.js","
|
|
1
|
+
{"version":3,"file":"fill.js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CAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC;AACnD"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { proxyMap } from 'valtio/utils';
|
|
3
|
-
import warning from '@wordpress/warning';
|
|
4
|
-
const SlotFillContext = createContext({
|
|
1
|
+
import {createContext}from'react';import {proxyMap}from'valtio/utils';import warning from'@wordpress/warning';const SlotFillContext = createContext({
|
|
5
2
|
slots: proxyMap(),
|
|
6
3
|
fills: proxyMap(),
|
|
7
4
|
registerSlot: () => {
|
|
@@ -12,6 +9,4 @@ const SlotFillContext = createContext({
|
|
|
12
9
|
unregisterSlot: () => { },
|
|
13
10
|
registerFill: () => { },
|
|
14
11
|
unregisterFill: () => { },
|
|
15
|
-
});
|
|
16
|
-
export default SlotFillContext;
|
|
17
|
-
//# sourceMappingURL=slot-fill-context.js.map
|
|
12
|
+
});export{SlotFillContext as default};//# sourceMappingURL=slot-fill-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-fill-context.js","
|
|
1
|
+
{"version":3,"file":"slot-fill-context.js","sources":["../../../src/slot-fill/bubbles-virtually/slot-fill-context.ts"],"sourcesContent":[null],"names":[],"mappings":"8GAKM,MAAA,eAAe,GAAG,aAAa,CAAwB;IAC5D,KAAK,EAAE,QAAQ,EAAE;IACjB,KAAK,EAAE,QAAQ,EAAE;IACjB,YAAY,EAAE,MAAK;AAClB,QAAA,OAAO,CACN,wDAAwD;AACvD,YAAA,wEAAwE,CACzE,CAAC;KACF;AACD,IAAA,UAAU,EAAE,MAAK,GAAG;AACpB,IAAA,cAAc,EAAE,MAAK,GAAG;AACxB,IAAA,YAAY,EAAE,MAAK,GAAG;AACtB,IAAA,cAAc,EAAE,MAAK,GAAG;AACxB,CAAA"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ref as valRef } from 'valtio';
|
|
3
|
-
import { proxyMap } from 'valtio/utils';
|
|
4
|
-
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import SlotFillContext from './slot-fill-context';
|
|
9
|
-
function useSlotRegistry() {
|
|
1
|
+
import React__default,{useRef,useCallback,useMemo}from'react';import {ref}from'valtio';import {proxyMap}from'valtio/utils';import isShallowEqual from'@wordpress/is-shallow-equal';import SlotFillContext from'./slot-fill-context.js';function useSlotRegistry() {
|
|
10
2
|
const slots = useRef(proxyMap()); // TODO remove any
|
|
11
3
|
const fills = useRef(proxyMap()); // TODO remove any
|
|
12
|
-
const registerSlot = useCallback((name, ref, fillProps) => {
|
|
4
|
+
const registerSlot = useCallback((name, ref$1, fillProps) => {
|
|
13
5
|
const slot = slots.current.get(name) || {};
|
|
14
|
-
slots.current.set(name,
|
|
6
|
+
slots.current.set(name, ref({
|
|
7
|
+
...slot,
|
|
8
|
+
ref: ref$1 || slot.ref,
|
|
9
|
+
fillProps: fillProps || slot.fillProps || {},
|
|
10
|
+
}));
|
|
15
11
|
}, []);
|
|
16
12
|
const unregisterSlot = useCallback((name, ref) => {
|
|
17
|
-
var _a;
|
|
18
13
|
// Make sure we're not unregistering a slot registered by another element
|
|
19
14
|
// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
|
|
20
|
-
if (
|
|
15
|
+
if (slots.current.get(name)?.ref === ref) {
|
|
21
16
|
slots.current.delete(name);
|
|
22
17
|
}
|
|
23
18
|
}, []);
|
|
@@ -35,12 +30,12 @@ function useSlotRegistry() {
|
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
32
|
}, []);
|
|
38
|
-
const registerFill = useCallback((name, ref) => {
|
|
39
|
-
fills.current.set(name,
|
|
33
|
+
const registerFill = useCallback((name, ref$1) => {
|
|
34
|
+
fills.current.set(name, ref([...(fills.current.get(name) || []), ref$1]));
|
|
40
35
|
}, []);
|
|
41
|
-
const unregisterFill = useCallback((name, ref) => {
|
|
36
|
+
const unregisterFill = useCallback((name, ref$1) => {
|
|
42
37
|
if (fills.current.get(name)) {
|
|
43
|
-
fills.current.set(name,
|
|
38
|
+
fills.current.set(name, ref(fills.current.get(name).filter((fillRef) => fillRef !== ref$1)));
|
|
44
39
|
}
|
|
45
40
|
}, []);
|
|
46
41
|
// Memoizing the return value so it can be directly passed to Provider value
|
|
@@ -55,8 +50,7 @@ function useSlotRegistry() {
|
|
|
55
50
|
}), [registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
|
|
56
51
|
return registry;
|
|
57
52
|
}
|
|
58
|
-
|
|
53
|
+
function SlotFillProvider({ children }) {
|
|
59
54
|
const registry = useSlotRegistry();
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=slot-fill-provider.js.map
|
|
55
|
+
return React__default.createElement(SlotFillContext.Provider, { value: registry }, children);
|
|
56
|
+
}export{SlotFillProvider as default};//# sourceMappingURL=slot-fill-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-fill-provider.js","
|
|
1
|
+
{"version":3,"file":"slot-fill-provider.js","sources":["../../../src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":[null],"names":["ref","valRef","React"],"mappings":"uOAWA,SAAS,eAAe,GAAA;IACpB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAY,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAY,CAAC,CAAC;IAE3C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,IAAI,EAAEA,KAAG,EAAE,SAAS,KAAI;AACtD,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,GAAG,CACb,IAAI,EACJC,GAAM,CAAC;AACH,YAAA,GAAG,IAAI;AACP,YAAA,GAAG,EAAED,KAAG,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,EAAED,KAAG,CAAC,CAAC,CAAC,CAAC;KAC9E,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,IAAI,EAAEA,KAAG,KAAI;QAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzB,YAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAEC,GAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,KAAK,OAAO,KAAKD,KAAG,CAAC,CAAC,CAAC,CAAC;AACjG,SAAA;KACJ,EAAE,EAAE,CAAC,CAAC;;AAGP,IAAA,MAAM,QAAQ,GAAG,OAAO,CACpB,OAAO;QACH,KAAK,EAAE,KAAK,CAAC,OAAO;QACpB,KAAK,EAAE,KAAK,CAAC,OAAO;QACpB,YAAY;QACZ,UAAU;QACV,cAAc;QACd,YAAY;QACZ,cAAc;AACjB,KAAA,CAAC,EACF,CAAC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,CAAC,CAC3E,CAAC;AAEF,IAAA,OAAO,QAAQ,CAAC;AACpB,CAAC;AAEa,SAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAA;AACjD,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAOE,cAAA,CAAA,aAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,EAAG,QAAQ,CAA4B,CAAC;AAC5F"}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { useRef, useLayoutEffect, useContext, forwardRef } from 'react';
|
|
13
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
14
|
-
import SlotFillContext from './slot-fill-context';
|
|
15
|
-
function Slot(_a, forwardedRef) {
|
|
16
|
-
var { name, fillProps = {}, as: Component = 'div' } = _a, props = __rest(_a, ["name", "fillProps", "as"]);
|
|
17
|
-
const _b = useContext(SlotFillContext), { registerSlot, unregisterSlot } = _b, registry = __rest(_b, ["registerSlot", "unregisterSlot"]);
|
|
1
|
+
import React__default,{forwardRef,useContext,useRef,useLayoutEffect}from'react';import {useMergeRefs}from'@wordpress/compose';import SlotFillContext from'./slot-fill-context.js';function Slot({ name, fillProps = {}, as: Component = 'div', ...props }, forwardedRef) {
|
|
2
|
+
const { registerSlot, unregisterSlot, ...registry } = useContext(SlotFillContext);
|
|
18
3
|
const ref = useRef();
|
|
19
4
|
useLayoutEffect(() => {
|
|
20
5
|
registerSlot(name, ref, fillProps);
|
|
@@ -30,7 +15,6 @@ function Slot(_a, forwardedRef) {
|
|
|
30
15
|
useLayoutEffect(() => {
|
|
31
16
|
registry.updateSlot(name, fillProps);
|
|
32
17
|
});
|
|
33
|
-
return
|
|
18
|
+
return React__default.createElement(Component, { ref: useMergeRefs([forwardedRef, ref]), ...props });
|
|
34
19
|
}
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=slot.js.map
|
|
20
|
+
var BubblesVirtuallySlot = forwardRef(Slot);export{BubblesVirtuallySlot as default};//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","
|
|
1
|
+
{"version":3,"file":"slot.js","sources":["../../../src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"kLAKA,SAAS,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,EAA6B,EAAE,YAAY,EAAA;AAC5G,IAAA,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAClF,IAAA,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IAErB,eAAe,CAAC,MAAK;AACjB,QAAA,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AACnC,QAAA,OAAO,MAAK;AACR,YAAA,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9B,SAAC,CAAC;;;;KAIL,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;;;IAGzC,eAAe,CAAC,MAAK;AACjB,QAAA,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACzC,KAAC,CAAC,CAAC;AAEH,IAAA,OAAOA,6BAAC,SAAS,EAAA,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,EAAM,GAAA,KAAK,GAAI,CAAC;AAC5E,CAAC;AAED,2BAAe,UAAU,CAAC,IAAI,CAAC"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { useCallback, useContext } from 'react';
|
|
13
|
-
import { useSnapshot } from 'valtio';
|
|
14
|
-
import SlotFillContext from './slot-fill-context';
|
|
15
|
-
export default function useSlot(name) {
|
|
16
|
-
const _a = useContext(SlotFillContext), { updateSlot: registryUpdateSlot, unregisterSlot: registryUnregisterSlot, registerFill: registryRegisterFill, unregisterFill: registryUnregisterFill } = _a, registry = __rest(_a, ["updateSlot", "unregisterSlot", "registerFill", "unregisterFill"]);
|
|
1
|
+
import {useContext,useCallback}from'react';import {useSnapshot}from'valtio';import SlotFillContext from'./slot-fill-context.js';function useSlot(name) {
|
|
2
|
+
const { updateSlot: registryUpdateSlot, unregisterSlot: registryUnregisterSlot, registerFill: registryRegisterFill, unregisterFill: registryUnregisterFill, ...registry } = useContext(SlotFillContext);
|
|
17
3
|
const slots = useSnapshot(registry.slots, { sync: true });
|
|
18
4
|
// The important bit here is that this call ensures
|
|
19
5
|
// the hook only causes a re-render if the slot
|
|
@@ -31,9 +17,11 @@ export default function useSlot(name) {
|
|
|
31
17
|
const unregisterFill = useCallback((fillRef) => {
|
|
32
18
|
registryUnregisterFill(name, fillRef);
|
|
33
19
|
}, [name, registryUnregisterFill]);
|
|
34
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
...slot,
|
|
22
|
+
updateSlot,
|
|
35
23
|
unregisterSlot,
|
|
36
24
|
registerFill,
|
|
37
|
-
unregisterFill
|
|
38
|
-
}
|
|
39
|
-
|
|
25
|
+
unregisterFill,
|
|
26
|
+
};
|
|
27
|
+
}export{useSlot as default};//# sourceMappingURL=use-slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slot.js","
|
|
1
|
+
{"version":3,"file":"use-slot.js","sources":["../../../src/slot-fill/bubbles-virtually/use-slot.tsx"],"sourcesContent":[null],"names":[],"mappings":"gIAKwB,SAAA,OAAO,CAAC,IAAU,EAAA;IACtC,MAAM,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2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { forwardRef } from 'react';
|
|
13
|
-
import BaseFill from './base/fill';
|
|
14
|
-
import BaseSlot from './base/slot';
|
|
15
|
-
import BubblesVirtuallyFill from './bubbles-virtually/fill';
|
|
16
|
-
import BubblesVirtuallySlot from './bubbles-virtually/slot';
|
|
17
|
-
import BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';
|
|
18
|
-
import SlotFillProvider from './base/provider';
|
|
19
|
-
import useSlot from './bubbles-virtually/use-slot';
|
|
20
|
-
export { default as useSlotFills } from './bubbles-virtually/use-slot-fills';
|
|
21
|
-
export function Fill(props) {
|
|
1
|
+
import React__default,{forwardRef}from'react';import Fill$1 from'./base/fill.js';import Slot$1 from'./base/slot.js';import Fill$2 from'./bubbles-virtually/fill.js';import BubblesVirtuallySlot from'./bubbles-virtually/slot.js';import SlotFillProvider$1 from'./bubbles-virtually/slot-fill-provider.js';import SlotFillProvider from'./base/provider.js';import'valtio';import'./bubbles-virtually/slot-fill-context.js';function Fill(props) {
|
|
22
2
|
// We're adding both Fills here so they can register themselves before
|
|
23
3
|
// their respective slot has been registered. Only the Fill that has a slot
|
|
24
4
|
// will render. The other one will return null.
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6
|
+
React__default.createElement(Fill$1, { ...props }),
|
|
7
|
+
React__default.createElement(Fill$2, { ...props })));
|
|
28
8
|
}
|
|
29
|
-
|
|
30
|
-
var { bubblesVirtually } = _a, props = __rest(_a, ["bubblesVirtually"]);
|
|
9
|
+
const Slot = forwardRef(({ bubblesVirtually, ...props }, ref) => {
|
|
31
10
|
if (bubblesVirtually) {
|
|
32
|
-
return
|
|
11
|
+
return React__default.createElement(BubblesVirtuallySlot, { ...props, ref: ref });
|
|
33
12
|
}
|
|
34
|
-
return
|
|
13
|
+
return React__default.createElement(Slot$1, { ...props });
|
|
35
14
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
React.createElement(BubblesVirtuallySlotFillProvider, null, children)));
|
|
15
|
+
function Provider({ children, ...props }) {
|
|
16
|
+
return (React__default.createElement(SlotFillProvider, { ...props },
|
|
17
|
+
React__default.createElement(SlotFillProvider$1, null, children)));
|
|
40
18
|
}
|
|
41
|
-
|
|
42
|
-
const FillComponent = (props) =>
|
|
19
|
+
function createSlotFill(name) {
|
|
20
|
+
const FillComponent = (props) => React__default.createElement(Fill, { name: name, ...props });
|
|
43
21
|
FillComponent.displayName = name + 'Fill';
|
|
44
|
-
const SlotComponent = (props) =>
|
|
22
|
+
const SlotComponent = (props) => React__default.createElement(Slot, { name: name, ...props });
|
|
45
23
|
SlotComponent.displayName = name + 'Slot';
|
|
46
24
|
SlotComponent.__unstableName = name;
|
|
47
25
|
return {
|
|
48
26
|
Fill: FillComponent,
|
|
49
27
|
Slot: SlotComponent,
|
|
50
28
|
};
|
|
51
|
-
}
|
|
52
|
-
export { SlotFillProvider };
|
|
53
|
-
export { useSlot };
|
|
54
|
-
//# sourceMappingURL=index.js.map
|
|
29
|
+
}export{Fill,Provider,Slot,SlotFillProvider,createSlotFill};//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/slot-fill/index.tsx"],"sourcesContent":[null],"names":["React","BaseFill","BubblesVirtuallyFill","B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AAKA,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;AACL,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,IAAI,EAAE,aAAa;KACpB,CAAC;AACJ"}
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* @param element React Component to check.
|
|
5
5
|
* @returns True when an element is considered empty.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const isEmptyElement = (element) => {
|
|
8
8
|
if (typeof element === 'number') {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
-
if (typeof
|
|
11
|
+
if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
|
|
12
12
|
return !element.length;
|
|
13
13
|
}
|
|
14
14
|
return !element;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=isEmptyElement.js.map
|
|
15
|
+
};export{isEmptyElement};//# sourceMappingURL=isEmptyElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyElement.js","
|
|
1
|
+
{"version":3,"file":"isEmptyElement.js","sources":["../../../src/slot-fill/utils/isEmptyElement.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AAEU,MAAA,cAAc,GAAG,CAAE,OAAO,KAAK;AAC3C,IAAA,IAAK,OAAO,OAAO,KAAK,QAAQ,EAAG;AAClC,QAAA,OAAO,KAAK,CAAC;AACb,KAAA;AAED,IAAA,IAAK,OAAO,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAE,OAAO,CAAE,EAAG;AACzE,QAAA,OAAO,CAAE,OAAO,CAAC,MAAM,CAAC;AACxB,KAAA;IAED,OAAO,CAAE,OAAO,CAAC;AAClB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Removes all universal portals from the DOM.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
const removeUniversalPortals = (fills) => {
|
|
5
5
|
if (typeof document !== 'undefined') {
|
|
6
6
|
fills.forEach((name) => {
|
|
7
7
|
document.querySelectorAll(`[data-slot-name=slot-${name}]`).forEach((node) => {
|
|
@@ -9,5 +9,4 @@ export const removeUniversalPortals = (fills) => {
|
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=removeUniversalPortals.js.map
|
|
12
|
+
};export{removeUniversalPortals};//# sourceMappingURL=removeUniversalPortals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeUniversalPortals.js","
|
|
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;AACzD,IAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AAClC,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACrB,YAAA,QAAQ,CAAC,gBAAgB,CAAC,CAAA,qBAAA,EAAwB,IAAI,CAAA,CAAA,CAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;gBAC1E,IAAI,CAAC,MAAM,EAAE,CAAC;AAChB,aAAC,CAAC,CAAC;AACL,SAAC,CAAC,CAAC;AACL,KAAA;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
1
|
+
import*as cheerio from'cheerio';/**
|
|
3
2
|
* Replace the wrapped dom element with `[data-slot-name]` to its children,
|
|
4
3
|
* setting attrib [data-slot-name] same as parent.
|
|
5
4
|
*
|
|
@@ -7,7 +6,7 @@ import * as cheerio from "cheerio";
|
|
|
7
6
|
* @param fills fill names.
|
|
8
7
|
* @returns The replaced html content string.
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
const replaceServerFills = (htmlContent, fills) => {
|
|
11
10
|
const $ = cheerio.load(htmlContent);
|
|
12
11
|
let newContent = htmlContent;
|
|
13
12
|
fills.forEach((name) => {
|
|
@@ -21,5 +20,4 @@ export const replaceServerFills = (htmlContent, fills) => {
|
|
|
21
20
|
});
|
|
22
21
|
});
|
|
23
22
|
return newContent;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=replaceServerFills.js.map
|
|
23
|
+
};export{replaceServerFills};//# sourceMappingURL=replaceServerFills.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceServerFills.js","
|
|
1
|
+
{"version":3,"file":"replaceServerFills.js","sources":["../../../src/slot-fill/utils/replaceServerFills.ts"],"sourcesContent":[null],"names":[],"mappings":"gCACA;;;;;;;AAOG;MACU,kBAAkB,GAAG,CAAC,WAAmB,EAAE,KAAe,KAAI;IACzE,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;AACrB,QAAA,CAAC,CAAC,CAAA,qBAAA,EAAwB,IAAI,CAAA,CAAA,CAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,KAAI;YAClD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;gBAC7B,KAAyB,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;AACxE,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;AACnD,SAAC,CAAC,CAAC;AACL,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,UAAU,CAAC;AACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/components-pro",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-alpha.0",
|
|
4
4
|
"description": "browser plugin for git",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
"author": "CDMBase LLC",
|
|
15
15
|
"main": "lib/index.js",
|
|
16
16
|
"module": "lib/index.js",
|
|
17
|
+
"type": "module",
|
|
17
18
|
"react-native": "lib/index.native.js",
|
|
18
19
|
"typings": "lib/index.d.ts",
|
|
19
20
|
"scripts": {
|
|
20
21
|
"build": "npm run build:clean && npm run build:lib",
|
|
21
|
-
"build:clean": "rimraf
|
|
22
|
-
"build:lib": "
|
|
22
|
+
"build:clean": "rimraf lib",
|
|
23
|
+
"build:lib": "rollup -c rollup.config.mjs",
|
|
23
24
|
"build:lib:watch": "npm run build:lib -- --watch",
|
|
24
25
|
"jest": "./node_modules/.bin/jest",
|
|
25
26
|
"prepublish": "npm run build",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"publishConfig": {
|
|
54
55
|
"access": "public"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5059c814e1bd62df90c46f287bded14419461d9a",
|
|
57
58
|
"typescript": {
|
|
58
59
|
"definition": "lib/index.d.ts"
|
|
59
60
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as ReactTestRenderer from 'react-test-renderer';
|
|
4
|
-
import { Slot, Fill } from '../';
|
|
5
|
-
// import Provider from '../context';
|
|
6
|
-
import { SlotFillProvider as Provider } from '../index';
|
|
7
|
-
import 'jest';
|
|
8
|
-
describe('Slot with filter', () => {
|
|
9
|
-
it("calls the functions passed as the Slot's fillProps in the Fill", () => {
|
|
10
|
-
const onClose = jest.fn();
|
|
11
|
-
const List = ({ items }) => {
|
|
12
|
-
return (React.createElement("ul", null, items.map((item, i) => React.createElement(ListItem, { key: i, item: item }))));
|
|
13
|
-
};
|
|
14
|
-
class ListItem extends React.Component {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.state = { showing: true };
|
|
18
|
-
this.handleClick = () => {
|
|
19
|
-
this.setState({ showing: true });
|
|
20
|
-
};
|
|
21
|
-
this.handlHideModal = () => {
|
|
22
|
-
this.setState({ showing: false });
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
return (React.createElement("li", null,
|
|
27
|
-
this.state.showing &&
|
|
28
|
-
React.createElement(Fill, { name: "modal" },
|
|
29
|
-
"Showing ",
|
|
30
|
-
this.props.item,
|
|
31
|
-
React.createElement("button", { onClick: this.handlHideModal }, "Hide")),
|
|
32
|
-
this.props.item));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const tree = ReactTestRenderer.create(React.createElement(Provider, null,
|
|
36
|
-
React.createElement(List, { items: ["one", "two", "three"] }),
|
|
37
|
-
React.createElement("div", { className: "modal" },
|
|
38
|
-
React.createElement(Slot, { name: "modal" })))).toJSON();
|
|
39
|
-
expect(tree).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=filler-slot.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filler-slot.test.js","sourceRoot":"","sources":["../../../src/slot-fill/__tests__/filler-slot.test.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,K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AAC,KAAK,CAAC,IAAI,CACf,CACR,CAAA;YACL,CAAC;SACJ;QAED,MAAM,IAAI,GAAG,iBAAiB,CAAC,MAAM,CACjC,oBAAC,QAAQ;YACL,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,GAAI;YACxC,6BAAK,SAAS,EAAC,OAAO;gBAClB,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,CACnB,CACC,CACd,CAAC,MAAM,EAAE,CAAC;QAEX,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { render, fireEvent } from '@testing-library/react';
|
|
4
|
-
import { Slot, Fill, Provider } from '../';
|
|
5
|
-
import { Component } from 'react';
|
|
6
|
-
import 'jest';
|
|
7
|
-
class Filler extends Component {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
this.state = {
|
|
11
|
-
num: 1,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
render() {
|
|
15
|
-
return [
|
|
16
|
-
React.createElement("button", { key: "1", type: "button", onClick: () => this.setState({ num: this.state.num + 1 }) }),
|
|
17
|
-
React.createElement(Fill, { name: this.props.name, key: "2" }, this.props.text || this.state.num.toString()),
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
describe('Slot', () => {
|
|
22
|
-
it('should render empty Fills', () => {
|
|
23
|
-
const { container } = render(React.createElement(Provider, null,
|
|
24
|
-
React.createElement("div", null,
|
|
25
|
-
React.createElement(Slot, { name: "chicken" })),
|
|
26
|
-
React.createElement(Fill, { name: "chicken" })));
|
|
27
|
-
expect(container).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
it('should render a string Fill', () => {
|
|
30
|
-
const { container } = render(React.createElement(Provider, null,
|
|
31
|
-
React.createElement("div", null,
|
|
32
|
-
React.createElement(Slot, { name: "chicken" })),
|
|
33
|
-
React.createElement(Fill, { name: "chicken" }, "content")));
|
|
34
|
-
expect(container).toMatchSnapshot();
|
|
35
|
-
});
|
|
36
|
-
it('should render a Fill containing an element', () => {
|
|
37
|
-
const { container } = render(React.createElement(Provider, null,
|
|
38
|
-
React.createElement("div", null,
|
|
39
|
-
React.createElement(Slot, { name: "chicken" })),
|
|
40
|
-
React.createElement(Fill, { name: "chicken" },
|
|
41
|
-
React.createElement("span", null))));
|
|
42
|
-
expect(container).toMatchSnapshot();
|
|
43
|
-
});
|
|
44
|
-
it('should render a Fill containing an array', () => {
|
|
45
|
-
const { container } = render(React.createElement(Provider, null,
|
|
46
|
-
React.createElement("div", null,
|
|
47
|
-
React.createElement(Slot, { name: "chicken" })),
|
|
48
|
-
React.createElement(Fill, { name: "chicken" }, [React.createElement("span", { key: "1" }), React.createElement("div", { key: "2" }), 'text'])));
|
|
49
|
-
expect(container).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
it("calls the functions passed as the Slot's fillProps in the Fill", () => {
|
|
52
|
-
const onClose = jest.fn();
|
|
53
|
-
const { getByText } = render(React.createElement(Provider, null,
|
|
54
|
-
React.createElement(Slot, { name: "chicken", fillProps: { onClose } }),
|
|
55
|
-
React.createElement(Fill, { name: "chicken" }, (props) => {
|
|
56
|
-
return React.createElement("button", { onClick: props.onClose }, " Click me");
|
|
57
|
-
})));
|
|
58
|
-
fireEvent.click(getByText('Click me'));
|
|
59
|
-
expect(onClose).toHaveBeenCalledTimes(1);
|
|
60
|
-
});
|
|
61
|
-
it('should render empty Fills without HTML wrapper when render props used', () => {
|
|
62
|
-
const { container } = render(React.createElement(Provider, null,
|
|
63
|
-
React.createElement("div", null,
|
|
64
|
-
React.createElement(Slot, { name: "chicken" }, (fills) => ([...fills].length ? React.createElement("blockquote", null, fills) : null))),
|
|
65
|
-
React.createElement(Fill, { name: "chicken" })));
|
|
66
|
-
expect(container).toMatchSnapshot();
|
|
67
|
-
});
|
|
68
|
-
it('should render a string Fill with HTML wrapper when render props used', () => {
|
|
69
|
-
const { container } = render(React.createElement(Provider, null,
|
|
70
|
-
React.createElement("div", null,
|
|
71
|
-
React.createElement(Slot, { name: "chicken" }, (fills) => fills && React.createElement("blockquote", null, fills))),
|
|
72
|
-
React.createElement(Fill, { name: "chicken" }, "content")));
|
|
73
|
-
expect(container).toMatchSnapshot();
|
|
74
|
-
});
|
|
75
|
-
it('should re-render Slot when not bubbling virtually', () => {
|
|
76
|
-
const { container, getByRole } = render(React.createElement(Provider, null,
|
|
77
|
-
React.createElement("div", null,
|
|
78
|
-
React.createElement(Slot, { name: "egg" })),
|
|
79
|
-
React.createElement(Filler, { name: "egg" })));
|
|
80
|
-
expect(container).toMatchSnapshot();
|
|
81
|
-
fireEvent.click(getByRole('button'));
|
|
82
|
-
expect(container).toMatchSnapshot();
|
|
83
|
-
});
|
|
84
|
-
it('should render in expected order when fills always mounted', () => {
|
|
85
|
-
const { container, rerender } = render(React.createElement(Provider, null,
|
|
86
|
-
React.createElement("div", { key: "slot" },
|
|
87
|
-
React.createElement(Slot, { name: "egg" }))));
|
|
88
|
-
rerender(React.createElement(Provider, null,
|
|
89
|
-
React.createElement("div", { key: "slot" },
|
|
90
|
-
React.createElement(Slot, { name: "egg" })),
|
|
91
|
-
React.createElement(Filler, { name: "egg", key: "first", text: "first" }),
|
|
92
|
-
React.createElement(Filler, { name: "egg", key: "second", text: "second" })));
|
|
93
|
-
rerender(React.createElement(Provider, null,
|
|
94
|
-
React.createElement("div", { key: "slot" },
|
|
95
|
-
React.createElement(Slot, { name: "egg" })),
|
|
96
|
-
React.createElement(Fill, { name: "egg", key: "first" }),
|
|
97
|
-
React.createElement(Fill, { name: "egg", key: "second" }, "second"),
|
|
98
|
-
React.createElement(Fill, { name: "egg", key: "third" }, "third")));
|
|
99
|
-
rerender(React.createElement(Provider, null,
|
|
100
|
-
React.createElement("div", { key: "slot" },
|
|
101
|
-
React.createElement(Slot, { name: "egg" })),
|
|
102
|
-
React.createElement(Fill, { name: "egg", key: "first" }, "first (rerendered)"),
|
|
103
|
-
React.createElement(Fill, { name: "egg", key: "second" }, "second"),
|
|
104
|
-
React.createElement(Fill, { name: "egg", key: "third" }, "third"),
|
|
105
|
-
React.createElement(Fill, { name: "egg", key: "fourth" }, "fourth (new)")));
|
|
106
|
-
expect(container).toMatchSnapshot();
|
|
107
|
-
});
|
|
108
|
-
it('should render in expected order when fills unmounted', () => {
|
|
109
|
-
const { container, rerender } = render(React.createElement(Provider, null,
|
|
110
|
-
React.createElement("div", { key: "slot" },
|
|
111
|
-
React.createElement(Slot, { name: "egg" }))));
|
|
112
|
-
rerender(React.createElement(Provider, null,
|
|
113
|
-
React.createElement("div", { key: "slot" },
|
|
114
|
-
React.createElement(Slot, { name: "egg" })),
|
|
115
|
-
React.createElement(Filler, { name: "egg", key: "first", text: "first" }),
|
|
116
|
-
React.createElement(Filler, { name: "egg", key: "second", text: "second" })));
|
|
117
|
-
rerender(React.createElement(Provider, null,
|
|
118
|
-
React.createElement("div", { key: "slot" },
|
|
119
|
-
React.createElement(Slot, { name: "egg" })),
|
|
120
|
-
React.createElement(Filler, { name: "egg", key: "second", text: "second" }),
|
|
121
|
-
React.createElement(Filler, { name: "egg", key: "third", text: "third" })));
|
|
122
|
-
rerender(React.createElement(Provider, null,
|
|
123
|
-
React.createElement("div", { key: "slot" },
|
|
124
|
-
React.createElement(Slot, { name: "egg" })),
|
|
125
|
-
React.createElement(Filler, { name: "egg", key: "first", text: "first (rerendered)" }),
|
|
126
|
-
React.createElement(Filler, { name: "egg", key: "second", text: "second" }),
|
|
127
|
-
React.createElement(Filler, { name: "egg", key: "third", text: "third" }),
|
|
128
|
-
React.createElement(Filler, { name: "egg", key: "fourth", text: "fourth (new)" })));
|
|
129
|
-
expect(container).toMatchSnapshot();
|
|
130
|
-
});
|
|
131
|
-
it('should warn without a Provider', () => {
|
|
132
|
-
const { container } = render(React.createElement(React.Fragment, null,
|
|
133
|
-
React.createElement("div", null,
|
|
134
|
-
React.createElement(Slot, { name: "chicken", bubblesVirtually: true })),
|
|
135
|
-
React.createElement(Fill, { name: "chicken" })));
|
|
136
|
-
expect(container).toMatchSnapshot();
|
|
137
|
-
// expect(console).toHaveWarned();
|
|
138
|
-
});
|
|
139
|
-
describe.each([false, true])('bubblesVirtually %p', (bubblesVirtually) => {
|
|
140
|
-
it('should subsume another slot by the same name', () => {
|
|
141
|
-
const { container, rerender } = render(React.createElement(Provider, null,
|
|
142
|
-
React.createElement("div", { "data-position": "first" },
|
|
143
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
144
|
-
React.createElement("div", { "data-position": "second" }),
|
|
145
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
146
|
-
rerender(React.createElement(Provider, null,
|
|
147
|
-
React.createElement("div", { "data-position": "first" },
|
|
148
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
149
|
-
React.createElement("div", { "data-position": "second" },
|
|
150
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
151
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
152
|
-
expect(container).toMatchSnapshot();
|
|
153
|
-
rerender(React.createElement(Provider, null,
|
|
154
|
-
React.createElement("div", { "data-position": "first" }),
|
|
155
|
-
React.createElement("div", { "data-position": "second" },
|
|
156
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
157
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
158
|
-
expect(container).toMatchSnapshot();
|
|
159
|
-
});
|
|
160
|
-
it('should unmount two slots with the same name', () => {
|
|
161
|
-
const { rerender, container } = render(React.createElement(Provider, null,
|
|
162
|
-
React.createElement("div", { "data-position": "first" },
|
|
163
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
164
|
-
React.createElement("div", { "data-position": "second" },
|
|
165
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
166
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
167
|
-
rerender(React.createElement(Provider, null,
|
|
168
|
-
React.createElement("div", { "data-position": "first" },
|
|
169
|
-
React.createElement(Slot, { name: "egg", bubblesVirtually: bubblesVirtually })),
|
|
170
|
-
React.createElement("div", { "data-position": "second" }),
|
|
171
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
172
|
-
rerender(React.createElement(Provider, null,
|
|
173
|
-
React.createElement("div", { "data-position": "first" }),
|
|
174
|
-
React.createElement("div", { "data-position": "second" }),
|
|
175
|
-
React.createElement(Fill, { name: "egg" }, "Content")));
|
|
176
|
-
expect(container).toMatchSnapshot();
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
//@sri custom logic
|
|
181
|
-
describe('Slot with logic', () => {
|
|
182
|
-
it('should render a string Fill with HTML wrapper when render props used', () => {
|
|
183
|
-
const Fill1 = (props) => {
|
|
184
|
-
return (React.createElement(Fill, { name: "chicken", fillId: "id1" }, (props) => {
|
|
185
|
-
return 'content';
|
|
186
|
-
}));
|
|
187
|
-
};
|
|
188
|
-
const Fill2 = (props) => {
|
|
189
|
-
return (React.createElement(Fill, { name: "chicken", fillId: "id2" }, (props) => {
|
|
190
|
-
console.log('--filler--props', props);
|
|
191
|
-
return 'content1';
|
|
192
|
-
}));
|
|
193
|
-
};
|
|
194
|
-
const Slot1 = (props) => {
|
|
195
|
-
return (React.createElement(Slot, { name: "chicken", fillProps: { selected: 'one' } }, (fills) => {
|
|
196
|
-
console.log('---files', fills);
|
|
197
|
-
return fills && React.createElement("blockquote", null, "Test");
|
|
198
|
-
}));
|
|
199
|
-
};
|
|
200
|
-
const { container } = render(React.createElement(Provider, null,
|
|
201
|
-
React.createElement("div", null,
|
|
202
|
-
React.createElement(Slot1, null)),
|
|
203
|
-
React.createElement(Fill1, null),
|
|
204
|
-
React.createElement(Fill2, null)));
|
|
205
|
-
expect(container).toMatchSnapshot();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
//# sourceMappingURL=slot-features.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-features.test.js","sourceRoot":"","sources":["../../../src/slot-fill/__tests__/slot-features.test.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,MAAM,CAAC;AAEd,MAAM,MAAO,SAAQ,SAAmB;IACpC,YAAY,KAAK;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,GAAG,EAAE,CAAC;SACT,CAAC;IACN,CAAC;IACM,MAAM;QACT,OAAO;YACH,gCAAQ,GAAG,EAAC,GAAG,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,GAAI;YAC3F,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAC,GAAG,IAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAC1C;SACV,CAAC;IACN,CAAC;CACJ;AAED,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACj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AAC,IAAI,EAAC,SAAS,EAAC,MAAM,EAAC,KAAK,IAC5B,CAAC,KAAK,EAAE,EAAE;gBACP,OAAO,SAAS,CAAC;YACrB,CAAC,CACE,CACV,CAAC;QACN,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE;YACpB,OAAO,CACH,oBAAC,IAAI,IAAC,IAAI,EAAC,SAAS,EAAC,MAAM,EAAC,KAAK,IAC5B,CAAC,KAAK,EAAE,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;gBACtC,OAAO,UAAU,CAAC;YACtB,CAAC,CACE,CACV,CAAC;QACN,CAAC,CAAC;QAEF,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE;YACpB,OAAO,CACH,oBAAC,IAAI,IAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAC9C,CAAC,KAAK,EAAE,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;gBAC/B,OAAO,KAAK,IAAI,+CAA6B,CAAC;YAClD,CAAC,CACE,CACV,CAAC;QACN,CAAC,CAAC;QACF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CACxB,oBAAC,QAAQ;YACL;gBACI,oBAAC,KAAK,OAAG,CACP;YACN,oBAAC,KAAK,OAAG;YACT,oBAAC,KAAK,OAAG,CACF,CACd,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// import * as React from 'react';
|
|
2
|
-
// import { render, screen, within } from '@testing-library/react';
|
|
3
|
-
// import { createSlotFill, Provider as SlotFillProvider } from '../';
|
|
4
|
-
// describe('createSlotFill', () => {
|
|
5
|
-
// test('should render all slot fills in order of rendering', () => {
|
|
6
|
-
// const PostSidebar: any = createSlotFill('PostSidebar');
|
|
7
|
-
// render(
|
|
8
|
-
// <SlotFillProvider>
|
|
9
|
-
// <PostSidebar.Fill>
|
|
10
|
-
// <p>Post Section 1</p>
|
|
11
|
-
// </PostSidebar.Fill>
|
|
12
|
-
// <PostSidebar.Fill>
|
|
13
|
-
// <p>Post Section 2</p>
|
|
14
|
-
// </PostSidebar.Fill>
|
|
15
|
-
// <div title="Post Sidebar">
|
|
16
|
-
// <PostSidebar.Slot />
|
|
17
|
-
// </div>
|
|
18
|
-
// </SlotFillProvider>,
|
|
19
|
-
// );
|
|
20
|
-
// const postSidebar = screen.getByTitle('Post Sidebar');
|
|
21
|
-
// const postSections = within(postSidebar).getAllByText(/Post Section \d/);
|
|
22
|
-
// expect(postSidebar).toBeVisible();
|
|
23
|
-
// expect(postSections).toHaveLength(2);
|
|
24
|
-
// postSections.forEach((postSection, index) => {
|
|
25
|
-
// expect(postSection).toBeVisible();
|
|
26
|
-
// expect(postSection).toHaveTextContent(`Post Section ${index + 1}`);
|
|
27
|
-
// });
|
|
28
|
-
// });
|
|
29
|
-
// test('should support separate multiple slots and fills', () => {
|
|
30
|
-
// const PostSidebar = createSlotFill('PostSidebar');
|
|
31
|
-
// const PageSidebar = createSlotFill('PageSidebar');
|
|
32
|
-
// render(
|
|
33
|
-
// <SlotFillProvider>
|
|
34
|
-
// <PostSidebar.Fill>
|
|
35
|
-
// <p>Post Section</p>
|
|
36
|
-
// </PostSidebar.Fill>
|
|
37
|
-
// <PageSidebar.Fill>
|
|
38
|
-
// <p>Page Section</p>
|
|
39
|
-
// </PageSidebar.Fill>
|
|
40
|
-
// <div title="Post Sidebar">
|
|
41
|
-
// <PostSidebar.Slot />
|
|
42
|
-
// </div>
|
|
43
|
-
// <div title="Page Sidebar">
|
|
44
|
-
// <PageSidebar.Slot />
|
|
45
|
-
// </div>
|
|
46
|
-
// </SlotFillProvider>,
|
|
47
|
-
// );
|
|
48
|
-
// const postSidebar = screen.getByTitle('Post Sidebar');
|
|
49
|
-
// expect(postSidebar).toBeVisible();
|
|
50
|
-
// expect(within(postSidebar).getByText('Post Section')).toBeVisible();
|
|
51
|
-
// const pageSidebar = screen.getByTitle('Page Sidebar');
|
|
52
|
-
// expect(pageSidebar).toBeVisible();
|
|
53
|
-
// expect(within(pageSidebar).getByText('Page Section')).toBeVisible();
|
|
54
|
-
// expect(within(postSidebar).queryByText('Page Section')).not.toBeInTheDocument();
|
|
55
|
-
// expect(within(pageSidebar).queryByText('Post Section')).not.toBeInTheDocument();
|
|
56
|
-
// });
|
|
57
|
-
// });
|
|
58
|
-
//# sourceMappingURL=slot-fill-provider.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-fill-provider.test.js","sourceRoot":"","sources":["../../../src/slot-fill/__tests__/slot-fill-provider.test.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,mEAAmE;AACnE,sEAAsE;AAEtE,qCAAqC;AACrC,yEAAyE;AACzE,kEAAkE;AAElE,kBAAkB;AAClB,iCAAiC;AACjC,qCAAqC;AACrC,4CAA4C;AAC5C,sCAAsC;AACtC,qCAAqC;AACrC,4CAA4C;AAC5C,sCAAsC;AACtC,6CAA6C;AAC7C,2CAA2C;AAC3C,yBAAyB;AACzB,mCAAmC;AACnC,aAAa;AAEb,iEAAiE;AACjE,oFAAoF;AAEpF,6CAA6C;AAC7C,gDAAgD;AAChD,yDAAyD;AACzD,iDAAiD;AACjD,kFAAkF;AAClF,cAAc;AACd,UAAU;AAEV,uEAAuE;AACvE,6DAA6D;AAC7D,6DAA6D;AAE7D,kBAAkB;AAClB,iCAAiC;AACjC,qCAAqC;AACrC,0CAA0C;AAC1C,sCAAsC;AACtC,qCAAqC;AACrC,0CAA0C;AAC1C,sCAAsC;AACtC,6CAA6C;AAC7C,2CAA2C;AAC3C,yBAAyB;AACzB,6CAA6C;AAC7C,2CAA2C;AAC3C,yBAAyB;AACzB,mCAAmC;AACnC,aAAa;AAEb,iEAAiE;AAEjE,6CAA6C;AAC7C,+EAA+E;AAE/E,iEAAiE;AAEjE,6CAA6C;AAC7C,+EAA+E;AAE/E,2FAA2F;AAC3F,2FAA2F;AAC3F,UAAU;AACV,MAAM"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { useSnapshot } from 'valtio';
|
|
3
|
-
import SlotFillContext from './slot-fill-context';
|
|
4
|
-
export default function useSlotFills(name) {
|
|
5
|
-
const registry = useContext(SlotFillContext);
|
|
6
|
-
const fills = useSnapshot(registry.fills, { sync: true });
|
|
7
|
-
// The important bit here is that this call ensures that the hook
|
|
8
|
-
// only causes a re-render if the "fills" of a given slot name
|
|
9
|
-
// change change, not any fills.
|
|
10
|
-
return fills.get(name);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=use-slot-fills.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-slot-fills.js","sourceRoot":"","sources":["../../../src/slot-fill/bubbles-virtually/use-slot-fills.ts"],"names":[],"mappings":"AAAA,OAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,IAAI;IACzC,MAAM,QAAQ,GAAG,UAAU,CAAE,eAAe,CAAE,CAAC;IAC/C,MAAM,KAAK,GAAG,WAAW,CAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAE,CAAC;IAC5D,iEAAiE;IACjE,8DAA8D;IAC9D,gCAAgC;IAChC,OAAO,KAAK,CAAC,GAAG,CAAE,IAAI,CAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { omit } from 'lodash';
|
|
3
|
-
import BaseSlot from './base/slot';
|
|
4
|
-
import Fill from './base/fill';
|
|
5
|
-
import Provider from './base/provider';
|
|
6
|
-
export { Fill, Provider };
|
|
7
|
-
export function Slot(props) {
|
|
8
|
-
return React.createElement(BaseSlot, Object.assign({}, omit(props, 'bubblesVirtually')));
|
|
9
|
-
}
|
|
10
|
-
export function createSlotFill(name) {
|
|
11
|
-
const FillComponent = (props) => React.createElement(Fill, Object.assign({ name: name }, props));
|
|
12
|
-
FillComponent.displayName = name + 'Fill';
|
|
13
|
-
const SlotComponent = (props) => React.createElement(Slot, Object.assign({ name: name }, props));
|
|
14
|
-
SlotComponent.displayName = name + 'Slot';
|
|
15
|
-
return {
|
|
16
|
-
Fill: FillComponent,
|
|
17
|
-
Slot: SlotComponent,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/slot-fill/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAE1B,MAAM,UAAU,IAAI,CAAC,KAAiB;IAClC,OAAO,oBAAC,QAAQ,oBAAM,IAAI,CAAC,KAAK,EAAE,kBAAkB,CAAC,EAAI,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAI;IAC/B,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,IAAI,kBAAC,IAAI,EAAE,IAAI,IAAM,KAAK,EAAI,CAAC;IACjE,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;IAE1C,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,IAAI,kBAAC,IAAI,EAAE,IAAI,IAAM,KAAK,EAAI,CAAC;IACjE,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;IAE1C,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,aAAa;KACtB,CAAA;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slot-fill/interfaces/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slot-fill/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC"}
|