@bemoje/composition 2.0.1 → 2.1.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.
Files changed (63) hide show
  1. package/lib/IView.cjs +2 -0
  2. package/lib/IView.d.cts +12 -0
  3. package/lib/IView.d.ts +12 -0
  4. package/lib/IView.js +1 -0
  5. package/lib/OptionsConfigurator.cjs +166 -0
  6. package/lib/OptionsConfigurator.d.cts +2229 -0
  7. package/lib/OptionsConfigurator.d.ts +2229 -0
  8. package/lib/OptionsConfigurator.js +163 -0
  9. package/lib/View.cjs +22 -0
  10. package/lib/View.d.cts +14 -0
  11. package/lib/View.d.ts +14 -0
  12. package/lib/View.js +20 -0
  13. package/lib/index.cjs +103 -0
  14. package/lib/index.d.cts +16 -0
  15. package/lib/index.d.ts +16 -0
  16. package/lib/index.js +14 -0
  17. package/lib/inheritProxifiedPrototype.cjs +19 -0
  18. package/lib/inheritProxifiedPrototype.d.cts +11 -0
  19. package/lib/inheritProxifiedPrototype.d.ts +11 -0
  20. package/lib/inheritProxifiedPrototype.js +16 -0
  21. package/lib/inheritProxifiedPrototypeProperty.cjs +45 -0
  22. package/lib/inheritProxifiedPrototypeProperty.d.cts +9 -0
  23. package/lib/inheritProxifiedPrototypeProperty.d.ts +9 -0
  24. package/lib/inheritProxifiedPrototypeProperty.js +43 -0
  25. package/lib/inspector/Inspector.cjs +227 -0
  26. package/lib/inspector/Inspector.d.cts +4 -0
  27. package/lib/inspector/Inspector.d.ts +4 -0
  28. package/lib/inspector/Inspector.js +220 -0
  29. package/lib/inspector/defaults/ignoreValuesDefaults.cjs +11 -0
  30. package/lib/inspector/defaults/ignoreValuesDefaults.d.cts +11 -0
  31. package/lib/inspector/defaults/ignoreValuesDefaults.d.ts +11 -0
  32. package/lib/inspector/defaults/ignoreValuesDefaults.js +11 -0
  33. package/lib/inspector/defaults/ignoreValuesFilterDefaults.cjs +23 -0
  34. package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.cts +11 -0
  35. package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.ts +11 -0
  36. package/lib/inspector/defaults/ignoreValuesFilterDefaults.js +21 -0
  37. package/lib/inspector/defaults/inspectDefaults.cjs +17 -0
  38. package/lib/inspector/defaults/inspectDefaults.d.cts +8 -0
  39. package/lib/inspector/defaults/inspectDefaults.d.ts +8 -0
  40. package/lib/inspector/defaults/inspectDefaults.js +16 -0
  41. package/lib/inspector/defaults/inspectorDefaults.cjs +15 -0
  42. package/lib/inspector/defaults/inspectorDefaults.d.cts +11 -0
  43. package/lib/inspector/defaults/inspectorDefaults.d.ts +11 -0
  44. package/lib/inspector/defaults/inspectorDefaults.js +14 -0
  45. package/lib/inspector/types.cjs +2 -0
  46. package/lib/inspector/types.d.cts +4 -0
  47. package/lib/inspector/types.d.ts +4 -0
  48. package/lib/inspector/types.js +1 -0
  49. package/lib/parenting/ParentRelationTypes.cjs +130 -0
  50. package/lib/parenting/ParentRelationTypes.d.cts +4 -0
  51. package/lib/parenting/ParentRelationTypes.d.ts +4 -0
  52. package/lib/parenting/ParentRelationTypes.js +123 -0
  53. package/lib/parenting/Parenting.cjs +88 -0
  54. package/lib/parenting/Parenting.d.cts +4 -0
  55. package/lib/parenting/Parenting.d.ts +4 -0
  56. package/lib/parenting/Parenting.js +85 -0
  57. package/lib/parenting/types.cjs +2 -0
  58. package/lib/parenting/types.d.cts +4 -0
  59. package/lib/parenting/types.d.ts +4 -0
  60. package/lib/parenting/types.js +1 -0
  61. package/package.json +239 -21
  62. package/index.d.ts +0 -193
  63. package/index.mjs +0 -628
