@bemoje/composition 2.1.2 → 2.1.3

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.
Files changed (57) hide show
  1. package/package.json +83 -149
  2. package/lib/IView.cjs +0 -2
  3. package/lib/IView.d.cts +0 -12
  4. package/lib/IView.d.ts +0 -12
  5. package/lib/IView.js +0 -1
  6. package/lib/OptionsConfigurator.cjs +0 -166
  7. package/lib/OptionsConfigurator.d.cts +0 -2229
  8. package/lib/OptionsConfigurator.d.ts +0 -2229
  9. package/lib/OptionsConfigurator.js +0 -163
  10. package/lib/View.cjs +0 -22
  11. package/lib/View.d.cts +0 -14
  12. package/lib/View.d.ts +0 -14
  13. package/lib/View.js +0 -20
  14. package/lib/inheritProxifiedPrototype.cjs +0 -19
  15. package/lib/inheritProxifiedPrototype.d.cts +0 -11
  16. package/lib/inheritProxifiedPrototype.d.ts +0 -11
  17. package/lib/inheritProxifiedPrototype.js +0 -16
  18. package/lib/inheritProxifiedPrototypeProperty.cjs +0 -45
  19. package/lib/inheritProxifiedPrototypeProperty.d.cts +0 -9
  20. package/lib/inheritProxifiedPrototypeProperty.d.ts +0 -9
  21. package/lib/inheritProxifiedPrototypeProperty.js +0 -43
  22. package/lib/inspector/Inspector.cjs +0 -227
  23. package/lib/inspector/Inspector.d.cts +0 -4
  24. package/lib/inspector/Inspector.d.ts +0 -4
  25. package/lib/inspector/Inspector.js +0 -220
  26. package/lib/inspector/defaults/ignoreValuesDefaults.cjs +0 -11
  27. package/lib/inspector/defaults/ignoreValuesDefaults.d.cts +0 -11
  28. package/lib/inspector/defaults/ignoreValuesDefaults.d.ts +0 -11
  29. package/lib/inspector/defaults/ignoreValuesDefaults.js +0 -11
  30. package/lib/inspector/defaults/ignoreValuesFilterDefaults.cjs +0 -23
  31. package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.cts +0 -11
  32. package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.ts +0 -11
  33. package/lib/inspector/defaults/ignoreValuesFilterDefaults.js +0 -21
  34. package/lib/inspector/defaults/inspectDefaults.cjs +0 -17
  35. package/lib/inspector/defaults/inspectDefaults.d.cts +0 -8
  36. package/lib/inspector/defaults/inspectDefaults.d.ts +0 -8
  37. package/lib/inspector/defaults/inspectDefaults.js +0 -16
  38. package/lib/inspector/defaults/inspectorDefaults.cjs +0 -15
  39. package/lib/inspector/defaults/inspectorDefaults.d.cts +0 -11
  40. package/lib/inspector/defaults/inspectorDefaults.d.ts +0 -11
  41. package/lib/inspector/defaults/inspectorDefaults.js +0 -14
  42. package/lib/inspector/types.cjs +0 -2
  43. package/lib/inspector/types.d.cts +0 -4
  44. package/lib/inspector/types.d.ts +0 -4
  45. package/lib/inspector/types.js +0 -1
  46. package/lib/parenting/ParentRelationTypes.cjs +0 -130
  47. package/lib/parenting/ParentRelationTypes.d.cts +0 -4
  48. package/lib/parenting/ParentRelationTypes.d.ts +0 -4
  49. package/lib/parenting/ParentRelationTypes.js +0 -123
  50. package/lib/parenting/Parenting.cjs +0 -88
  51. package/lib/parenting/Parenting.d.cts +0 -4
  52. package/lib/parenting/Parenting.d.ts +0 -4
  53. package/lib/parenting/Parenting.js +0 -85
  54. package/lib/parenting/types.cjs +0 -2
  55. package/lib/parenting/types.d.cts +0 -4
  56. package/lib/parenting/types.d.ts +0 -4
  57. package/lib/parenting/types.js +0 -1
