@micromag/core 0.4.85 → 0.4.86
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/es/contexts.d.ts +1 -0
- package/es/contexts.js +18 -37
- package/es/index.d.ts +1 -0
- package/es/index.js +12 -7
- package/package.json +2 -2
package/es/contexts.d.ts
CHANGED
|
@@ -195,6 +195,7 @@ declare class ComponentsManager extends EventEmitter {
|
|
|
195
195
|
|
|
196
196
|
declare class DefinitionsManager<T extends Definition = Definition> extends EventEmitter {
|
|
197
197
|
definitions: T[];
|
|
198
|
+
components: Record<string, Component> | null;
|
|
198
199
|
constructor(definitions?: T[]);
|
|
199
200
|
addDefinition(definition: T | T[]): this;
|
|
200
201
|
addDefinitions(definitions: T[]): this;
|
package/es/contexts.js
CHANGED
|
@@ -552,7 +552,7 @@ function _temp$3(t0) {
|
|
|
552
552
|
const ScreensContext = /*#__PURE__*/createContext(null);
|
|
553
553
|
const useScreensManager = () => use(ScreensContext);
|
|
554
554
|
function ScreensProvider(t0) {
|
|
555
|
-
const $ = c(
|
|
555
|
+
const $ = c(14);
|
|
556
556
|
const {
|
|
557
557
|
screens: t1,
|
|
558
558
|
namespaces: t2,
|
|
@@ -595,58 +595,39 @@ function ScreensProvider(t0) {
|
|
|
595
595
|
const [finalManager] = useState(t5);
|
|
596
596
|
let t6;
|
|
597
597
|
if ($[6] !== finalManager) {
|
|
598
|
-
t6 =
|
|
598
|
+
t6 = finalManager.getComponents();
|
|
599
599
|
$[6] = finalManager;
|
|
600
600
|
$[7] = t6;
|
|
601
601
|
} else {
|
|
602
602
|
t6 = $[7];
|
|
603
603
|
}
|
|
604
|
-
const
|
|
604
|
+
const components = t6;
|
|
605
605
|
let t7;
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
t7 = () => {
|
|
609
|
-
const onChange = () => setComponents(finalManager.getComponents());
|
|
610
|
-
finalManager.on("change", onChange);
|
|
611
|
-
return () => {
|
|
612
|
-
finalManager.off("change", onChange);
|
|
613
|
-
};
|
|
614
|
-
};
|
|
615
|
-
t8 = [finalManager, setComponents];
|
|
616
|
-
$[8] = finalManager;
|
|
617
|
-
$[9] = t7;
|
|
618
|
-
$[10] = t8;
|
|
619
|
-
} else {
|
|
620
|
-
t7 = $[9];
|
|
621
|
-
t8 = $[10];
|
|
622
|
-
}
|
|
623
|
-
useEffect(t7, t8);
|
|
624
|
-
let t9;
|
|
625
|
-
if ($[11] !== children || $[12] !== components) {
|
|
626
|
-
t9 = /*#__PURE__*/jsx(ComponentsProvider, {
|
|
606
|
+
if ($[8] !== children || $[9] !== components) {
|
|
607
|
+
t7 = /*#__PURE__*/jsx(ComponentsProvider, {
|
|
627
608
|
namespace: SCREENS_NAMESPACE,
|
|
628
609
|
components: components,
|
|
629
610
|
children: children
|
|
630
611
|
});
|
|
631
|
-
$[
|
|
632
|
-
$[
|
|
633
|
-
$[
|
|
612
|
+
$[8] = children;
|
|
613
|
+
$[9] = components;
|
|
614
|
+
$[10] = t7;
|
|
634
615
|
} else {
|
|
635
|
-
|
|
616
|
+
t7 = $[10];
|
|
636
617
|
}
|
|
637
|
-
let
|
|
638
|
-
if ($[
|
|
639
|
-
|
|
618
|
+
let t8;
|
|
619
|
+
if ($[11] !== finalManager || $[12] !== t7) {
|
|
620
|
+
t8 = /*#__PURE__*/jsx(ScreensContext, {
|
|
640
621
|
value: finalManager,
|
|
641
|
-
children:
|
|
622
|
+
children: t7
|
|
642
623
|
});
|
|
643
|
-
$[
|
|
644
|
-
$[
|
|
645
|
-
$[
|
|
624
|
+
$[11] = finalManager;
|
|
625
|
+
$[12] = t7;
|
|
626
|
+
$[13] = t8;
|
|
646
627
|
} else {
|
|
647
|
-
|
|
628
|
+
t8 = $[13];
|
|
648
629
|
}
|
|
649
|
-
return
|
|
630
|
+
return t8;
|
|
650
631
|
}
|
|
651
632
|
|
|
652
633
|
const StoryContext = /*#__PURE__*/createContext(null);
|
package/es/index.d.ts
CHANGED
|
@@ -492,6 +492,7 @@ declare class ComponentsManager extends EventEmitter {
|
|
|
492
492
|
|
|
493
493
|
declare class DefinitionsManager<T extends Definition = Definition> extends EventEmitter {
|
|
494
494
|
definitions: T[];
|
|
495
|
+
components: Record<string, Component> | null;
|
|
495
496
|
constructor(definitions?: T[]);
|
|
496
497
|
addDefinition(definition: T | T[]): this;
|
|
497
498
|
addDefinitions(definitions: T[]): this;
|
package/es/index.js
CHANGED
|
@@ -236,6 +236,7 @@ class DefinitionsManager extends EventEmitter {
|
|
|
236
236
|
constructor(definitions = []) {
|
|
237
237
|
super();
|
|
238
238
|
this.definitions = definitions || [];
|
|
239
|
+
this.components = null;
|
|
239
240
|
}
|
|
240
241
|
addDefinition(definition) {
|
|
241
242
|
this.addDefinitions(isArray(definition) ? definition : [definition]);
|
|
@@ -243,6 +244,7 @@ class DefinitionsManager extends EventEmitter {
|
|
|
243
244
|
}
|
|
244
245
|
addDefinitions(definitions) {
|
|
245
246
|
this.definitions = uniqBy([...definitions, ...this.definitions], it => it.id);
|
|
247
|
+
this.components = null;
|
|
246
248
|
this.emit('change');
|
|
247
249
|
return this;
|
|
248
250
|
}
|
|
@@ -273,13 +275,16 @@ class DefinitionsManager extends EventEmitter {
|
|
|
273
275
|
return component;
|
|
274
276
|
}
|
|
275
277
|
getComponents() {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
if (this.components === null) {
|
|
279
|
+
this.components = this.definitions.reduce((allComponents, {
|
|
280
|
+
id,
|
|
281
|
+
component = null
|
|
282
|
+
}) => component !== null ? {
|
|
283
|
+
...allComponents,
|
|
284
|
+
[id]: component
|
|
285
|
+
} : allComponents, {});
|
|
286
|
+
}
|
|
287
|
+
return this.components;
|
|
283
288
|
}
|
|
284
289
|
}
|
|
285
290
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.86",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -157,6 +157,6 @@
|
|
|
157
157
|
"access": "public",
|
|
158
158
|
"registry": "https://registry.npmjs.org/"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "24785d81e840b81c58dc101ba7305d088e61f0e0",
|
|
161
161
|
"types": "es/index.d.ts"
|
|
162
162
|
}
|