@vicin/sigil 3.4.0 → 4.0.1

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/dist/index.js CHANGED
@@ -1,171 +1,125 @@
1
- 'use strict';
1
+ // src/symbols.ts
2
+ var __SIGIL__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__SIGIL__");
3
+ var __SIGIL_LINEAGE__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__SIGIL_LINEAGE__");
4
+ var __LABEL__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__LABEL__");
5
+ var __DEPTH__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__DEPTH__");
6
+ var __SIGIL_REGISTRY__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__SIGIL_REGISTRY__");
7
+
8
+ // src/is.ts
9
+ function isSigilCtor(ctor) {
10
+ return typeof ctor === "function" && ctor.prototype && __SIGIL__ in ctor.prototype;
11
+ }
12
+ function isSigilInstance(inst) {
13
+ return !!inst && typeof inst === "object" && __SIGIL__ in inst;
14
+ }
2
15
 
3
16
  // src/options.ts
4
17
  var OPTIONS = {
5
- labelValidation: null,
6
- autofillLabels: true,
7
- skipLabelUniquenessCheck: false
18
+ labelValidation: null
8
19
  };
9
- var updateSigilOptions = (opts) => {
10
- if ("autofillLabels" in opts) {
11
- if (typeof opts.autofillLabels !== "boolean")
12
- throw new Error("'updateSigilOptions.autofillLabels' must be boolean");
13
- OPTIONS.autofillLabels = opts.autofillLabels;
14
- }
15
- if ("labelValidation" in opts) {
16
- const val = opts.labelValidation;
17
- if (val !== null && typeof val !== "function" && !(val instanceof RegExp))
18
- throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");
19
- OPTIONS.labelValidation = val;
20
- }
21
- if ("skipLabelUniquenessCheck" in opts) {
22
- if (typeof opts.skipLabelUniquenessCheck !== "boolean")
23
- throw new Error("'updateSigilOptions.skipLabelUniquenessCheck' must be boolean");
24
- OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;
25
- }
20
+ var updateSigilOptions = ({ labelValidation = null } = {}) => {
21
+ OPTIONS.labelValidation = labelValidation;
26
22
  };
27
23
  var RECOMMENDED_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
28
- var DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;
29
24
 
30
- // src/symbols.ts
31
- var __SIGIL__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__SIGIL__");
32
- var __LABEL__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__LABEL__");
33
- var __EFFECTIVE_LABEL__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__EFFECTIVE_LABEL__");
34
- var __DEPTH__ = /* @__PURE__ */ Symbol.for("@vicin/sigil.__DEPTH__");
25
+ // src/registry.ts
26
+ function getSigilRegistry() {
27
+ if (globalThis[__SIGIL_REGISTRY__]) return globalThis[__SIGIL_REGISTRY__];
28
+ const resolved = /* @__PURE__ */ new WeakSet();
29
+ const hasOwnSigil2 = /* @__PURE__ */ new WeakSet();
30
+ const registry = {
31
+ registerResolved(ctor) {
32
+ resolved.add(ctor);
33
+ },
34
+ checkResolved(ctor) {
35
+ return resolved.has(ctor);
36
+ },
37
+ registerHasOwn(ctor) {
38
+ hasOwnSigil2.add(ctor);
39
+ },
40
+ checkHasOwn(ctor) {
41
+ return hasOwnSigil2.has(ctor);
42
+ }
43
+ };
44
+ Object.freeze(registry);
45
+ Object.defineProperty(globalThis, __SIGIL_REGISTRY__, {
46
+ value: registry,
47
+ writable: false,
48
+ configurable: false,
49
+ enumerable: false
50
+ });
51
+ return registry;
52
+ }
35
53
 
36
- // src/helpers.ts
37
- var AUTO_LABEL_PREFEX = "@Sigil-auto";
38
- var handledCtors = /* @__PURE__ */ new WeakSet();
39
- var handledCtorsExplicit = /* @__PURE__ */ new WeakSet();
40
- function handleSigilExplicit(ctor, label, opts) {
41
- if (handledCtorsExplicit.has(ctor))
54
+ // src/sigilify.ts
55
+ var sigilRegistry = getSigilRegistry();
56
+ function sigilify(ctor, label, opts) {
57
+ if (sigilRegistry.checkResolved(ctor))
42
58
  throw new Error(
43
59
  `[Sigil Error] Class '${ctor.name}' with label '${ctor.SigilLabel}' is already sigilified`
44
60
  );
45
- verifyLabel(ctor, label, opts);
46
- handleAncestors(ctor, opts);
47
- sigilify(ctor, label, true);
48
- }
49
- function handleSigilLazy(ctor) {
50
- if (handledCtors.has(ctor)) return;
51
- if (!OPTIONS.autofillLabels)
52
- throw new Error(
53
- `[Sigil Error] Class '${ctor == null ? void 0 : ctor.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
54
- );
61
+ verifyLabel(label, opts);
55
62
  handleAncestors(ctor);
56
- sigilify(ctor, generateRandomLabel(ctor), false);
63
+ updateSigil(ctor, label);
64
+ sigilRegistry.registerResolved(ctor);
65
+ sigilRegistry.registerHasOwn(ctor);
66
+ }
67
+ function hasOwnSigil(ctor) {
68
+ return sigilRegistry.checkHasOwn(ctor);
57
69
  }
58
- function handleAncestors(ctor, opts) {
70
+ function verifyLabel(label, opts) {
59
71
  var _a;
60
- const ancestors = [];
72
+ const labelValidation = (_a = opts == null ? void 0 : opts.labelValidation) != null ? _a : OPTIONS.labelValidation;
73
+ if (labelValidation) {
74
+ let valid;
75
+ if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
76
+ else valid = labelValidation(label);
77
+ if (!valid)
78
+ throw new Error(
79
+ `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`
80
+ );
81
+ }
82
+ }
83
+ function handleAncestors(ctor) {
61
84
  let a = Object.getPrototypeOf(ctor);
62
85
  while (a && typeof a === "function" && a.prototype[__SIGIL__]) {
63
- ancestors.unshift(a);
86
+ sigilRegistry.registerResolved(a);
64
87
  a = Object.getPrototypeOf(a);
65
88
  }
66
- const labelOwner = /* @__PURE__ */ new Map();
67
- const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
68
- for (const a2 of ancestors) {
69
- const l = a2.prototype[__LABEL__];
70
- if (labelOwner.has(l)) {
71
- if (!autofillLabels)
72
- throw new Error(
73
- `[Sigil Error] Class '${a2.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
74
- );
75
- sigilify(a2, generateRandomLabel(a2), false);
76
- }
77
- labelOwner.set(a2.prototype[__LABEL__], a2.name);
78
- }
79
89
  }