@@ -1,123 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import { DefaultMap, MultiSet } from 'mnemonist';
3
- import { View } from '../View';
4
- import colors from 'ansi-colors';
5
-
6
- class ParentRelationTypes extends View {
7
- static {
8
- __name(this, "ParentRelationTypes");
9
- }
10
- registerParent(parentType) {
11
- ParentRelationTypes.parentTypesStats.get(this.target).add(parentType);
12
- ParentRelationTypes.childTypesStats.get(parentType).add(this.target);
13
- }
14
- get hasParent() {
15
- return ParentRelationTypes.parentTypesStats.has(this.target);
16
- }
17
- get getParentTypes() {
18
- return ParentRelationTypes.parentTypesStats.get(this.target);
19
- }
20
- get hasChildren() {
21
- return ParentRelationTypes.childTypesStats.has(this.target);
22
- }
23
- get getChildTypes() {
24
- return ParentRelationTypes.childTypesStats.get(this.target);
25
- }
26
- get isRoot() {
27
- return !this.hasParent && this.hasChildren;
28
- }
29
- get isLeaf() {
30
- return this.hasParent && !this.hasChildren;
31
- }
32
- get isIsolated() {
33
- return !this.hasParent && !this.hasChildren;
34
- }
35
- static getAllChildTypesStats() {
36
- const res = {};
37
- Array.from(this.childTypesStats.entries()).map(([cls, multimap]) => {
38
- multimap.forEachMultiplicity((count, key) => {
39
- if (!res[cls.name]) {
40
- res[cls.name] = {};
41
- }
42
- if (!res[cls.name][key.name]) {
43
- res[cls.name][key.name] = count;
44
- }
45
- });
46
- });
47
- return res;
48
- }
49
- static getAllParentTypesStats() {
50
- const res = {};
51
- Array.from(this.parentTypesStats.entries()).map(([cls, multimap]) => {
52
- multimap.forEachMultiplicity((count, key) => {
53
- if (!res[cls.name]) {
54
- res[cls.name] = {};
55
- }
56
- if (!res[cls.name][key.name]) {
57
- res[cls.name][key.name] = count;
58
- }
59
- });
60
- });
61
- return res;
62
- }
63
- static getAllStats() {
64
- const classes = /* @__PURE__ */ new Set([
65
- ...Array.from(this.childTypesStats.keys()),
66
- ...Array.from(this.parentTypesStats.keys())
67
- ]);
68
- return Array.from(classes).map((cls) => {
69
- const parents = Array.from(this.parentTypesStats.get(cls).multiplicities()).map(([cls2, count]) => {
70
- return [
71
- cls2.name,
72
- count
73
- ];
74
- });
75
- const children = Array.from(this.childTypesStats.get(cls).multiplicities()).map(([cls2, count]) => {
76
- return [
77
- cls2.name,
78
- count
79
- ];
80
- });
81
- const result = {
82
- class: cls.name
83
- };
84
- if (parents.length) {
85
- result.parents = Object.fromEntries(parents);
86
- }
87
- if (children.length) {
88
- result.children = Object.fromEntries(children);
89
- }
90
- return result;
91
- });
92
- }
93
- static printAllStats() {
94
- console.log();
95
- console.log(colors.bold.yellow("Parent-Child Relation Stats"));
96
- for (const stats of this.getAllStats()) {
97
- console.log(stats.class);
98
- if (stats.parents) {
99
- let prefix = ` ${colors.dim("parents : ")}`;
100
- for (const [parent, count] of Object.entries(stats.parents)) {
101
- console.log(`${prefix}${colors.blue(parent)}: ${colors.yellow(String(count))}`);
102
- prefix = " ".repeat(12);
103
- }
104
- }
105
- if (stats.children) {
106
- let prefix = ` ${colors.dim("children : ")}`;
107
- for (const [child, count] of Object.entries(stats.children)) {
108
- console.log(`${prefix}${colors.green(child)}: ${colors.yellow(String(count))}`);
109
- prefix = " ".repeat(12);
110
- }
111
- }
112
- console.log();
113
- }
114
- }
115
- static childTypesStats = new DefaultMap(() => {
116
- return new MultiSet();
117
- });
118
- static parentTypesStats = new DefaultMap(() => {
119
- return new MultiSet();
120
- });
121
- }
122
-
123
- export { ParentRelationTypes };
@@ -1,88 +0,0 @@
1
- 'use strict';
2
-
3
- var mnemonist = require('mnemonist');
4
- var ParentRelationTypes = require('./ParentRelationTypes');
5
- var View = require('../View');
6
- var object = require('@mono/object');
7
-
8
- var __defProp = Object.defineProperty;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- class Parenting extends View.View {
11
- static {
12
- __name(this, "Parenting");
13
- }
14
- /**
15
- * Class decorator to register and correctly initialize a class as a 'parentingTarget'.
16
- */
17
- static compose(cls) {
18
- if (!object.hasProperty(cls, "parenting")) {
19
- object.defineLazyProperty(cls, "parenting", function() {
20
- return new ParentRelationTypes.ParentRelationTypes(this);
21
- });
22
- }
23
- if (!object.hasProperty(cls.prototype, "parenting")) {
24
- object.defineLazyProperty(cls.prototype, "parenting", function() {
25
- return new Parenting(this);
26
- });
27
- }
28
- }
29
- /**
30
- * Store a weak refences to the target object's parent.
31
- */
32
- onInstance(parent) {
33
- if (!parent) {
34
- return;
35
- }
36
- const targetClass = this.parentingTargetConstructor;
37
- Parenting.parentWeakRefMap.get(targetClass).set(this.target, parent);
38
- targetClass.parenting?.registerParent(parent.constructor);
39
- }
40
- /**
41
- * Retrieve the parent object of 'target' object.
42
- */
43
- getParent() {
44
- const map = Parenting.parentWeakRefMap.get(this.parentingTargetConstructor);
45
- const parent = map.get(this.target);
46
- return parent;
47
- }
48
- /**
49
- * Recursively get parent until no parent is found or a circular reference is detected.
50
- */
51
- *iterateAncestors() {
52
- let node = this.target.parenting.getParent();
53
- if (!node) {
54
- return;
55
- }
56
- const seen = /* @__PURE__ */ new Set();
57
- while (node) {
58
- if (seen.has(node)) {
59
- return;
60
- }
61
- seen.add(node);
62
- yield node;
63
- node = node?.parenting?.getParent();
64
- }
65
- }
66
- /**
67
- * The depth of the object in the parent-child hierarchy.
68
- */
69
- get depth() {
70
- return [
71
- ...this.iterateAncestors()
72
- ].length;
73
- }
74
- /**
75
- * The class constructor of the target object.
76
- */
77
- get parentingTargetConstructor() {
78
- return this.target.constructor;
79
- }
80
- /**
81
- * A WeakMap for parent references.
82
- */
83
- static parentWeakRefMap = new mnemonist.DefaultMap(() => {
84
- return /* @__PURE__ */ new WeakMap();
85
- });
86
- }
87
-
88
- exports.Parenting = Parenting;
@@ -1,4 +0,0 @@
1
- export { a as Parenting } from '../ParentRelationTypes-UM2G7eeR.cjs';
2
- import '../View.cjs';
3
- import 'mnemonist';
4
- import '../IView.cjs';
@@ -1,4 +0,0 @@
1
- export { a as Parenting } from '../ParentRelationTypes-BCs-YFio.js';
2
- import '../View.js';
3
- import 'mnemonist';
4
- import '../IView.js';
@@ -1,85 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import { DefaultMap } from 'mnemonist';
3
- import { ParentRelationTypes } from './ParentRelationTypes';
4
- import { View } from '../View';
5
- import { hasProperty, defineLazyProperty } from '@mono/object';
6
-
7
- class Parenting extends View {
8
- static {
9
- __name(this, "Parenting");
10
- }
11
- /**
12
- * Class decorator to register and correctly initialize a class as a 'parentingTarget'.
13
- */
14
- static compose(cls) {
15
- if (!hasProperty(cls, "parenting")) {
16
- defineLazyProperty(cls, "parenting", function() {
17
- return new ParentRelationTypes(this);
18
- });
19
- }
20
- if (!hasProperty(cls.prototype, "parenting")) {
21
- defineLazyProperty(cls.prototype, "parenting", function() {
22
- return new Parenting(this);
23
- });
24
- }
25
- }
26
- /**
27
- * Store a weak refences to the target object's parent.
28
- */
29
- onInstance(parent) {
30
- if (!parent) {
31
- return;
32
- }
33
- const targetClass = this.parentingTargetConstructor;
34
- Parenting.parentWeakRefMap.get(targetClass).set(this.target, parent);
35
- targetClass.parenting?.registerParent(parent.constructor);
36
- }
37
- /**
38
- * Retrieve the parent object of 'target' object.
39
- */
40
- getParent() {
41
- const map = Parenting.parentWeakRefMap.get(this.parentingTargetConstructor);
42
- const parent = map.get(this.target);
43
- return parent;
44
- }
45
- /**
46
- * Recursively get parent until no parent is found or a circular reference is detected.
47
- */
48
- *iterateAncestors() {
49
- let node = this.target.parenting.getParent();
50
- if (!node) {
51
- return;
52
- }
53
- const seen = /* @__PURE__ */ new Set();
54
- while (node) {
55
- if (seen.has(node)) {
56
- return;
57
- }
58
- seen.add(node);
59
- yield node;
60
- node = node?.parenting?.getParent();
61
- }
62
- }
63
- /**
64
- * The depth of the object in the parent-child hierarchy.
65
- */
66
- get depth() {
67
- return [
68
- ...this.iterateAncestors()
69
- ].length;
70
- }
71
- /**
72
- * The class constructor of the target object.
73
- */
74
- get parentingTargetConstructor() {
75
- return this.target.constructor;
76
- }
77
- /**
78
- * A WeakMap for parent references.
79
- */
80
- static parentWeakRefMap = new DefaultMap(() => {
81
- return /* @__PURE__ */ new WeakMap();
82
- });
83
- }
84
-
85
- export { Parenting };
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,4 +0,0 @@
1
- export { b as ParentingTarget, c as ParentingTargetConstructor } from '../ParentRelationTypes-UM2G7eeR.cjs';
2
- import 'mnemonist';
3
- import '../View.cjs';
4
- import '../IView.cjs';
@@ -1,4 +0,0 @@
1
- export { b as ParentingTarget, c as ParentingTargetConstructor } from '../ParentRelationTypes-BCs-YFio.js';
2
- import 'mnemonist';
3
- import '../View.js';
4
- import '../IView.js';
@@ -1 +0,0 @@
1
-