@@ -0,0 +1,163 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+ import { KindGuard, Type } from '@sinclair/typebox';
3
+ import { Value } from '@sinclair/typebox/value';
4
+ import { assertValidSchema } from '@mono/tschema';
5
+ import { entriesOf, keysOf } from '@mono/object';
6
+
7
+ function OptionsConfigurator(schemaOrProps, defaultKeys) {
8
+ const props = KindGuard.IsObject(schemaOrProps) ? schemaOrProps.properties : schemaOrProps;
9
+ const schema = KindGuard.IsObject(schemaOrProps) ? schemaOrProps : Type.Object(props);
10
+ const defaults = entriesOf(props).reduce((acc, [key, prop]) => {
11
+ if ("default" in prop) {
12
+ Reflect.set(acc, key, typeof prop.default === "function" ? prop.default : () => {
13
+ return prop.default;
14
+ });
15
+ }
16
+ return acc;
17
+ }, {});
18
+ const requiredKeys = schema.required;
19
+ const optionalKeys = keysOf(props).filter((k) => {
20
+ return !requiredKeys.includes(k);
21
+ });
22
+ const create = createConfigurator({
23
+ defaults,
24
+ requiredKeys,
25
+ optionalKeys
26
+ });
27
+ const build = /* @__PURE__ */ __name((callback) => {
28
+ const builder = create();
29
+ const options = callback(builder);
30
+ return options;
31
+ }, "build");
32
+ build.getSchemaProps = () => {
33
+ return props;
34
+ };
35
+ build.getSchema = () => {
36
+ return schema;
37
+ };
38
+ build.getDefaults = () => {
39
+ return defaults;
40
+ };
41
+ build.getDefaultKeys = () => {
42
+ return defaultKeys;
43
+ };
44
+ build.cast = (v) => {
45
+ return v;
46
+ };
47
+ build.getCreate = () => {
48
+ return create;
49
+ };
50
+ build.getBuild = () => {
51
+ return build;
52
+ };
53
+ build.createFunction = (func) => {
54
+ function fn(arg0) {
55
+ const options = typeof arg0 === "function" ? build(arg0) : Value.Default(schema, arg0);
56
+ assertValidSchema(schema, options, "Invalid options");
57
+ return func(options);
58
+ }
59
+ __name(fn, "fn");
60
+ if (func.name) {
61
+ Object.defineProperty(fn, "name", {
62
+ value: func.name,
63
+ configurable: true
64
+ });
65
+ }
66
+ Object.defineProperty(fn, "OptionsConfigurator", {
67
+ get() {
68
+ return build;
69
+ },
70
+ enumerable: true
71
+ });
72
+ return fn;
73
+ };
74
+ build.createBaseClass = () => {
75
+ return class Base {
76
+ static {
77
+ __name(this, "Base");
78
+ }
79
+ static get OptionsConfigurator() {
80
+ return build;
81
+ }
82
+ options;
83
+ constructor(arg0) {
84
+ this.options = typeof arg0 === "function" ? build(arg0) : Value.Default(schema, arg0);
85
+ this.initialize();
86
+ }
87
+ /**
88
+ * Called by the constructor
89
+ */
90
+ initialize() {
91
+ this.assertValidOptions();
92
+ }
93
+ isValidOptions() {
94
+ return Value.Check(schema, this.options);
95
+ }
96
+ assertValidOptions() {
97
+ assertValidSchema(schema, this.options, "Invalid options");
98
+ }
99
+ };
100
+ };
101
+ return build;
102
+ }
103
+ __name(OptionsConfigurator, "OptionsConfigurator");
104
+ function createConfigurator(options) {
105
+ let CFG = class CFG {
106
+ static {
107
+ __name(this, "CFG");
108
+ }
109
+ $data;
110
+ constructor($data) {
111
+ this.$data = $data;
112
+ }
113
+ /**
114
+ * Applies defaults for missing values and then returns data.
115
+ */
116
+ done() {
117
+ this.applyDefaults();
118
+ return this.$data;
119
+ }
120
+ /**
121
+ * Set default values for missing keys.
122
+ */
123
+ applyDefaults() {
124
+ entriesOf(options.defaults).forEach(([key, dfValue]) => {
125
+ if (this.$data[key] === void 0) {
126
+ const df = dfValue?.();
127
+ if (df !== void 0) {
128
+ this.$data[key] = df;
129
+ }
130
+ }
131
+ });
132
+ return this;
133
+ }
134
+ };
135
+ const keys = /* @__PURE__ */ new Set([
136
+ ...options.requiredKeys,
137
+ ...keysOf(options.defaults),
138
+ ...options.optionalKeys
139
+ ]);
140
+ for (const key of keys) {
141
+ Object.defineProperty(CFG.prototype, key, {
142
+ value: /* @__PURE__ */ __name(function(value) {
143
+ if (value === void 0) {
144
+ if (key in options.defaults) {
145
+ this.$data[key] = options.defaults[key]();
146
+ } else {
147
+ delete this.$data[key];
148
+ }
149
+ } else {
150
+ this.$data[key] = value;
151
+ }
152
+ return new CFG(this.$data);
153
+ }, "value")
154
+ });
155
+ }
156
+ return /* @__PURE__ */ __name(function configurator() {
157
+ const ins = new CFG({});
158
+ return ins;
159
+ }, "configurator");
160
+ }
161
+ __name(createConfigurator, "createConfigurator");
162
+
163
+ export { OptionsConfigurator };
package/lib/View.cjs ADDED
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ const TARGET_SYMBOL = /* @__PURE__ */ Symbol("target");
6
+ class View {
7
+ static {
8
+ __name(this, "View");
9
+ }
10
+ [TARGET_SYMBOL];
11
+ constructor(target) {
12
+ this[TARGET_SYMBOL] = target;
13
+ }
14
+ get [Symbol.toStringTag]() {
15
+ return this.constructor.name;
16
+ }
17
+ get target() {
18
+ return this[TARGET_SYMBOL];
19
+ }
20
+ }
21
+
22
+ exports.View = View;
package/lib/View.d.cts ADDED
@@ -0,0 +1,14 @@
1
+ import { IView } from './IView.cjs';
2
+
3
+ declare const TARGET_SYMBOL: unique symbol;
4
+ /**
5
+ * Base class providing view functionality over a target object using the Composition pattern.
6
+ */
7
+ declare class View<Target extends object> implements IView<Target> {
8
+ private [TARGET_SYMBOL];
9
+ constructor(target: Target);
10
+ get [Symbol.toStringTag](): string;
11
+ get target(): Target;
12
+ }
13
+
14
+ export { View };
package/lib/View.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { IView } from './IView.js';
2
+
3
+ declare const TARGET_SYMBOL: unique symbol;
4
+ /**
5
+ * Base class providing view functionality over a target object using the Composition pattern.
6
+ */
7
+ declare class View<Target extends object> implements IView<Target> {
8
+ private [TARGET_SYMBOL];
9
+ constructor(target: Target);
10
+ get [Symbol.toStringTag](): string;
11
+ get target(): Target;
12
+ }
13
+
14
+ export { View };
package/lib/View.js ADDED
@@ -0,0 +1,20 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+
3
+ const TARGET_SYMBOL = /* @__PURE__ */ Symbol("target");
4
+ class View {
5
+ static {
6
+ __name(this, "View");
7
+ }
8
+ [TARGET_SYMBOL];
9
+ constructor(target) {
10
+ this[TARGET_SYMBOL] = target;
11
+ }
12
+ get [Symbol.toStringTag]() {
13
+ return this.constructor.name;
14
+ }
15
+ get target() {
16
+ return this[TARGET_SYMBOL];
17
+ }
18
+ }
19
+
20
+ export { View };
package/lib/index.cjs ADDED
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ var IView = require('./IView');
4
+ var OptionsConfigurator = require('./OptionsConfigurator');
5
+ var View = require('./View');
6
+ var inheritProxifiedPrototype = require('./inheritProxifiedPrototype');
7
+ var inheritProxifiedPrototypeProperty = require('./inheritProxifiedPrototypeProperty');
8
+ var Inspector = require('./inspector/Inspector');
9
+ var ignoreValuesDefaults = require('./inspector/defaults/ignoreValuesDefaults');
10
+ var ignoreValuesFilterDefaults = require('./inspector/defaults/ignoreValuesFilterDefaults');
11
+ var inspectDefaults = require('./inspector/defaults/inspectDefaults');
12
+ var inspectorDefaults = require('./inspector/defaults/inspectorDefaults');
13
+ var types = require('./inspector/types');
14
+ var ParentRelationTypes = require('./parenting/ParentRelationTypes');
15
+ var Parenting = require('./parenting/Parenting');
16
+ var types$1 = require('./parenting/types');
17
+
18
+
19
+
20
+ Object.keys(IView).forEach(function (k) {
21
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
22
+ enumerable: true,
23
+ get: function () { return IView[k]; }
24
+ });
25
+ });
26
+ Object.keys(OptionsConfigurator).forEach(function (k) {
27
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
28
+ enumerable: true,
29
+ get: function () { return OptionsConfigurator[k]; }
30
+ });
31
+ });
32
+ Object.keys(View).forEach(function (k) {
33
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
34
+ enumerable: true,
35
+ get: function () { return View[k]; }
36
+ });
37
+ });
38
+ Object.keys(inheritProxifiedPrototype).forEach(function (k) {
39
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
40
+ enumerable: true,
41
+ get: function () { return inheritProxifiedPrototype[k]; }
42
+ });
43
+ });
44
+ Object.keys(inheritProxifiedPrototypeProperty).forEach(function (k) {
45
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
46
+ enumerable: true,
47
+ get: function () { return inheritProxifiedPrototypeProperty[k]; }
48
+ });
49
+ });
50
+ Object.keys(Inspector).forEach(function (k) {
51
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
52
+ enumerable: true,
53
+ get: function () { return Inspector[k]; }
54
+ });
55
+ });
56
+ Object.keys(ignoreValuesDefaults).forEach(function (k) {
57
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
58
+ enumerable: true,
59
+ get: function () { return ignoreValuesDefaults[k]; }
60
+ });
61
+ });
62
+ Object.keys(ignoreValuesFilterDefaults).forEach(function (k) {
63
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
64
+ enumerable: true,
65
+ get: function () { return ignoreValuesFilterDefaults[k]; }
66
+ });
67
+ });
68
+ Object.keys(inspectDefaults).forEach(function (k) {
69
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
70
+ enumerable: true,
71
+ get: function () { return inspectDefaults[k]; }
72
+ });
73
+ });
74
+ Object.keys(inspectorDefaults).forEach(function (k) {
75
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
76
+ enumerable: true,
77
+ get: function () { return inspectorDefaults[k]; }
78
+ });
79
+ });
80
+ Object.keys(types).forEach(function (k) {
81
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
82
+ enumerable: true,
83
+ get: function () { return types[k]; }
84
+ });
85
+ });
86
+ Object.keys(ParentRelationTypes).forEach(function (k) {
87
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
88
+ enumerable: true,
89
+ get: function () { return ParentRelationTypes[k]; }
90
+ });
91
+ });
92
+ Object.keys(Parenting).forEach(function (k) {
93
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
94
+ enumerable: true,
95
+ get: function () { return Parenting[k]; }
96
+ });
97
+ });
98
+ Object.keys(types$1).forEach(function (k) {
99
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
100
+ enumerable: true,
101
+ get: function () { return types$1[k]; }
102
+ });
103
+ });
@@ -0,0 +1,16 @@
1
+ export { IView } from './IView.cjs';
2
+ export { OptionsConfigurator } from './OptionsConfigurator.cjs';
3
+ export { View } from './View.cjs';
4
+ export { inheritProxifiedPrototype } from './inheritProxifiedPrototype.cjs';
5
+ export { inheritProxifiedPrototypeProperty } from './inheritProxifiedPrototypeProperty.cjs';
6
+ export { C as ClassInspectorMixin, I as IgnoreValueFilter, a as IgnoreValuesOptions, b as InspectFilter, c as Inspector, d as InspectorOptions, e as InspectorTarget } from './Inspector-CrOT_QD4.cjs';
7
+ export { ignoreValuesDefaults } from './inspector/defaults/ignoreValuesDefaults.cjs';
8
+ export { ignoreValuesFilterDefaults } from './inspector/defaults/ignoreValuesFilterDefaults.cjs';
9
+ export { inspectDefaults } from './inspector/defaults/inspectDefaults.cjs';
10
+ export { inspectorDefaults } from './inspector/defaults/inspectorDefaults.cjs';
11
+ export { P as ParentRelationTypes, a as Parenting, b as ParentingTarget, c as ParentingTargetConstructor } from './ParentRelationTypes-UM2G7eeR.cjs';
12
+ import 'node_modules/type-fest/source/internal';
13
+ import '@sinclair/typebox';
14
+ import './basic.d-DTQbMYh8.cjs';
15
+ import 'util';
16
+ import 'mnemonist';
package/lib/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export { IView } from './IView.js';
2
+ export { OptionsConfigurator } from './OptionsConfigurator.js';
3
+ export { View } from './View.js';
4
+ export { inheritProxifiedPrototype } from './inheritProxifiedPrototype.js';
5
+ export { inheritProxifiedPrototypeProperty } from './inheritProxifiedPrototypeProperty.js';
6
+ export { C as ClassInspectorMixin, I as IgnoreValueFilter, a as IgnoreValuesOptions, b as InspectFilter, c as Inspector, d as InspectorOptions, e as InspectorTarget } from './Inspector-DAN0uRqw.js';
7
+ export { ignoreValuesDefaults } from './inspector/defaults/ignoreValuesDefaults.js';
8
+ export { ignoreValuesFilterDefaults } from './inspector/defaults/ignoreValuesFilterDefaults.js';
9
+ export { inspectDefaults } from './inspector/defaults/inspectDefaults.js';
10
+ export { inspectorDefaults } from './inspector/defaults/inspectorDefaults.js';
11
+ export { P as ParentRelationTypes, a as Parenting, b as ParentingTarget, c as ParentingTargetConstructor } from './ParentRelationTypes-BCs-YFio.js';
12
+ import 'node_modules/type-fest/source/internal';
13
+ import '@sinclair/typebox';
14
+ import './basic.d-DTQbMYh8.js';
15
+ import 'util';
16
+ import 'mnemonist';
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export * from './IView';
2
+ export * from './OptionsConfigurator';
3
+ export * from './View';
4
+ export * from './inheritProxifiedPrototype';
5
+ export * from './inheritProxifiedPrototypeProperty';
6
+ export * from './inspector/Inspector';
7
+ export * from './inspector/defaults/ignoreValuesDefaults';
8
+ export * from './inspector/defaults/ignoreValuesFilterDefaults';
9
+ export * from './inspector/defaults/inspectDefaults';
10
+ export * from './inspector/defaults/inspectorDefaults';
11
+ export * from './inspector/types';
12
+ export * from './parenting/ParentRelationTypes';
13
+ export * from './parenting/Parenting';
14
+ export * from './parenting/types';
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var inheritProxifiedPrototypeProperty = require('./inheritProxifiedPrototypeProperty');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ function inheritProxifiedPrototype(ViewerClass, TargetClass, omitKeys) {
8
+ Reflect.ownKeys(TargetClass.prototype).filter((k) => {
9
+ return k !== "constructor" && k !== Symbol.toStringTag;
10
+ }).filter((k) => {
11
+ return omitKeys ? !omitKeys.includes(k) : true;
12
+ }).forEach((k) => {
13
+ return inheritProxifiedPrototypeProperty.inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, k);
14
+ });
15
+ return ViewerClass;
16
+ }
17
+ __name(inheritProxifiedPrototype, "inheritProxifiedPrototype");
18
+
19
+ exports.inheritProxifiedPrototype = inheritProxifiedPrototype;
@@ -0,0 +1,11 @@
1
+ import { C as Class } from './basic.d-DTQbMYh8.cjs';
2
+ import { IView } from './IView.cjs';
3
+
4
+ /**
5
+ * Inherits prototype properties from a target class to a viewer class with proxification, excluding specified keys.
6
+ */
7
+ declare function inheritProxifiedPrototype<Viewer extends IView<Target>, Target extends object, Omitted extends PropertyKey[] = []>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, omitKeys: Omitted): typeof ViewerClass & {
8
+ prototype: Viewer & Omit<Target, Omitted[number]>;
9
+ };
10
+
11
+ export { inheritProxifiedPrototype };
@@ -0,0 +1,11 @@
1
+ import { C as Class } from './basic.d-DTQbMYh8.js';
2
+ import { IView } from './IView.js';
3
+
4
+ /**
5
+ * Inherits prototype properties from a target class to a viewer class with proxification, excluding specified keys.
6
+ */
7
+ declare function inheritProxifiedPrototype<Viewer extends IView<Target>, Target extends object, Omitted extends PropertyKey[] = []>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, omitKeys: Omitted): typeof ViewerClass & {
8
+ prototype: Viewer & Omit<Target, Omitted[number]>;
9
+ };
10
+
11
+ export { inheritProxifiedPrototype };
@@ -0,0 +1,16 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+ import { inheritProxifiedPrototypeProperty } from './inheritProxifiedPrototypeProperty';
3
+
4
+ function inheritProxifiedPrototype(ViewerClass, TargetClass, omitKeys) {
5
+ Reflect.ownKeys(TargetClass.prototype).filter((k) => {
6
+ return k !== "constructor" && k !== Symbol.toStringTag;
7
+ }).filter((k) => {
8
+ return omitKeys ? !omitKeys.includes(k) : true;
9
+ }).forEach((k) => {
10
+ return inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, k);
11
+ });
12
+ return ViewerClass;
13
+ }
14
+ __name(inheritProxifiedPrototype, "inheritProxifiedPrototype");
15
+
16
+ export { inheritProxifiedPrototype };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, key) {
6
+ const des = Reflect.getOwnPropertyDescriptor(TargetClass.prototype, key);
7
+ if (!des) {
8
+ return;
9
+ }
10
+ if (des.value && typeof des.value === "function") {
11
+ return Object.defineProperty(ViewerClass.prototype, key, {
12
+ value(...args) {
13
+ return this.target[key](...args);
14
+ },
15
+ writable: true,
16
+ configurable: true,
17
+ enumerable: false
18
+ });
19
+ } else if (des && !des.get && !des.set) {
20
+ return Object.defineProperty(ViewerClass.prototype, key, {
21
+ get() {
22
+ return this.target[key];
23
+ },
24
+ set: des.writable ? /* @__PURE__ */ __name(function set(value) {
25
+ this.target[key] = value;
26
+ }, "set") : void 0,
27
+ configurable: true,
28
+ enumerable: false
29
+ });
30
+ } else {
31
+ Object.defineProperty(ViewerClass.prototype, key, {
32
+ get: des.get ? function() {
33
+ return this.target[key];
34
+ } : void 0,
35
+ set: des.set ? function(value) {
36
+ this.target[key] = value;
37
+ } : void 0,
38
+ configurable: true,
39
+ enumerable: false
40
+ });
41
+ }
42
+ }
43
+ __name(inheritProxifiedPrototypeProperty, "inheritProxifiedPrototypeProperty");
44
+
45
+ exports.inheritProxifiedPrototypeProperty = inheritProxifiedPrototypeProperty;
@@ -0,0 +1,9 @@
1
+ import { C as Class } from './basic.d-DTQbMYh8.cjs';
2
+ import { IView } from './IView.cjs';
3
+
4
+ /**
5
+ * Inherits a single prototype property from a target class to a viewer class with proxification.
6
+ */
7
+ declare function inheritProxifiedPrototypeProperty<Viewer extends IView<Target>, Target extends object>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, key: keyof Target): Pick<Viewer, keyof Viewer> | undefined;
8
+
9
+ export { inheritProxifiedPrototypeProperty };
@@ -0,0 +1,9 @@
1
+ import { C as Class } from './basic.d-DTQbMYh8.js';
2
+ import { IView } from './IView.js';
3
+
4
+ /**
5
+ * Inherits a single prototype property from a target class to a viewer class with proxification.
6
+ */
7
+ declare function inheritProxifiedPrototypeProperty<Viewer extends IView<Target>, Target extends object>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, key: keyof Target): Pick<Viewer, keyof Viewer> | undefined;
8
+
9
+ export { inheritProxifiedPrototypeProperty };
@@ -0,0 +1,43 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+
3
+ function inheritProxifiedPrototypeProperty(ViewerClass, TargetClass, key) {
4
+ const des = Reflect.getOwnPropertyDescriptor(TargetClass.prototype, key);
5
+ if (!des) {
6
+ return;
7
+ }
8
+ if (des.value && typeof des.value === "function") {
9
+ return Object.defineProperty(ViewerClass.prototype, key, {
10
+ value(...args) {
11
+ return this.target[key](...args);
12
+ },
13
+ writable: true,
14
+ configurable: true,
15
+ enumerable: false
16
+ });
17
+ } else if (des && !des.get && !des.set) {
18
+ return Object.defineProperty(ViewerClass.prototype, key, {
19
+ get() {
20
+ return this.target[key];
21
+ },
22
+ set: des.writable ? /* @__PURE__ */ __name(function set(value) {
23
+ this.target[key] = value;
24
+ }, "set") : void 0,
25
+ configurable: true,
26
+ enumerable: false
27
+ });
28
+ } else {
29
+ Object.defineProperty(ViewerClass.prototype, key, {
30
+ get: des.get ? function() {
31
+ return this.target[key];
32
+ } : void 0,
33
+ set: des.set ? function(value) {
34
+ this.target[key] = value;
35
+ } : void 0,
36
+ configurable: true,
37
+ enumerable: false
38
+ });
39
+ }
40
+ }
41
+ __name(inheritProxifiedPrototypeProperty, "inheritProxifiedPrototypeProperty");
42
+
43
+ export { inheritProxifiedPrototypeProperty };