@mlightcad/common 1.2.1 → 1.2.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 (67) hide show
  1. package/package.json +2 -2
  2. package/dist/common.js +0 -1479
  3. package/dist/common.umd.cjs +0 -1
  4. package/lib/AcCmColor.d.ts +0 -201
  5. package/lib/AcCmColor.d.ts.map +0 -1
  6. package/lib/AcCmColor.js +0 -641
  7. package/lib/AcCmColor.js.map +0 -1
  8. package/lib/AcCmColorUtil.d.ts +0 -41
  9. package/lib/AcCmColorUtil.d.ts.map +0 -1
  10. package/lib/AcCmColorUtil.js +0 -90
  11. package/lib/AcCmColorUtil.js.map +0 -1
  12. package/lib/AcCmErrors.d.ts +0 -56
  13. package/lib/AcCmErrors.d.ts.map +0 -1
  14. package/lib/AcCmErrors.js +0 -70
  15. package/lib/AcCmErrors.js.map +0 -1
  16. package/lib/AcCmEventDispatcher.d.ts +0 -101
  17. package/lib/AcCmEventDispatcher.d.ts.map +0 -1
  18. package/lib/AcCmEventDispatcher.js +0 -97
  19. package/lib/AcCmEventDispatcher.js.map +0 -1
  20. package/lib/AcCmEventManager.d.ts +0 -66
  21. package/lib/AcCmEventManager.d.ts.map +0 -1
  22. package/lib/AcCmEventManager.js +0 -133
  23. package/lib/AcCmEventManager.js.map +0 -1
  24. package/lib/AcCmLodashUtils.d.ts +0 -145
  25. package/lib/AcCmLodashUtils.d.ts.map +0 -1
  26. package/lib/AcCmLodashUtils.js +0 -293
  27. package/lib/AcCmLodashUtils.js.map +0 -1
  28. package/lib/AcCmLogUtil.d.ts +0 -80
  29. package/lib/AcCmLogUtil.d.ts.map +0 -1
  30. package/lib/AcCmLogUtil.js +0 -72
  31. package/lib/AcCmLogUtil.js.map +0 -1
  32. package/lib/AcCmObject.d.ts +0 -150
  33. package/lib/AcCmObject.d.ts.map +0 -1
  34. package/lib/AcCmObject.js +0 -204
  35. package/lib/AcCmObject.js.map +0 -1
  36. package/lib/AcCmPerformanceCollector.d.ts +0 -89
  37. package/lib/AcCmPerformanceCollector.d.ts.map +0 -1
  38. package/lib/AcCmPerformanceCollector.js +0 -119
  39. package/lib/AcCmPerformanceCollector.js.map +0 -1
  40. package/lib/AcCmStringUtil.d.ts +0 -44
  41. package/lib/AcCmStringUtil.d.ts.map +0 -1
  42. package/lib/AcCmStringUtil.js +0 -58
  43. package/lib/AcCmStringUtil.js.map +0 -1
  44. package/lib/AcCmTaskScheduler.d.ts +0 -186
  45. package/lib/AcCmTaskScheduler.d.ts.map +0 -1
  46. package/lib/AcCmTaskScheduler.js +0 -253
  47. package/lib/AcCmTaskScheduler.js.map +0 -1
  48. package/lib/index.d.ts +0 -12
  49. package/lib/index.d.ts.map +0 -1
  50. package/lib/index.js +0 -12
  51. package/lib/index.js.map +0 -1
  52. package/lib/loader/AcCmFileLoader.d.ts +0 -95
  53. package/lib/loader/AcCmFileLoader.d.ts.map +0 -1
  54. package/lib/loader/AcCmFileLoader.js +0 -275
  55. package/lib/loader/AcCmFileLoader.js.map +0 -1
  56. package/lib/loader/AcCmLoader.d.ts +0 -125
  57. package/lib/loader/AcCmLoader.d.ts.map +0 -1
  58. package/lib/loader/AcCmLoader.js +0 -116
  59. package/lib/loader/AcCmLoader.js.map +0 -1
  60. package/lib/loader/AcCmLoadingManager.d.ts +0 -166
  61. package/lib/loader/AcCmLoadingManager.d.ts.map +0 -1
  62. package/lib/loader/AcCmLoadingManager.js +0 -172
  63. package/lib/loader/AcCmLoadingManager.js.map +0 -1
  64. package/lib/loader/index.d.ts +0 -3
  65. package/lib/loader/index.d.ts.map +0 -1
  66. package/lib/loader/index.js +0 -3
  67. package/lib/loader/index.js.map +0 -1