80
- function sigilify(ctor, label, explicit) {
81
- var _a;
90
+ function updateSigil(ctor, label) {
91
+ var _a, _b;
82
92
  const sym = Symbol.for(label);
83
93
  Object.defineProperty(ctor.prototype, __SIGIL__, {
84
94
  value: sym,
85
- configurable: !explicit,
95
+ configurable: false,
86
96
  enumerable: false,
87
97
  writable: false
88
98
  });
89
99
  Object.defineProperty(ctor.prototype, __LABEL__, {
90
100
  value: label,
91
- configurable: !explicit,
101
+ configurable: false,
92
102
  enumerable: false,
93
103
  writable: false
94
104
  });
95
- if (explicit)
96
- Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {
97
- value: label,
98
- configurable: false,
99
- enumerable: false,
100
- writable: false
101
- });
102
- if (!handledCtors.has(ctor))
103
- Object.defineProperty(ctor.prototype, __DEPTH__, {
104
- value: ((_a = ctor.prototype[__DEPTH__]) != null ? _a : -1) + 1,
105
- configurable: false,
106
- enumerable: false,
107
- writable: false
108
- });
109
- Object.defineProperty(ctor.prototype, sym, {
110
- value: true,
105
+ Object.defineProperty(ctor.prototype, __SIGIL_LINEAGE__, {
106
+ value: [...(_a = Object.getPrototypeOf(ctor).prototype[__SIGIL_LINEAGE__]) != null ? _a : [], sym],
111
107
  configurable: false,
112
108
  enumerable: false,
113
109
  writable: false
114
110
  });
115
- handledCtors.add(ctor);
116
- if (explicit) handledCtorsExplicit.add(ctor);
117
- }
118
- function isSigilCtor(ctor) {
119
- return typeof ctor === "function" && ctor.prototype && __SIGIL__ in ctor.prototype;
120
- }
121
- function isSigilInstance(inst) {
122
- return !!inst && typeof inst === "object" && __SIGIL__ in inst;
123
- }
124
- function getSigilLabels() {
125
- return getLabelRegistry().labels();
126
- }
127
- function getLabelRegistry() {
128
- if ("__labelRegistry__" in globalThis) return globalThis.__labelRegistry__;
129
- const labelSet = /* @__PURE__ */ new Set();
130
- let count = 0;
131
- const labelRegistry = {
132
- has: (label) => labelSet.has(label),
133
- add: (label) => labelSet.add(label),
134
- labels: () => [...labelSet],
135
- enc: () => ++count
136
- };
137
- Object.freeze(labelRegistry);
138
- Object.defineProperty(globalThis, "__labelRegistry__", {
139
- value: labelRegistry,
140
- writable: false,
111
+ Object.defineProperty(ctor.prototype, __DEPTH__, {
112
+ value: ((_b = ctor.prototype[__DEPTH__]) != null ? _b : -1) + 1,
141
113
  configurable: false,
142
- enumerable: false
114
+ enumerable: false,
115
+ writable: false
116
+ });
117
+ Object.defineProperty(ctor.prototype, sym, {
118
+ value: true,
119
+ configurable: false,
120
+ enumerable: false,
121
+ writable: false
143
122
  });
144
- return labelRegistry;
145
- }
146
- function verifyLabel(ctor, label, opts) {
147
- var _a, _b;
148
- const reg = getLabelRegistry();
149
- if (label.startsWith(AUTO_LABEL_PREFEX))
150
- throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);
151
- if (!((_a = opts == null ? void 0 : opts.skipLabelUniquenessCheck) != null ? _a : OPTIONS.skipLabelUniquenessCheck) && reg.has(label))
152
- throw new Error(
153
- `[Sigil Error] Passed label '${label}' to class '${ctor == null ? void 0 : ctor.name}' is re-used, passed labels must be unique`
154
- );
155
- const labelValidation = (_b = opts == null ? void 0 : opts.labelValidation) != null ? _b : OPTIONS.labelValidation;
156
- if (labelValidation) {
157
- let valid;
158
- if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
159
- else valid = labelValidation(label);
160
- if (!valid)
161
- throw new Error(
162
- `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`
163
- );
164
- }
165
- reg.add(label);
166
- }
167
- function generateRandomLabel(ctor) {
168
- return `${AUTO_LABEL_PREFEX}:${ctor == null ? void 0 : ctor.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;
169
123
  }
170
124
 
171
125
  // src/mixin.ts
@@ -175,47 +129,24 @@ function BaseSigilify(Base) {
175
129
  * Class-level identity label constant for this sigil constructor.
176
130
  */
177
131
  static get SigilLabel() {
178
- handleSigilLazy(this);
179
132
  return this.prototype[__LABEL__];
180
133
  }
181
134
  /**
182
- * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.
183
- */
184
- static get SigilEffectiveLabel() {
185
- handleSigilLazy(this);
186
- return this.prototype[__EFFECTIVE_LABEL__];
187
- }
188
- /**
189
- * Linearized sigil type label chain for the current constructor.
135
+ * Copy of the sigil label lineage for this instance's constructor.
190
136
  *
191
- * Useful for debugging and performing strict lineage comparisons.
137
+ * Useful for debugging and logging.
192
138
  *
193
- * @returns An array of labels representing parent → child type labels.
139
+ * @returns An array of sigil labels representing parent → child labels.
194
140
  */
195
141
  static get SigilLabelLineage() {
196
- handleSigilLazy(this);
197
- const lineage = [];
198
- let c = this;
199
- while (c && typeof c === "function" && c.prototype[__SIGIL__]) {
200
- lineage.unshift(c.SigilLabel);
201
- c = Object.getPrototypeOf(c);
202
- }
203
- return lineage;
142
+ return this.prototype[__SIGIL_LINEAGE__].map((v) => v.description);
204
143
  }
205
- /**
206
- * Sigil type label set for the current constructor.
207
- * Useful for debugging.
208
- *
209
- * @deprecated To minize API and bundle size, internally this method is 'new Set(this.SigilLabelLineage)' only. will be removed in v4
210
- * @returns A Readonly Set of labels that represent the type lineage.
211
- */
212
- static get SigilLabelSet() {
213
- return new Set(this.SigilLabelLineage);
144
+ /** Check if sigil label has been attached to this class */
145
+ static get hasOwnSigil() {
146
+ return hasOwnSigil(this);
214
147
  }
215
148
  constructor(...args) {
216
149
  super(...args);
217
- const ctor = new.target;
218
- handleSigilLazy(ctor);
219
150
  }
220
151
  /**
221
152
  * Check whether `other` is (or inherits from) the instance represented by the
@@ -229,8 +160,7 @@ function BaseSigilify(Base) {
229
160
  * @param other - The object to test.
230
161
  * @returns A type guard asserting `other` is an instance of the constructor.
231
162
  */
232
- static isOfType(other) {
233
- handleSigilLazy(this);
163
+ static isInstance(other) {
234
164
  if (other == null || typeof other !== "object") return false;
235
165
  return other[this.prototype[__SIGIL__]] === true;
236
166
  }
@@ -243,8 +173,7 @@ function BaseSigilify(Base) {
243
173
  * @param other - The object to test.
244
174
  * @returns A type guard asserting `other` is an instance of the constructor.
245
175
  */
246
- static isExactType(other) {
247
- handleSigilLazy(this);
176
+ static isExactInstance(other) {
248
177
  if (other == null || typeof other !== "object") return false;
249
178
  if (this.prototype[__DEPTH__] !== other[__DEPTH__]) return false;
250
179
  return other[this.prototype[__SIGIL__]] === true;
@@ -261,7 +190,7 @@ function BaseSigilify(Base) {
261
190
  * @param other - The object to test.
262
191
  * @returns A type guard asserting `other` is an instance of the constructor.
263
192
  */
264
- isOfType(other) {
193
+ isInstance(other) {
265
194
  if (other == null || typeof other !== "object") return false;
266
195
  return other[this[__SIGIL__]] === true;
267
196
  }
@@ -274,7 +203,7 @@ function BaseSigilify(Base) {
274
203
  * @param other - The object to test.
275
204
  * @returns A type guard asserting `other` is an instance of the constructor.
276
205
  */
277
- isExactType(other) {
206
+ isExactInstance(other) {
278
207
  if (other == null || typeof other !== "object") return false;
279
208
  if (this[__DEPTH__] !== other[__DEPTH__]) return false;
280
209
  return other[this[__SIGIL__]] === true;
@@ -284,42 +213,25 @@ function BaseSigilify(Base) {
284
213
  *
285
214
  * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').
286
215
  */
287
- getSigilLabel() {
216
+ get SigilLabel() {
288
217
  return this[__LABEL__];
289
218
  }
290
219
  /**
291
- * Returns the human-readable sigil label of this instance's constructor.
220
+ * Copy of the sigil label lineage for this instance's constructor.
292
221
  *
293
- * @returns The last passed label string (e.g. '@scope/pkg.ClassName').
294
- */
295
- getSigilEffectiveLabel() {
296
- return this[__EFFECTIVE_LABEL__];
297
- }
298
- /**
299
- * Returns a copy of the sigil type label lineage for this instance's constructor.
222
+ * Useful for debugging and logging.
300
223
  *
301
- * @returns readonly array of labels representing the type lineage.
224
+ * @returns An array of sigil labels representing parent child labels.
302
225
  */
303
- getSigilLabelLineage() {
304
- const lineage = [];
305
- let proto = Object.getPrototypeOf(this);
306
- while (proto && proto[__SIGIL__]) {
307
- lineage.unshift(proto[__LABEL__]);
308
- proto = Object.getPrototypeOf(proto);
309
- }
310
- return lineage;
226
+ get SigilLabelLineage() {
227
+ return this[__SIGIL_LINEAGE__].map((v) => v.description);
311
228
  }
312
- /**
313
- * Returns a copy of the sigil type label lineage set for this instance's constructor.
314
- *
315
- * @deprecated To minize API and bundle size, internally this method is 'new Set(this.SigilLabelLineage)' only. will be removed in v4
316
- * @returns readonly array of labels representing the type lineage.
317
- */
318
- getSigilLabelSet() {
319
- return new Set(this.getSigilLabelLineage());
229
+ /** Check if sigil label has been attached to this class */
230
+ get hasOwnSigil() {
231
+ return this.constructor.hasOwnSigil;
320
232
  }
321
233
  }
322
- handleSigilExplicit(Sigil2, "Sigil", { skipLabelUniquenessCheck: true });
234
+ sigilify(Sigil2, "Sigil");
323
235
  return Sigil2;
324
236
  }
325
237
  function Sigilify(Base, label, opts) {
@@ -330,7 +242,7 @@ function Sigilify(Base, label, opts) {
330
242
  const BaseSigil = BaseSigilify(Base);
331
243
  class Sigilified extends BaseSigil {
332
244
  }
333
- handleSigilExplicit(Sigilified, label, opts);
245
+ sigilify(Sigilified, label, opts);
334
246
  return Sigilified;
335
247
  }
336
248
  function SigilifyAbstract(Base, label, opts) {
@@ -341,7 +253,7 @@ function SigilifyAbstract(Base, label, opts) {
341
253
  const BaseSigil = BaseSigilify(Base);
342
254
  class Sigilified extends BaseSigil {
343
255
  }
344
- handleSigilExplicit(Sigilified, label, opts);
256
+ sigilify(Sigilified, label, opts);
345
257
  return Sigilified;
346
258
  }
347
259
 
@@ -352,38 +264,23 @@ var SigilError = Sigilify(Error, "SigilError");
352
264
 
353
265
  // src/attach.ts
354
266
  function AttachSigil(label, opts) {
355
- return function(value, context) {
356
- if (!isSigilCtor(value))
267
+ return function(target, ctx) {
268
+ if (!isSigilCtor(target))
357
269
  throw new Error(
358
- `[Sigil Error] 'AttachSigil' decorator accept only Sigil classes but used on class '${value.name}'`
270
+ `[Sigil Error] 'AttachSigil' decorator accept only Sigil classes but used on class '${target.name}'`
359
271
  );
360
- handleSigilExplicit(value, label, opts);
272
+ sigilify(target, label, opts);
361
273
  };
362
274
  }
363
- var WithSigil = AttachSigil;
364
275
  function attachSigil(Class, label, opts) {
365
276
  if (!isSigilCtor(Class))
366
277
  throw new Error(
367
278
  `[Sigil Error] 'attachSigil' function accept only Sigil classes but used on class '${Class.name}'`
368
279
  );
369
- handleSigilExplicit(Class, label, opts);
280
+ sigilify(Class, label, opts);
370
281
  return Class;
371
282
  }
372
- var withSigil = attachSigil;
373
283
 
374
- exports.AttachSigil = AttachSigil;
375
- exports.DEFAULT_LABEL_REGEX = DEFAULT_LABEL_REGEX;
376
- exports.RECOMMENDED_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;
377
- exports.Sigil = Sigil;
378
- exports.SigilError = SigilError;
379
- exports.Sigilify = Sigilify;
380
- exports.SigilifyAbstract = SigilifyAbstract;
381
- exports.WithSigil = WithSigil;
382
- exports.attachSigil = attachSigil;
383
- exports.getSigilLabels = getSigilLabels;
384
- exports.isSigilCtor = isSigilCtor;
385
- exports.isSigilInstance = isSigilInstance;
386
- exports.updateSigilOptions = updateSigilOptions;
387
- exports.withSigil = withSigil;
284
+ export { AttachSigil, RECOMMENDED_LABEL_REGEX, Sigil, SigilError, Sigilify, SigilifyAbstract, attachSigil, hasOwnSigil, isSigilCtor, isSigilInstance, updateSigilOptions };
388
285
  //# sourceMappingURL=index.js.map
389
286
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/attach.ts"],"names":["a","Sigil"],"mappings":";;;AA6CO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,IAAA;AAAA,EAChB,wBAAA,EAA0B;AAC5B,CAAA;AAYO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;AAC5B,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;AACjC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AACvE,IAAA,OAAA,CAAQ,iBAAiB,IAAA,CAAK,cAAA;AAAA,EAChC;AAEA,EAAA,IAAI,qBAAqB,IAAA,EAAM;AAC7B,IAAA,MAAM,MAAM,IAAA,CAAK,eAAA;AACjB,IAAA,IAAI,QAAQ,IAAA,IAAQ,OAAO,GAAA,KAAQ,UAAA,IAAc,EAAE,GAAA,YAAe,MAAA,CAAA;AAChE,MAAA,MAAM,IAAI,MAAM,uEAAuE,CAAA;AACzF,IAAA,OAAA,CAAQ,eAAA,GAAkB,GAAA;AAAA,EAC5B;AAEA,EAAA,IAAI,8BAA8B,IAAA,EAAM;AACtC,IAAA,IAAI,OAAO,KAAK,wBAAA,KAA6B,SAAA;AAC3C,MAAA,MAAM,IAAI,MAAM,+DAA+D,CAAA;AACjF,IAAA,OAAA,CAAQ,2BAA2B,IAAA,CAAK,wBAAA;AAAA,EAC1C;AACF;AAaO,IAAM,uBAAA,GAA0B;AAGhC,IAAM,mBAAA,GAAsB;;;AC3F5B,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AASrD,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AASrD,IAAM,mBAAA,m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B,IAAA,CAAK,IAAI,CAAA,cAAA,EAAiB,KAAK,UAAU,CAAA,uBAAA;AAAA,KACnE;AAEF,EAAA,MAAM,SAAA,GAAY,aAAa,IAAI,CAAA;AAAA,EACnC,MAAe,mBAAmB,SAAA,CAAU;AAAA;AAI5C,EAAA,mBAAA,CAAoB,UAAA,EAAY,OAAO,IAAI,CAAA;AAC3C,EAAA,OAAO,UAAA;AACT;;;ACjOO,IAAM,KAAA,GAAQ,aAAa,MAAM;AAAC,CAAC;AAUnC,IAAM,UAAA,GAAa,QAAA,CAAS,KAAA,EAAO,YAAY;;;ACT/C,SAAS,WAAA,CAAY,OAAe,IAAA,EAAqB;AAC9D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;AAC9C,IAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,mFAAA,EAAsF,MAAM,IAAI,CAAA,CAAA;AAAA,OAClG;AAEF,IAAA,mBAAA,CAAoB,KAAA,EAAO,OAAO,IAAI,CAAA;AAAA,EACxC,CAAA;AACF;AAKO,IAAM,SAAA,GAAY;AAYlB,SAAS,WAAA,CAAgC,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;AAC/F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,kFAAA,EAAqF,MAAM,IAAI,CAAA,CAAA;AAAA,KACjG;AAEF,EAAA,mBAAA,CAAoB,KAAA,EAAO,OAAO,IAAI,CAAA;AACtC,EAAA,OAAO,KAAA;AACT;AAKO,IAAM,SAAA,GAAY","file":"index.js","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n\n /**\n * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label\n * will be assigned an autogenerated random label (so that explicit labels stay unique).\n */\n autofillLabels?: boolean;\n\n /**\n * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw\n * duplicate label error, setting this to 'true' will disabel this error.\n * However as it disables unique label check bugs can appear if the same label is passed to two different\n * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.\n */\n skipLabelUniquenessCheck?: boolean;\n}\n\n/** -----------------------------------------\n * Internal options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n autofillLabels: true,\n skipLabelUniquenessCheck: false,\n};\n\n/** -----------------------------------------\n * Update options\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val;\n }\n\n if ('skipLabelUniquenessCheck' in opts) {\n if (typeof opts.skipLabelUniquenessCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelUniquenessCheck' must be boolean\");\n OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;\n }\n};\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the depth inside Sigil chain. used in exact checks\n *\n * @constant {symbol}\n */\nexport const __DEPTH__ = Symbol.for('@vicin/sigil.__DEPTH__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __DEPTH__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** -----------------------------------------\n * Constants\n * ----------------------------------------- */\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Weak maps\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. register both explicit and lazy handles */\nconst handledCtors = new WeakSet<Function>();\n\n/** Weak set to ensure that every ctor is handled only once. register explicit handles only */\nconst handledCtorsExplicit = new WeakSet<Function>();\n\n/** -----------------------------------------\n * Main helpers\n * ----------------------------------------- */\n\n/** Main function to handle 'Sigil' and attach its metadata to the class when label is passed */\nexport function handleSigilExplicit(ctor: Function, label: string, opts?: SigilOptions): void {\n // fast return if already defined\n if (handledCtorsExplicit.has(ctor))\n throw new Error(\n `[Sigil Error] Class '${ctor.name}' with label '${(ctor as any).SigilLabel}' is already sigilified`\n );\n // verify label\n verifyLabel(ctor, label, opts);\n // lazy evaluate ancestors\n handleAncestors(ctor, opts);\n // sigilify ctor\n sigilify(ctor, label, true);\n}\n\n/** Function to lazily evaluate 'Sigil' ( update with auto-generated metadata or throw ) */\nexport function handleSigilLazy(ctor: Function): void {\n // fast return if already handled\n if (handledCtors.has(ctor)) return;\n // if autofillLabels is set to false throw error\n if (!OPTIONS.autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n // lazy evaluate ancestors\n handleAncestors(ctor);\n // sigilify ctor\n sigilify(ctor, generateRandomLabel(ctor), false);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a), false);\n }\n // register current label with class name\n labelOwner.set(a.prototype[__LABEL__], a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string, explicit: boolean) {\n // -------------------------\n // Get symbol from label\n // -------------------------\n\n const sym = Symbol.for(label);\n\n // -------------------------\n // Populate 'Sigil' symbols\n // -------------------------\n\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: !explicit,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: !explicit,\n enumerable: false,\n writable: false,\n });\n if (explicit)\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!handledCtors.has(ctor))\n Object.defineProperty(ctor.prototype, __DEPTH__, {\n value: (ctor.prototype[__DEPTH__] ?? -1) + 1,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // -------------------------\n // Add { symbol: ture } pair\n // -------------------------\n\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // -------------------------\n // Mark as handled\n // -------------------------\n\n // mark as handled (explicit or lazy)\n handledCtors.add(ctor);\n // if explicit mark as handled explicit\n if (explicit) handledCtorsExplicit.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && ctor.prototype && __SIGIL__ in ctor.prototype;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(): string[] {\n return getLabelRegistry().labels();\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label: L, opts?: SigilOptions): void {\n // get label registry\n const reg = getLabelRegistry();\n\n // If label starts with '@Sigil-auto:' throw error\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n // If label is duplicate throw error\n if (!(opts?.skipLabelUniquenessCheck ?? OPTIONS.skipLabelUniquenessCheck) && reg.has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\n\n // If validation regex or function is defined validate\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n\n // Add label to registry\n reg.add(label);\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigilExplicit, handleSigilLazy, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __SIGIL__, __LABEL__, __EFFECTIVE_LABEL__, __DEPTH__ } from './symbols';\nimport type { Constructor, ConstructorAbstract, GetPrototype, sigil, ExtendSigil } from './types';\n\n/**\n * Helper function to extend Base class with Sigil Class that should be present at the start of each Sigil chain\n * @param Base - The base constructor to extend.\n * @returns Base Sigil class at the start of each Sigil chain\n */\nexport function BaseSigilify(Base: ConstructorAbstract) {\n class Sigil extends Base {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n handleSigilLazy(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): string {\n handleSigilLazy(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * Linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n handleSigilLazy(this);\n const lineage = [];\n let c = this;\n while (c && typeof c === 'function' && (c.prototype as any)[__SIGIL__]) {\n lineage.unshift(c.SigilLabel);\n c = Object.getPrototypeOf(c);\n }\n return lineage;\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @deprecated To minize API and bundle size, internally this method is 'new Set(this.SigilLabelLineage)' only. will be removed in v4\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n return new Set(this.SigilLabelLineage);\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: {\n Sigil: true;\n };\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigilLazy(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigilLazy(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigilLazy(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype[__DEPTH__] !== (other as any)[__DEPTH__]) return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__DEPTH__] !== (other as any)[__DEPTH__]) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const lineage: string[] = [];\n let proto = Object.getPrototypeOf(this);\n while (proto && proto[__SIGIL__]) {\n lineage.unshift(proto[__LABEL__]);\n proto = Object.getPrototypeOf(proto);\n }\n return lineage;\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @deprecated To minize API and bundle size, internally this method is 'new Set(this.SigilLabelLineage)' only. will be removed in v4\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return new Set(this.getSigilLabelLineage());\n }\n }\n\n handleSigilExplicit(Sigil, 'Sigil', { skipLabelUniquenessCheck: true });\n return Sigil;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<L extends string>(Base: Constructor, label: L, opts?: SigilOptions) {\n if (isSigilCtor(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n const BaseSigil = BaseSigilify(Base);\n class Sigilified extends BaseSigil {\n declare [sigil]: ExtendSigil<L, InstanceType<typeof BaseSigil>>;\n }\n\n handleSigilExplicit(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function SigilifyAbstract<L extends string>(\n Base: ConstructorAbstract,\n label: L,\n opts?: SigilOptions\n) {\n if (isSigilCtor(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n const BaseSigil = BaseSigilify(Base);\n abstract class Sigilified extends BaseSigil {\n declare [sigil]: ExtendSigil<L, InstanceType<typeof BaseSigil>>;\n }\n\n handleSigilExplicit(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify, BaseSigilify } from './mixin';\nimport type { sigil } from './types';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = BaseSigilify(class {});\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import { handleSigilExplicit, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function AttachSigil(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'AttachSigil' decorator accept only Sigil classes but used on class '${value.name}'`\n );\n\n handleSigilExplicit(value, label, opts);\n };\n}\n\n/**\n * @deprecated Use 'AttachSigil' instead, updated for clarity. will be removed in v4\n */\nexport const WithSigil = AttachSigil;\n\n/**\n * Function that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@AttachSigil' if you prefer normal functions.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function attachSigil<S extends Function>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'attachSigil' function accept only Sigil classes but used on class '${Class.name}'`\n );\n\n handleSigilExplicit(Class, label, opts);\n return Class;\n}\n\n/**\n * @deprecated Use 'attachSigil' instead, updated for clarity. will be removed in v4\n */\nexport const withSigil = attachSigil;\n"]}
1
+ {"version":3,"sources":["../src/symbols.ts","../src/is.ts","../src/options.ts","../src/registry.ts","../src/sigilify.ts","../src/mixin.ts","../src/classes.ts","../src/attach.ts"],"names":["hasOwnSigil","Sigil"],"mappings":";AAKO,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAOrD,IAAM,iBAAA,mBAAoB,MAAA,CAAO,GAAA,CAAI,gCAAgC,CAAA;AASrE,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAOrD,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAOrD,IAAM,kBAAA,mBAAqB,MAAA,CAAO,GAAA,CAAI,iCAAiC,CAAA;;;AC1BvE,SAAS,YAAY,IAAA,EAAqC;AAC/D,EAAA,OAAO,OAAO,IAAA,KAAS,UAAA,IAAc,IAAA,CAAK,SAAA,IAAa,aAAa,IAAA,CAAK,SAAA;AAC3E;AASO,SAAS,gBA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F,OAAO,IAAI,CAAA,CAAA;AAAA,OACnG;AAEF,IAAA,QAAA,CAAS,MAAA,EAAQ,OAAO,IAAI,CAAA;AAAA,EAC9B,CAAA;AACF;AAYO,SAAS,WAAA,CAAgC,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;AAC/F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,kFAAA,EAAqF,MAAM,IAAI,CAAA,CAAA;AAAA,KACjG;AAEF,EAAA,QAAA,CAAS,KAAA,EAAO,OAAO,IAAI,CAAA;AAC3B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/**\n * Symbol to uniquely identify sigil classes.\n *\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol to store sigil lineage of a class\n *\n * @constant {symbol}\n */\nexport const __SIGIL_LINEAGE__ = Symbol.for('@vicin/sigil.__SIGIL_LINEAGE__');\n\n/**\n * Symbol used to store the identity label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the depth inside Sigil chain. used in exact checks\n *\n * @constant {symbol}\n */\nexport const __DEPTH__ = Symbol.for('@vicin/sigil.__DEPTH__');\n\n/**\n * Symbol of global Sigil registry\n *\n * @constant {symbol}\n */\nexport const __SIGIL_REGISTRY__ = Symbol.for('@vicin/sigil.__SIGIL_REGISTRY__');\n","import type { Sigil } from './classes';\nimport { __SIGIL__ } from './symbols';\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is typeof Sigil {\n return typeof ctor === 'function' && ctor.prototype && __SIGIL__ in ctor.prototype;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is Sigil {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n","/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n}\n\n/** -----------------------------------------\n * Internal options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n};\n\n/** -----------------------------------------\n * Update options\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateSigilOptions = ({ labelValidation = null }: SigilOptions = {}): void => {\n OPTIONS.labelValidation = labelValidation;\n};\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n","import { __SIGIL_REGISTRY__ } from './symbols';\n\ninterface SigilRegistry {\n registerResolved: (ctor: Function) => void;\n checkResolved: (ctor: Function) => boolean;\n registerHasOwn: (ctor: Function) => void;\n checkHasOwn: (ctor: Function) => boolean;\n}\n\nexport function getSigilRegistry(): SigilRegistry {\n if ((globalThis as any)[__SIGIL_REGISTRY__]) return (globalThis as any)[__SIGIL_REGISTRY__];\n\n /** Weak set to ensure that every ctor is handled only once */\n const resolved = new WeakSet<Function>();\n\n /** Weak set to store ctors that called sigilify function */\n const hasOwnSigil = new WeakSet<Function>();\n\n /** Registry */\n const registry: SigilRegistry = {\n registerResolved(ctor) {\n resolved.add(ctor);\n },\n checkResolved(ctor) {\n return resolved.has(ctor);\n },\n registerHasOwn(ctor) {\n hasOwnSigil.add(ctor);\n },\n checkHasOwn(ctor) {\n return hasOwnSigil.has(ctor);\n },\n };\n\n // Freeze registy to prevent any mutations\n Object.freeze(registry);\n // Append registry into globalThis and make it non-writable\n Object.defineProperty(globalThis, __SIGIL_REGISTRY__, {\n value: registry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n // return registry\n return registry;\n}\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __SIGIL__, __SIGIL_LINEAGE__, __DEPTH__ } from './symbols';\nimport { getSigilRegistry } from './registry';\n\n/** -----------------------------------------\n * Get registry\n * ----------------------------------------- */\n\nconst sigilRegistry = getSigilRegistry();\n\n/** -----------------------------------------\n * Main helpers\n * ----------------------------------------- */\n\n/** Main function to handle 'Sigil' and attach its metadata to the class when label is passed */\nexport function sigilify(ctor: Function, label: string, opts?: SigilOptions): void {\n // throw if already seen\n if (sigilRegistry.checkResolved(ctor))\n throw new Error(\n `[Sigil Error] Class '${ctor.name}' with label '${(ctor as any).SigilLabel}' is already sigilified`\n );\n // verify label\n verifyLabel(label, opts);\n // handle ancestors (add them to seen)\n handleAncestors(ctor);\n // sigilify ctor\n updateSigil(ctor, label);\n // mark as seen and register in hasOwnSigil set\n sigilRegistry.registerResolved(ctor);\n sigilRegistry.registerHasOwn(ctor);\n}\n\nexport function hasOwnSigil(ctor: Function) {\n return sigilRegistry.checkHasOwn(ctor);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/** Helper function to validate passed label */\nexport function verifyLabel<L extends string>(label: L, opts?: SigilOptions): void {\n // If validation regex or function is defined validate\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\nfunction handleAncestors(ctor: Function) {\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n sigilRegistry.registerResolved(a);\n a = Object.getPrototypeOf(a);\n }\n}\n\nfunction updateSigil(ctor: Function, label: string) {\n // -------------------------\n // Get symbol from label\n // -------------------------\n\n const sym = Symbol.for(label);\n\n // -------------------------\n // Populate 'Sigil' symbols\n // -------------------------\n\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __SIGIL_LINEAGE__, {\n value: [...(Object.getPrototypeOf(ctor).prototype[__SIGIL_LINEAGE__] ?? []), sym],\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __DEPTH__, {\n value: (ctor.prototype[__DEPTH__] ?? -1) + 1,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // -------------------------\n // Add { symbol: ture } pair\n // -------------------------\n\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n","import { isSigilCtor } from './is';\nimport { sigilify, hasOwnSigil } from './sigilify';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __SIGIL__, __SIGIL_LINEAGE__, __DEPTH__ } from './symbols';\nimport type { Constructor, ConstructorAbstract, GetPrototype, sigil, ExtendSigil } from './types';\n\n/**\n * Helper function to extend Base class with Sigil Class that should be present at the start of each Sigil chain\n * @param Base - The base constructor to extend.\n * @returns Base Sigil class at the start of each Sigil chain\n */\nexport function BaseSigilify(Base: ConstructorAbstract) {\n class Sigil extends Base {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Copy of the sigil label lineage for this instance's constructor.\n *\n * Useful for debugging and logging.\n *\n * @returns An array of sigil labels representing parent → child labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return (this as any).prototype[__SIGIL_LINEAGE__].map((v: symbol) => v.description);\n }\n\n /** Check if sigil label has been attached to this class */\n static get hasOwnSigil(): boolean {\n return hasOwnSigil(this);\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: {\n Sigil: true;\n };\n\n constructor(...args: any[]) {\n super(...args);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isInstance<T>(this: T, other: any): other is GetPrototype<T> {\n if (other == null || typeof other !== 'object') return false;\n return other[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactInstance<T>(this: T, other: any): other is GetPrototype<T> {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype[__DEPTH__] !== other[__DEPTH__]) return false;\n return other[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isInstance<T>(this: T, other: any): other is T {\n if (other == null || typeof other !== 'object') return false;\n return other[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactInstance<T>(this: T, other: any): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__DEPTH__] !== (other as any)[__DEPTH__]) return false;\n return other[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Copy of the sigil label lineage for this instance's constructor.\n *\n * Useful for debugging and logging.\n *\n * @returns An array of sigil labels representing parent → child labels.\n */\n get SigilLabelLineage(): readonly string[] {\n return (this as any)[__SIGIL_LINEAGE__].map((v: symbol) => v.description);\n }\n\n /** Check if sigil label has been attached to this class */\n get hasOwnSigil(): boolean {\n return (this.constructor as unknown as Sigil).hasOwnSigil;\n }\n }\n\n sigilify(Sigil, 'Sigil');\n return Sigil;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<L extends string>(Base: Constructor, label: L, opts?: SigilOptions) {\n if (isSigilCtor(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n const BaseSigil = BaseSigilify(Base);\n class Sigilified extends BaseSigil {\n declare [sigil]: ExtendSigil<L, InstanceType<typeof BaseSigil>>;\n }\n\n sigilify(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function SigilifyAbstract<L extends string>(\n Base: ConstructorAbstract,\n label: L,\n opts?: SigilOptions\n) {\n if (isSigilCtor(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n const BaseSigil = BaseSigilify(Base);\n abstract class Sigilified extends BaseSigil {\n declare [sigil]: ExtendSigil<L, InstanceType<typeof BaseSigil>>;\n }\n\n sigilify(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify, BaseSigilify } from './mixin';\nimport type { sigil } from './types';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = BaseSigilify(class {});\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isInstance(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import { isSigilCtor } from './is';\nimport { sigilify } from './sigilify';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function AttachSigil(label: string, opts?: SigilOptions) {\n return function (target: Function, ctx: any) {\n if (!isSigilCtor(target))\n throw new Error(\n `[Sigil Error] 'AttachSigil' decorator accept only Sigil classes but used on class '${target.name}'`\n );\n\n sigilify(target, label, opts);\n };\n}\n\n/**\n * Function that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@AttachSigil' if you prefer normal functions.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function attachSigil<S extends Function>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'attachSigil' function accept only Sigil classes but used on class '${Class.name}'`\n );\n\n sigilify(Class, label, opts);\n return Class;\n}\n"]}