@@ -1,72 +0,0 @@
1
- /**
2
- * @fileoverview Logging utilities for the AutoCAD Common library.
3
- *
4
- * This module provides a centralized logging interface using the loglevel library,
5
- * with configurable log levels for development and production environments.
6
- *
7
- * @module AcCmLogUtil
8
- * @version 1.0.0
9
- */
10
- import * as loglevel from 'loglevel';
11
- /**
12
- * Flag indicating whether debug mode is enabled.
13
- * When true, sets log level to 'debug'; otherwise sets to 'warn'.
14
- *
15
- * @constant {boolean}
16
- */
17
- export var DEBUG_MODE = true;
18
- /**
19
- * The main logging instance from the loglevel library.
20
- * Provides standard logging methods: trace, debug, info, warn, error.
21
- *
22
- * @constant {loglevel.Logger}
23
- *
24
- * @example
25
- * ```typescript
26
- * import { log } from './AcCmLogUtil'
27
- *
28
- * log.debug('Debug message')
29
- * log.info('Info message')
30
- * log.warn('Warning message')
31
- * log.error('Error message')
32
- * ```
33
- */
34
- export var log = loglevel;
35
- if (DEBUG_MODE) {
36
- log.setLevel('debug');
37
- }
38
- else {
39
- log.setLevel('warn');
40
- }
41
- /**
42
- * Sets the log level for the logging system.
43
- *
44
- * Valid log levels are: 'trace', 'debug', 'info', 'warn', 'error', 'silent'.
45
- * If an invalid level is provided, the level will default to 'error' and an error will be logged.
46
- *
47
- * @param {string} level - The log level to set.
48
- *
49
- * @example
50
- * ```typescript
51
- * import { setLogLevel } from './AcCmLogUtil'
52
- *
53
- * // Set to debug level for development
54
- * setLogLevel('debug')
55
- *
56
- * // Set to error level for production
57
- * setLogLevel('error')
58
- *
59
- * // Silent all logging
60
- * setLogLevel('silent')
61
- * ```
62
- */
63
- export var setLogLevel = function (level) {
64
- try {
65
- log.setLevel(level);
66
- }
67
- catch (ex) {
68
- log.setLevel('error');
69
- log.error(ex);
70
- }
71
- };
72
- //# sourceMappingURL=AcCmLogUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmLogUtil.js","sourceRoot":"","sources":["../src/AcCmLogUtil.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,IAAI,CAAA;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,IAAM,GAAG,GAAG,QAAQ,CAAA;AAE3B,IAAI,UAAU,EAAE,CAAC;IACf,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC;KAAM,CAAC;IACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,KAAa;IACvC,IAAI,CAAC;QACH,GAAG,CAAC,QAAQ,CAAC,KAA8B,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACrB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACf,CAAC;AACH,CAAC,CAAA"}
@@ -1,150 +0,0 @@
1
- /**
2
- * @fileoverview Object model implementation for the AutoCAD Common library.
3
- *
4
- * This module provides a reactive object model with attribute management,
5
- * change tracking, and event notification. Inspired by Backbone.js Model
6
- * but with TypeScript support and reduced dependencies.
7
- *
8
- * @module AcCmObject
9
- * @version 1.0.0
10
- */
11
- import { AcCmEventManager } from './AcCmEventManager';
12
- export type AcCmAttributes = Record<string, any>;
13
- /**
14
- * Options to set attributes of one `AcCmObject` instance
15
- */
16
- export interface AcCmObjectOptions {
17
- silent?: boolean | undefined;
18
- unset?: boolean | undefined;
19
- }
20
- export type AcCmStringKey<T> = keyof T & string;
21
- /**
22
- * Interface to define arguments of changed event of one `AcCmObject` instance
23
- */
24
- export interface AcCmObjectChangedEventArgs<T extends AcCmAttributes> {
25
- object: AcCmObject<T>;
26
- options?: AcCmObjectOptions;
27
- }
28
- /**
29
- * Interface to define arguments of attribute changed event of one `AcCmObject` instance
30
- */
31
- export interface AcCmObjectAttributeChangedEventArgs<T extends AcCmAttributes> extends AcCmObjectChangedEventArgs<T> {
32
- attrName?: string;
33
- attrValue?: any;
34
- }
35
- /**
36
- * This class is used to store attributes of one data model. It has the following benifits.
37
- * - Get notification when value of one attributes is changed
38
- * - Have one `changed` property to store all of changed values
39
- * - Store all of states of one model in one key/value object and make it is easy to serialize/deserialize model and model changes
40
- *
41
- * Actually implementation of this class is based on class Model in Backbone.js. However, Model class in Backbone
42
- * is too heavy. So we implement it again based on source code of class Model in Backbone.js. Morever, we want to
43
- * keep our library with less external dependencies and don't want to introduce depenedency on Backbone.js.
44
- */
45
- export declare class AcCmObject<T extends AcCmAttributes = any> {
46
- attributes: Partial<T>;
47
- changed: Partial<T>;
48
- readonly events: {
49
- attrChanged: AcCmEventManager<AcCmObjectAttributeChangedEventArgs<T>>;
50
- modelChanged: AcCmEventManager<AcCmObjectChangedEventArgs<T>>;
51
- };
52
- private _changing;
53
- private _previousAttributes;
54
- private _pending;
55
- /**
56
- * Create one object to store attributes. For performance reason, values of attributes passed to constructor
57
- * will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
58
- * is just a reference to arguments `attributes` passed to constructor.
59
- * @param attributes Input attributes to store in this object
60
- */
61
- constructor(attributes?: Partial<T>, defaultAttrs?: Partial<T>);
62
- /**
63
- * Gets the value of an attribute.
64
- *
65
- * For strongly-typed access to attributes, use the `get` method privately in public getter properties.
66
- *
67
- * @template A - The key type extending string keys of T.
68
- * @param {A} key - The attribute key to retrieve.
69
- * @returns {T[A] | undefined} The attribute value or undefined if not set.
70
- *
71
- * @example
72
- * ```typescript
73
- * // Get a single attribute value
74
- * const name = obj.get('name')
75
- * const visible = obj.get('visible')
76
- *
77
- * // Check if attribute exists
78
- * if (obj.get('name') !== undefined) {
79
- * console.log('Name is set')
80
- * }
81
- *
82
- * // For strongly-typed subclasses
83
- * get name(): string {
84
- * return super.get("name")
85
- * }
86
- * ```
87
- */
88
- get<A extends AcCmStringKey<T>>(key: A): T[A] | undefined;
89
- /**
90
- * Sets one or more attributes on the object.
91
- *
92
- * For strongly-typed assignment of attributes, use the `set` method privately in public setter properties.
93
- * Triggers change events unless the `silent` option is specified.
94
- *
95
- * @template A - The key type extending string keys of T.
96
- * @param {A | Partial<T>} key - The attribute key or an object of key-value pairs.
97
- * @param {T[A] | AcCmObjectOptions} [val] - The value to set or options when key is an object.
98
- * @param {AcCmObjectOptions} [options] - Options for the set operation.
99
- * @returns {this} The current instance for method chaining.
100
- *
101
- * @example
102
- * ```typescript
103
- * // Set a single attribute
104
- * obj.set('name', 'MyEntity')
105
- *
106
- * // Set multiple attributes
107
- * obj.set({ name: 'MyEntity', visible: true })
108
- *
109
- * // Set with options
110
- * obj.set('name', 'MyEntity', { silent: true })
111
- *
112
- * // Unset an attribute
113
- * obj.set('name', undefined, { unset: true })
114
- *
115
- * // For strongly-typed subclasses
116
- * set name(value: string) {
117
- * super.set("name", value)
118
- * }
119
- * ```
120
- */
121
- set<A extends AcCmStringKey<T>>(key: A, val?: T[A], options?: AcCmObjectOptions): this;
122
- set(key: Partial<T>, options?: AcCmObjectOptions): this;
123
- has(key: AcCmStringKey<T>): boolean;
124
- /**
125
- * Determine if the model has changed since the last `"change"` event.
126
- * If you specify an attribute name, determine if that attribute has changed.
127
- */
128
- hasChanged(key?: AcCmStringKey<T>): boolean;
129
- /**
130
- * Return an object containing all the attributes that have changed. Useful for determining what parts
131
- * of a view need to be updated and/or what attributes need to be persisted to the server.
132
- *
133
- * Unset attributes will be set to undefined. You can also pass an attributes object to diff against
134
- * the model, determining if there *would be* a change.
135
- */
136
- changedAttributes(diff?: Partial<T>): Partial<T>;
137
- /**
138
- * Get the previous value of an attribute, recorded at the time the last `"change"` event was fired.
139
- */
140
- previous<A extends AcCmStringKey<T>>(key: A): T[A] | null | undefined;
141
- /**
142
- * Get all of the attributes of the model at the time of the previous `"change"` event.
143
- */
144
- previousAttributes(): Partial<T>;
145
- /**
146
- * Create a new model with identical attributes to this one.
147
- */
148
- clone(): AcCmObject<T>;
149
- }
150
- //# sourceMappingURL=AcCmObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmObject.d.ts","sourceRoot":"","sources":["../src/AcCmObject.ts"],"names":[],"mappings":"AAAA;;;;;;;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C,CAAC,CAAC,CAAC,GAAG,SAAS;IAIzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,GAAG,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAC5B,GAAG,EAAE,CAAC,EACN,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EACV,OAAO,CAAC,EAAE,iBAAiB,GAC1B,IAAI;IACP,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAiFvD,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO;IAInC;;;OAGG;IACH,UAAU,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;IAKjC;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAYhD;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;IAKrE;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,CAAC,CAAC;IAIhC;;OAEG;IACH,KAAK;CAIN"}
package/lib/AcCmObject.js DELETED
@@ -1,204 +0,0 @@
1
- /**
2
- * @fileoverview Object model implementation for the AutoCAD Common library.
3
- *
4
- * This module provides a reactive object model with attribute management,
5
- * change tracking, and event notification. Inspired by Backbone.js Model
6
- * but with TypeScript support and reduced dependencies.
7
- *
8
- * @module AcCmObject
9
- * @version 1.0.0
10
- */
11
- import { AcCmEventManager } from './AcCmEventManager';
12
- import { clone, defaults, has, isEmpty, isEqual } from './AcCmLodashUtils';
13
- /**
14
- * This class is used to store attributes of one data model. It has the following benifits.
15
- * - Get notification when value of one attributes is changed
16
- * - Have one `changed` property to store all of changed values
17
- * - Store all of states of one model in one key/value object and make it is easy to serialize/deserialize model and model changes
18
- *
19
- * Actually implementation of this class is based on class Model in Backbone.js. However, Model class in Backbone
20
- * is too heavy. So we implement it again based on source code of class Model in Backbone.js. Morever, we want to
21
- * keep our library with less external dependencies and don't want to introduce depenedency on Backbone.js.
22
- */
23
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- var AcCmObject = /** @class */ (function () {
25
- /**
26
- * Create one object to store attributes. For performance reason, values of attributes passed to constructor
27
- * will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
28
- * is just a reference to arguments `attributes` passed to constructor.
29
- * @param attributes Input attributes to store in this object
30
- */
31
- function AcCmObject(attributes, defaultAttrs) {
32
- this.events = {
33
- attrChanged: new AcCmEventManager(),
34
- modelChanged: new AcCmEventManager()
35
- };
36
- this._changing = false;
37
- this._previousAttributes = {};
38
- this._pending = false;
39
- var attrs = attributes || {};
40
- if (defaultAttrs) {
41
- defaults(attrs, defaultAttrs);
42
- }
43
- this.attributes = attrs;
44
- this.changed = {};
45
- }
46
- /**
47
- * Gets the value of an attribute.
48
- *
49
- * For strongly-typed access to attributes, use the `get` method privately in public getter properties.
50
- *
51
- * @template A - The key type extending string keys of T.
52
- * @param {A} key - The attribute key to retrieve.
53
- * @returns {T[A] | undefined} The attribute value or undefined if not set.
54
- *
55
- * @example
56
- * ```typescript
57
- * // Get a single attribute value
58
- * const name = obj.get('name')
59
- * const visible = obj.get('visible')
60
- *
61
- * // Check if attribute exists
62
- * if (obj.get('name') !== undefined) {
63
- * console.log('Name is set')
64
- * }
65
- *
66
- * // For strongly-typed subclasses
67
- * get name(): string {
68
- * return super.get("name")
69
- * }
70
- * ```
71
- */
72
- AcCmObject.prototype.get = function (key) {
73
- return this.attributes[key];
74
- };
75
- AcCmObject.prototype.set = function (key, val, options) {
76
- if (key == null)
77
- return this;
78
- // Handle both `"key", value` and `{key: value}` -style arguments.
79
- var attrs;
80
- if (typeof key === 'object') {
81
- attrs = key;
82
- options = val;
83
- }
84
- else {
85
- attrs = {};
86
- attrs[key] = val;
87
- }
88
- options || (options = {});
89
- // Extract attributes and options.
90
- var unset = options.unset;
91
- var silent = options.silent;
92
- var changes = [];
93
- var changing = this._changing;
94
- this._changing = true;
95
- if (!changing) {
96
- this._previousAttributes = clone(this.attributes);
97
- this.changed = {};
98
- }
99
- var current = this.attributes;
100
- var changed = this.changed;
101
- var prev = this._previousAttributes;
102
- // For each `set` attribute, update or delete the current value.
103
- for (var attr in attrs) {
104
- val = attrs[attr];
105
- if (!isEqual(current[attr], val))
106
- changes.push(attr);
107
- if (!isEqual(prev[attr], val)) {
108
- changed[attr] = val;
109
- }
110
- else {
111
- delete changed[attr];
112
- }
113
- unset ? delete current[attr] : (current[attr] = val);
114
- }
115
- // Trigger all relevant attribute changes.
116
- if (!silent) {
117
- // @ts-expect-error just keep backbone implementation as is
118
- if (changes.length)
119
- this._pending = options;
120
- for (var i = 0; i < changes.length; i++) {
121
- this.events.attrChanged.dispatch({
122
- object: this,
123
- attrName: changes[i],
124
- attrValue: current[changes[i]],
125
- options: options
126
- });
127
- }
128
- }
129
- // You might be wondering why there's a `while` loop here. Changes can
130
- // be recursively nested within `"change"` events.
131
- if (changing)
132
- return this;
133
- if (!silent) {
134
- while (this._pending) {
135
- // @ts-expect-error just keep backbone implementation as is
136
- options = this._pending;
137
- this._pending = false;
138
- this.events.modelChanged.dispatch({
139
- object: this,
140
- options: options
141
- });
142
- }
143
- }
144
- this._pending = false;
145
- this._changing = false;
146
- return this;
147
- };
148
- AcCmObject.prototype.has = function (key) {
149
- return this.get(key) != null;
150
- };
151
- /**
152
- * Determine if the model has changed since the last `"change"` event.
153
- * If you specify an attribute name, determine if that attribute has changed.
154
- */
155
- AcCmObject.prototype.hasChanged = function (key) {
156
- if (key == null)
157
- return !isEmpty(this.changed);
158
- return has(this.changed, key);
159
- };
160
- /**
161
- * Return an object containing all the attributes that have changed. Useful for determining what parts
162
- * of a view need to be updated and/or what attributes need to be persisted to the server.
163
- *
164
- * Unset attributes will be set to undefined. You can also pass an attributes object to diff against
165
- * the model, determining if there *would be* a change.
166
- */
167
- AcCmObject.prototype.changedAttributes = function (diff) {
168
- if (!diff)
169
- return this.hasChanged() ? clone(this.changed) : {};
170
- var old = this._changing ? this._previousAttributes : this.attributes;
171
- var changed = {};
172
- for (var attr in diff) {
173
- var val = diff[attr];
174
- if (isEqual(old[attr], val))
175
- continue;
176
- changed[attr] = val;
177
- }
178
- return changed;
179
- };
180
- /**
181
- * Get the previous value of an attribute, recorded at the time the last `"change"` event was fired.
182
- */
183
- AcCmObject.prototype.previous = function (key) {
184
- if (key == null || !this._previousAttributes)
185
- return null;
186
- return this._previousAttributes[key];
187
- };
188
- /**
189
- * Get all of the attributes of the model at the time of the previous `"change"` event.
190
- */
191
- AcCmObject.prototype.previousAttributes = function () {
192
- return clone(this._previousAttributes);
193
- };
194
- /**
195
- * Create a new model with identical attributes to this one.
196
- */
197
- AcCmObject.prototype.clone = function () {
198
- var attrs = clone(this.attributes);
199
- return new AcCmObject(attrs);
200
- };
201
- return AcCmObject;
202
- }());
203
- export { AcCmObject };
204
- //# sourceMappingURL=AcCmObject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmObject.js","sourceRoot":"","sources":["../src/AcCmObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAiC1E;;;;;;;;;GASG;AACH,8DAA8D;AAC9D;IAaE;;;;;OAKG;IACH,oBAAY,UAAuB,EAAE,YAAyB;QAf9C,WAAM,GAAG;YACvB,WAAW,EAAE,IAAI,gBAAgB,EAA0C;YAC3E,YAAY,EAAE,IAAI,gBAAgB,EAAiC;SACpE,CAAA;QAEO,cAAS,GAAY,KAAK,CAAA;QAC1B,wBAAmB,GAA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AO,GAAe,EAAE,CAAA;QAC9B,KAAK,IAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC;gBAAE,SAAQ;YACrC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;QACrB,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;OAEG;IACH,6BAAQ,GAAR,UAAqC,GAAM;QACzC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,mBAAmB;YAAE,OAAO,IAAI,CAAA;QACzD,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,uCAAkB,GAAlB;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,0BAAK,GAAL;QACE,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACpC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IACH,iBAAC;AAAD,CAAC,AAtOD,IAsOC"}
@@ -1,89 +0,0 @@
1
- /**
2
- * @fileoverview Performance monitoring and collection system for the AutoCAD Common library.
3
- *
4
- * This module provides a singleton-based performance collector that can store,
5
- * retrieve, and format performance metrics for debugging and optimization purposes.
6
- *
7
- * @module AcCmPerformanceCollector
8
- * @version 1.0.0
9
- */
10
- /**
11
- * A performance entry containing a unique name, associated data,
12
- * and a method to format the data into a human-readable string.
13
- *
14
- * @template T - The type of the performance data.
15
- *
16
- * @example
17
- * ```typescript
18
- * // Create a custom performance entry
19
- * const loadTimeEntry: AcCmPerformanceEntry<number> = {
20
- * name: 'file-load-time',
21
- * data: 1250, // milliseconds
22
- * format() {
23
- * return `File loaded in ${this.data}ms`
24
- * }
25
- * }
26
- * ```
27
- */
28
- export interface AcCmPerformanceEntry<T> {
29
- /** Unique name of this performance entry. */
30
- name: string;
31
- /** Performance data to be recorded. */
32
- data: T;
33
- /**
34
- * Converts the performance data into a formatted string.
35
- * @returns A string representing the performance data.
36
- */
37
- format(): string;
38
- }
39
- /**
40
- * A singleton class for collecting and managing performance data.
41
- * All entries must have a unique name. Entries are stored in a Map.
42
- */
43
- export declare class AcCmPerformanceCollector {
44
- /** The singleton instance. */
45
- private static instance;
46
- /** Map of performance entries keyed by their unique name. */
47
- private entries;
48
- /**
49
- * Private constructor to enforce singleton pattern.
50
- */
51
- private constructor();
52
- /**
53
- * Retrieves the singleton instance of the AcCmPerformanceCollector.
54
- * @returns The shared AcCmPerformanceCollector instance.
55
- */
56
- static getInstance(): AcCmPerformanceCollector;
57
- /**
58
- * Adds or replaces a performance entry by name.
59
- * @template T The type of the performance data.
60
- * @param entry A performance entry object with name, data, and format method.
61
- */
62
- collect<T>(entry: AcCmPerformanceEntry<T>): void;
63
- /**
64
- * Logs all performance entries to the console using their format method.
65
- */
66
- printAll(): void;
67
- /**
68
- * Clears all collected performance entries.
69
- */
70
- clear(): void;
71
- /**
72
- * Retrieves all entries as an array.
73
- * @returns A copy of all performance entries.
74
- */
75
- getAll(): AcCmPerformanceEntry<unknown>[];
76
- /**
77
- * Gets a single entry by name.
78
- * @param name The unique name of the entry.
79
- * @returns The matching entry or undefined.
80
- */
81
- getEntry(name: string): AcCmPerformanceEntry<unknown> | undefined;
82
- /**
83
- * Removes an entry by name.
84
- * @param name The name of the entry to remove.
85
- * @returns True if the entry was removed; false if not found.
86
- */
87
- remove(name: string): boolean;
88
- }
89
- //# sourceMappingURL=AcCmPerformanceCollector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmPerformanceCollector.d.ts","sourceRoot":"","sources":["../src/AcCmPerformanceCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IAEZ,uCAAuC;IACvC,IAAI,EAAE,CAAC,CAAA;IAEP;;;OAGG;IACH,MAAM,IAAI,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,8BAA8B;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA0B;IAEjD,6DAA6D;IAC7D,OAAO,CAAC,OAAO,CAAwD;IAEvE;;OAEG;IACH,OAAO;IAEP;;;OAGG;WACW,WAAW,IAAI,wBAAwB;IAOrD;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI;IAIvD;;OAEG;IACI,QAAQ,IAAI,IAAI;IAOvB;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;OAGG;IACI,MAAM,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAIhD;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,GAAG,SAAS;IAIxE;;;;OAIG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGrC"}
@@ -1,119 +0,0 @@
1
- /**
2
- * @fileoverview Performance monitoring and collection system for the AutoCAD Common library.
3
- *
4
- * This module provides a singleton-based performance collector that can store,
5
- * retrieve, and format performance metrics for debugging and optimization purposes.
6
- *
7
- * @module AcCmPerformanceCollector
8
- * @version 1.0.0
9
- */
10
- var __values = (this && this.__values) || function(o) {
11
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
12
- if (m) return m.call(o);
13
- if (o && typeof o.length === "number") return {
14
- next: function () {
15
- if (o && i >= o.length) o = void 0;
16
- return { value: o && o[i++], done: !o };
17
- }
18
- };
19
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
20
- };
21
- var __read = (this && this.__read) || function (o, n) {
22
- var m = typeof Symbol === "function" && o[Symbol.iterator];
23
- if (!m) return o;
24
- var i = m.call(o), r, ar = [], e;
25
- try {
26
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
- }
28
- catch (error) { e = { error: error }; }
29
- finally {
30
- try {
31
- if (r && !r.done && (m = i["return"])) m.call(i);
32
- }
33
- finally { if (e) throw e.error; }
34
- }
35
- return ar;
36
- };
37
- /**
38
- * A singleton class for collecting and managing performance data.
39
- * All entries must have a unique name. Entries are stored in a Map.
40
- */
41
- var AcCmPerformanceCollector = /** @class */ (function () {
42
- /**
43
- * Private constructor to enforce singleton pattern.
44
- */
45
- function AcCmPerformanceCollector() {
46
- /** Map of performance entries keyed by their unique name. */
47
- this.entries = new Map();
48
- }
49
- /**
50
- * Retrieves the singleton instance of the AcCmPerformanceCollector.
51
- * @returns The shared AcCmPerformanceCollector instance.
52
- */
53
- AcCmPerformanceCollector.getInstance = function () {
54
- if (!AcCmPerformanceCollector.instance) {
55
- AcCmPerformanceCollector.instance = new AcCmPerformanceCollector();
56
- }
57
- return AcCmPerformanceCollector.instance;
58
- };
59
- /**
60
- * Adds or replaces a performance entry by name.
61
- * @template T The type of the performance data.
62
- * @param entry A performance entry object with name, data, and format method.
63
- */
64
- AcCmPerformanceCollector.prototype.collect = function (entry) {
65
- this.entries.set(entry.name, entry);
66
- };
67
- /**
68
- * Logs all performance entries to the console using their format method.
69
- */
70
- AcCmPerformanceCollector.prototype.printAll = function () {
71
- var e_1, _a;
72
- try {
73
- for (var _b = __values(this.entries), _c = _b.next(); !_c.done; _c = _b.next()) {
74
- var _d = __read(_c.value, 2), name_1 = _d[0], entry = _d[1];
75
- console.log("".concat(name_1, ":"));
76
- console.log(entry.format());
77
- }
78
- }
79
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
80
- finally {
81
- try {
82
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
83
- }
84
- finally { if (e_1) throw e_1.error; }
85
- }
86
- };
87
- /**
88
- * Clears all collected performance entries.
89
- */
90
- AcCmPerformanceCollector.prototype.clear = function () {
91
- this.entries.clear();
92
- };
93
- /**
94
- * Retrieves all entries as an array.
95
- * @returns A copy of all performance entries.
96
- */
97
- AcCmPerformanceCollector.prototype.getAll = function () {
98
- return Array.from(this.entries.values());
99
- };
100
- /**
101
- * Gets a single entry by name.
102
- * @param name The unique name of the entry.
103
- * @returns The matching entry or undefined.
104
- */
105
- AcCmPerformanceCollector.prototype.getEntry = function (name) {
106
- return this.entries.get(name);
107
- };
108
- /**
109
- * Removes an entry by name.
110
- * @param name The name of the entry to remove.
111
- * @returns True if the entry was removed; false if not found.
112
- */
113
- AcCmPerformanceCollector.prototype.remove = function (name) {
114
- return this.entries.delete(name);
115
- };
116
- return AcCmPerformanceCollector;
117
- }());
118
- export { AcCmPerformanceCollector };
119
- //# sourceMappingURL=AcCmPerformanceCollector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmPerformanceCollector.js","sourceRoot":"","sources":["../src/AcCmPerformanceCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH;;;GAGG;AACH;IAOE;;OAEG;IACH;QANA,6DAA6D;QACrD,YAAO,GAA+C,IAAI,GAAG,EAAE,CAAA;IAKhD,CAAC;IAExB;;;OAGG;IACW,oCAAW,GAAzB;QACE,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,EAAE,CAAA;QACpE,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAA;IAC1C,CAAC;IAED;;;;OAIG;IACI,0CAAO,GAAd,UAAkB,KAA8B;QAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACI,2CAAQ,GAAf;;;YACE,KAA4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