@vicin/sigil 1.2.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,298 +1,3 @@
1
- /**
2
- * Small wrapper around a shared registry Set that provides safe operations
3
- * and hot-reload-friendly behavior.
4
- *
5
- * Responsibilities:
6
- * - Query the current registry (may be `null` to indicate disabled checks).
7
- * - Register / unregister labels in a controlled manner.
8
- * - Query class constructors using their 'SigilLabel'.
9
- * - Support hot-reload tolerant registration (avoid throwing in DEV).
10
- */
11
- declare class SigilRegistry {
12
- /** Internal private registry map. */
13
- private _registry;
14
- /**
15
- * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.
16
- */
17
- constructor(map?: Map<string, ISigil | null>);
18
- /**
19
- * Return a readonly view (array) of the current registry entries.
20
- *
21
- * @returns An array containing all registered labels, or an empty array when registry is disabled.
22
- */
23
- listLabels(): string[];
24
- /**
25
- * Determine whether the registry currently contains `label`.
26
- *
27
- * @param label - The label to test.
28
- * @returns `true` if present; `false` otherwise.
29
- */
30
- has(label: string): boolean;
31
- /**
32
- * Get class constructor using its label.
33
- *
34
- * @param label - Label appended to Sigil class.
35
- * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.
36
- */
37
- get(label: string): ISigil | null;
38
- /**
39
- * Register a label and class constructor in the active registry.
40
- *
41
- * If the label already exists then:
42
- * - In DEV builds: prints a console warning (HMR friendly) and returns early.
43
- * - In non-DEV builds: throws an Error to prevent duplicate registration.
44
- *
45
- * @param label - Label string to register (e.g. '@scope/pkg.ClassName').
46
- * @param Class - Constructor of the class being registered.
47
- * @param opts - Optional per-call overrides.
48
- */
49
- register(label: string, Class: ISigil | null, opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>): void;
50
- /**
51
- * Alias for 'SigilRegistry.register'.
52
- *
53
- * @param label - Label string to register (e.g. '@scope/pkg.ClassName').
54
- * @param Class - Constructor of the class being registered.
55
- * @param opts - Optional per-call overrides.
56
- */
57
- set(label: string, Class: ISigil | null, opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>): void;
58
- /**
59
- * Unregister a previously registered class.
60
- *
61
- * @param label - The label to remove from the registry.
62
- * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).
63
- */
64
- unregister(label: string): boolean;
65
- /**
66
- * Alias for 'SigilRegistry.unregister'.
67
- *
68
- * @param label - The label to remove from the registry.
69
- * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).
70
- */
71
- delete(label: string): boolean;
72
- /**
73
- * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.
74
- *
75
- * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.
76
- * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.
77
- */
78
- replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void;
79
- /**
80
- * Clear the registry completely.
81
- *
82
- * Useful for test teardown, or when explicitly resetting state during development.
83
- * No-op when the registry is disabled.
84
- */
85
- clear(): void;
86
- /**
87
- * Merge another SigilRegistry into this one.
88
- *
89
- * Entries from `other` will be registered into this registry. Duplicate labels
90
- * are handled via this registry's `register` logic (i.e., will warn in DEV or
91
- * throw in production).
92
- *
93
- * @param other - Another `SigilRegistry` whose entries will be merged into this registry.
94
- */
95
- merge(other: SigilRegistry): void;
96
- /**
97
- * Return a Map-style iterator over entries: `[label, constructor]`.
98
- * Equivalent to calling `registry[Symbol.iterator]()`.
99
- *
100
- * @returns IterableIterator of `[label, ISigil]`.
101
- */
102
- entries(): IterableIterator<[string, ISigil | null]>;
103
- /**
104
- * Return an iterator over registered constructors.
105
- *
106
- * @returns IterableIterator of `ISigil` constructors.
107
- */
108
- values(): IterableIterator<ISigil | null>;
109
- /**
110
- * Return an iterator over registered labels (keys).
111
- *
112
- * @returns IterableIterator of `string` labels.
113
- */
114
- keys(): IterableIterator<string>;
115
- /**
116
- * Execute a provided function once per registry entry.
117
- *
118
- * @param callback - Function invoked with `(ctor, label)` for each entry.
119
- * @param thisArg - Optional `this` context for the callback.
120
- */
121
- forEach(callback: (ctor: ISigil | null, label: string) => void, thisArg?: any): void;
122
- /**
123
- * Get the size (number of entries) of the active registry.
124
- *
125
- * @returns The number of registered labels, or 0 when registry is disabled.
126
- */
127
- get size(): number;
128
- /**
129
- * Return an iterator over `[label, constructor]` pairs.
130
- *
131
- * This makes the registry compatible with `for..of` and other iterable helpers:
132
- * ```ts
133
- * for (const [label, ctor] of registry) { ... }
134
- * ```
135
- *
136
- * @returns An iterable iterator that yields `[label, ISigil]` tuples.
137
- */
138
- [Symbol.iterator](): IterableIterator<[string, ISigil | null]>;
139
- }
140
- /**
141
- * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).
142
- *
143
- * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore
144
- * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable
145
- * registry instance for mutation should call this function each time rather than
146
- * holding a long-lived reference to the previously returned object.
147
- *
148
- * It gets global registry if defined, otherwise returns registry stored in SigilOptions.
149
- *
150
- * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.
151
- */
152
- declare const getActiveRegistry: () => SigilRegistry | null;
153
- /** -----------------------------------------
154
- * Deprecated registry
155
- * ----------------------------------------- */
156
- /**
157
- * Old 'REGISTRY' alias to interact with registy.
158
- *
159
- * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.
160
- * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.
161
- */
162
- declare let REGISTRY: SigilRegistry;
163
- /** -----------------------------------------
164
- * Label validation
165
- * ----------------------------------------- */
166
- /**
167
- * Label validation regex. Labels must follow the pattern
168
- * `@scope/package.ClassName` where `ClassName` begins with an uppercase
169
- * letter. This avoids collisions across packages and helps debugging.
170
- *
171
- * It's advised to use this regex in 'SigilOptions.labelValidation'.
172
- */
173
- declare const DEFAULT_LABEL_REGEX: RegExp;
174
- /** -----------------------------------------
175
- * Deprecated registry
176
- * ----------------------------------------- */
177
- /**
178
- * Update runtime options for the Sigil library.
179
- * Call this early during application startup if you want non-default behavior.
180
- *
181
- * Example:
182
- * ```ts
183
- * updateOptions({ autofillLabels: true, labelValidation: /^@[\w-]+\/[\w-]+\.[A-Za-z0-9]+$/ });
184
- * ```
185
- *
186
- * @param opts - Partial options to merge into the global `OPTIONS` object.
187
- * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.
188
- */
189
- declare const updateOptions: (opts: SigilOptions, mergeRegistries?: boolean) => void;
190
-
191
- /** -----------------------------------------
192
- * Options
193
- * ----------------------------------------- */
194
- /**
195
- * Configuration options for the Sigil library.
196
- *
197
- * These options control runtime validation, inheritance checks, label autofill behavior,
198
- * and whether duplicate labels are permitted globally.
199
- *
200
- * Note: these options are read by runtime code during class decoration and inheritance
201
- * checks. Some behaviors (like `skipLabelInheritanceCheck`) are meant primarily for
202
- * development/test scenarios and may weaken type/identity guarantees when changed.
203
- */
204
- interface SigilOptions {
205
- /**
206
- * Validation rule applied to sigil labels before registration.
207
- *
208
- * - A function receives the label and must return `true` if valid.
209
- * - A `RegExp` must match the label.
210
- * - `null` disables validation entirely.
211
- *
212
- * Defaults to `null`.
213
- */
214
- labelValidation?: ((label: string) => boolean) | RegExp | null;
215
- /**
216
- * Skips the runtime check that prevents subclasses from inheriting
217
- * the same sigil label as their ancestors.
218
- *
219
- * When `false` (default), extending a sigil class without
220
- * using `WithSigil(newLabel)` decorator will throw an error if the label
221
- * is reused and `OPTIONS.autofillLabels` is set to `false`.
222
- *
223
- * Set this to `true` only if you intentionally want subclasses to inherit labels
224
- * from their ancestors (this weakens the uniqueness guarantees).
225
- *
226
- * WARNING:
227
- * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for
228
- * each class and allow multiple child classes to use the same label which can
229
- * result on false 'isOfType' result. this options should be used in debugging
230
- * only to silence all errors but never in production.
231
- */
232
- skipLabelInheritanceCheck?: boolean;
233
- /**
234
- * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label
235
- * will be assigned an autogenerated random label (so that explicit labels stay unique).
236
- */
237
- autofillLabels?: boolean;
238
- /**
239
- * Marker used internally to control dev only checks to optimize performace while preserving
240
- * consistency for things like inheritance checks.
241
- * defaults to 'process.env.NODE_ENV !== "production'.
242
- */
243
- devMarker?: boolean;
244
- /**
245
- * Registry instance used to store and resolve sigil labels at runtime.
246
- *
247
- * - When `useGlobalRegistry` is `true` (default), this registry will be
248
- * registered as the active global registry via `updateGlobalRegistry(...)`.
249
- * - When `useGlobalRegistry` is `false`, this registry is kept local and will
250
- * not participate in global identity checks.
251
- *
252
- * IMPORTANT:
253
- * Replacing the registry via `updateOptions({ registry })` changes the active
254
- * registry used by Sigil, but consumers should always retrieve the registry
255
- * through `getRegistry()` rather than holding a long-lived reference.
256
- *
257
- * Defaults to a new `SigilRegistry` instance.
258
- *
259
- * WARNING:
260
- * Setting registry to null disables:
261
- * - Label re-use checks entirly.
262
- * - Feature relying on get(label) → class (e.g., deserialization)
263
- */
264
- registry?: SigilRegistry | null;
265
- /**
266
- * Controls whether the configured `registry` is stored in 'globalThis'.
267
- *
268
- * When `true` (default):
269
- * - The registry is registered globally
270
- * - All sigilized classes participate in the same identity space
271
- *
272
- * When `false`:
273
- * - No global registry is used
274
- * - Identity checks are limited to explicitly provided registry
275
- *
276
- * WARNING:
277
- * Disabling the global registry may lead to duplicate labels across
278
- * isolated registries and should only be done in advanced or test scenarios.
279
- */
280
- useGlobalRegistry?: boolean;
281
- /**
282
- * Controls whether the configured 'registry' should store class constructors.
283
- * This is useful if you want to use 'Sigil' while keeping the constructor private.
284
- *
285
- * Note that any feature relying on get(label) → class (e.g., deserialization) will
286
- * not work if set to 'true' as class is replaced with 'null'.
287
- *
288
- * When 'true' (default):
289
- * - Class passed will be stored in the registry map under its label.
290
- *
291
- * When 'false':
292
- * - Registry map stored only label key and class constructor is replaced with null ([label, null])
293
- */
294
- storeConstructor?: boolean;
295
- }
296
1
  /** -----------------------------------------
297
2
  * Class and instance
298
3
  * ----------------------------------------- */
@@ -319,18 +24,16 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
319
24
  } & SigilBrandOf<P>>;
320
25
  /** Class-level label constant (human readable). */
321
26
  readonly SigilLabel: string;
322
- /** Class-level unique symbol used as the runtime type identifier. */
323
- readonly SigilType: symbol;
324
27
  /**
325
- * Copy of the linearized sigil type symbol chain for the current constructor.
28
+ * Copy of the linearized sigil type label chain for the current constructor.
326
29
  * Useful for debugging and strict lineage comparisons.
327
30
  */
328
- readonly SigilTypeLineage: readonly symbol[];
31
+ readonly SigilLabelLineage: readonly string[];
329
32
  /**
330
- * Copy of the sigil type symbol set for the current constructor. Useful for
33
+ * Copy of the sigil type label set for the current constructor. Useful for
331
34
  * O(1) membership checks and debugging.
332
35
  */
333
- readonly SigilTypeSet: Readonly<Set<symbol>>;
36
+ readonly SigilLabelSet: Readonly<Set<string>>;
334
37
  /**
335
38
  * Runtime check that determines whether `obj` is an instance produced by a
336
39
  * sigil class.
@@ -344,7 +47,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
344
47
  isSigilified(obj: unknown): obj is ISigil;
345
48
  /**
346
49
  * Check whether `other` is (or inherits from) the type represented by the
347
- * calling constructor. Uses the other instance's `SigilTypeSet` to check
50
+ * calling constructor. Uses the other instance's `SigilLabelSet` to check
348
51
  * membership. Works in O(1) and is reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
349
52
  *
350
53
  * This replaces `instanceof` so that checks remain valid across bundles/realms
@@ -358,7 +61,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
358
61
  isOfType<T extends ISigil>(this: T, other: unknown): other is InstanceType<T>;
359
62
  /**
360
63
  * Strict lineage comparison: verifies that the calling constructor's type
361
- * lineage (by symbol) matches the `other`'s lineage element-by-element.
64
+ * lineage (by label) matches the `other`'s lineage element-by-element.
362
65
  *
363
66
  * Works in O(n) where `n` is the lineage length and is useful when order
364
67
  * and exact ancestry must be confirmed. reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
@@ -390,12 +93,12 @@ interface ISigilInstance<L extends string = string, P extends Function = never>
390
93
  } & SigilBrandOf<P>>;
391
94
  /** Returns human-readable sigil label of the class constructor. */
392
95
  getSigilLabel(): string;
393
- /** Returns runtime sigil type symbol of the class constructor. */
394
- getSigilType(): symbol;
395
- /** Returns copy of sigil type symbol lineage of the class constructor. */
396
- getSigilTypeLineage(): readonly symbol[];
397
- /** Returns copy of sigil type symbol set of the class constructor. */
398
- getSigilTypeSet(): Readonly<Set<symbol>>;
96
+ /** Returns runtime sigil type label of the class constructor. */
97
+ getSigilType(): string;
98
+ /** Returns copy of sigil type label lineage of the class constructor. */
99
+ getSigilLabelLineage(): readonly string[];
100
+ /** Returns copy of sigil type label set of the class constructor. */
101
+ getSigilLabelSet(): Readonly<Set<string>>;
399
102
  }
400
103
  /**
401
104
  * Combined constructor + static interface for a sigil class.
@@ -417,12 +120,13 @@ type ISigil<L extends string = string, P extends Function = never> = Constructor
417
120
  type TypedSigil<S extends Function, L extends string = string> = S & AppendLabel<L> & ConstructorAbstract<AppendLabel<L>>;
418
121
  /**
419
122
  * Generic helper extract instance of the class even in protected and private constructors.
123
+ * @remark Return same type is passed type has no 'prototype'
420
124
  */
421
125
  type GetInstance<T> = T extends {
422
126
  prototype: infer R;
423
127
  } ? PrettifyBrand<R & {
424
128
  __SIGIL_BRAND__: SigilBrandOf<T>;
425
- }> : never;
129
+ }> : T;
426
130
  /** Helper to append label into a class. */
427
131
  type AppendLabel<L extends string> = {
428
132
  readonly __SIGIL_BRAND__: Prettify<{
@@ -496,18 +200,18 @@ declare const Sigil: {
496
200
  readonly __SIGIL_BRAND__: {
497
201
  Sigil: true;
498
202
  };
203
+ isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
204
+ isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
499
205
  getSigilLabel(): string;
500
- getSigilType(): symbol;
501
- getSigilTypeLineage(): readonly symbol[];
502
- getSigilTypeSet(): Readonly<Set<symbol>>;
206
+ getSigilLabelLineage(): readonly string[];
207
+ getSigilLabelSet(): Readonly<Set<string>>;
503
208
  };
504
209
  readonly __SIGIL_BRAND__: {
505
210
  Sigil: true;
506
211
  };
507
212
  get SigilLabel(): string;
508
- get SigilType(): symbol;
509
- get SigilTypeLineage(): readonly symbol[];
510
- get SigilTypeSet(): Readonly<Set<symbol>>;
213
+ get SigilLabelLineage(): readonly string[];
214
+ get SigilLabelSet(): Readonly<Set<string>>;
511
215
  isSigilified(obj: unknown): obj is ISigil;
512
216
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
513
217
  isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
@@ -528,25 +232,90 @@ declare const SigilError: {
528
232
  Sigil: true;
529
233
  SigilError: true;
530
234
  };
235
+ isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
236
+ isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
531
237
  getSigilLabel(): string;
532
- getSigilType(): symbol;
533
- getSigilTypeLineage(): readonly symbol[];
534
- getSigilTypeSet(): Readonly<Set<symbol>>;
238
+ getSigilLabelLineage(): readonly string[];
239
+ getSigilLabelSet(): Readonly<Set<string>>;
535
240
  };
536
241
  readonly __SIGIL_BRAND__: {
537
242
  Sigil: true;
538
243
  SigilError: true;
539
244
  };
540
245
  get SigilLabel(): string;
541
- get SigilType(): symbol;
542
- get SigilTypeLineage(): readonly symbol[];
543
- get SigilTypeSet(): Readonly<Set<symbol>>;
246
+ get SigilLabelLineage(): readonly string[];
247
+ get SigilLabelSet(): Readonly<Set<string>>;
544
248
  isSigilified(obj: unknown): obj is ISigil;
545
249
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
546
250
  isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
547
251
  } & ErrorConstructor;
548
252
  type SigilError = InstanceType<typeof SigilError>;
549
253
 
254
+ /**
255
+ * Configuration options for the Sigil library.
256
+ *
257
+ * These options control runtime validation, inheritance checks, label autofill behavior.
258
+ */
259
+ interface SigilOptions {
260
+ /**
261
+ * Validation rule applied to sigil labels before registration.
262
+ *
263
+ * - A function receives the label and must return `true` if valid.
264
+ * - A `RegExp` must match the label.
265
+ * - `null` disables validation entirely.
266
+ *
267
+ * Defaults to `null`.
268
+ */
269
+ labelValidation?: ((label: string) => boolean) | RegExp | null;
270
+ /**
271
+ * Skips the runtime check that prevents subclasses from inheriting
272
+ * the same sigil label as their ancestors.
273
+ *
274
+ * When `false` (default), extending a sigil class without
275
+ * using `WithSigil(newLabel)` decorator will throw an error if the label
276
+ * is reused and `OPTIONS.autofillLabels` is set to `false`.
277
+ *
278
+ * Set this to `true` only if you intentionally want subclasses to inherit labels
279
+ * from their ancestors (this weakens the uniqueness guarantees).
280
+ *
281
+ * WARNING:
282
+ * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for
283
+ * each class and allow multiple child classes to use the same label which can
284
+ * result on false 'isOfType' result. this options should be used in debugging
285
+ * only to silence all errors but never in production.
286
+ */
287
+ skipLabelInheritanceCheck?: boolean;
288
+ /**
289
+ * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label
290
+ * will be assigned an autogenerated random label (so that explicit labels stay unique).
291
+ */
292
+ autofillLabels?: boolean;
293
+ /**
294
+ * Marker used internally to control dev only checks to optimize performace while preserving
295
+ * consistency for things like inheritance checks.
296
+ * defaults to 'process.env.NODE_ENV !== "production'.
297
+ */
298
+ devMarker?: boolean;
299
+ }
300
+ /**
301
+ * Update runtime options for the Sigil library.
302
+ * Call this early during application startup if you want non-default behavior.
303
+ *
304
+ * @param opts - Partial options to merge into the global `OPTIONS` object.
305
+ */
306
+ declare const updateOptions: (opts: SigilOptions) => void;
307
+ /** -----------------------------------------
308
+ * Label validation
309
+ * ----------------------------------------- */
310
+ /**
311
+ * Label validation regex. Labels must follow the pattern
312
+ * `@scope/package.ClassName` where `ClassName` begins with an uppercase
313
+ * letter. This avoids collisions across packages and helps debugging.
314
+ *
315
+ * It's advised to use this regex in 'SigilOptions.labelValidation'.
316
+ */
317
+ declare const DEFAULT_LABEL_REGEX: RegExp;
318
+
550
319
  /**
551
320
  * Class decorator factory that attaches sigil statics to a class constructor.
552
321
  *
@@ -593,23 +362,6 @@ declare function WithSigil<L extends string>(label?: L, opts?: SigilOptions): (v
593
362
  * @returns The same constructor value, with runtime metadata ensured.
594
363
  */
595
364
  declare function withSigil<S extends Function, L extends string = string>(Class: S, label?: L, opts?: SigilOptions): S;
596
- /**
597
- * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.
598
- *
599
- * This is a *purely type-level* helper (no runtime changes). It optionally
600
- * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.
601
- *
602
- * Use this when the runtime metadata is already present (for example the class
603
- * is already decorated or was created via `Sigilify`).
604
- *
605
- * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.
606
- * @typeParam S - Constructor type (should be an ISigil).
607
- * @typeParam L - Label literal to associate at compile-time.
608
- * @param Class - The constructor to assert as typed sigil.
609
- * @param label - Optional label literal to assert at compile-time (and to verify in DEV).
610
- * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.
611
- */
612
- declare function typed<S extends Function, L extends string = string>(Class: S, label?: L, opts?: Pick<SigilOptions, 'devMarker'>): TypedSigil<S, L>;
613
365
  /**
614
366
  * Convenience helper that combine 'withSigil' and 'typeSigil'.
615
367
  *
@@ -693,7 +445,6 @@ declare function isInheritanceChecked(ctor: Function): boolean;
693
445
  * helpers.
694
446
  *
695
447
  * The returned class:
696
- * - registers a stable symbol for the provided `label` (via `WithSigil`)
697
448
  * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
698
449
  * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
699
450
  *
@@ -717,29 +468,45 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
717
468
  Sigil: true;
718
469
  } & { [K_1 in L]: true; } extends infer T ? { [K in keyof T]: T[K]; } : never;
719
470
  /**
720
- * Returns the human-readable sigil label of this instance's constructor.
471
+ * Check whether `other` is (or inherits from) the type instance.
721
472
  *
722
- * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
473
+ * Allows 'instanceof' like checks but in instances.
474
+ *
475
+ * @typeParam T - The instance type.
476
+ * @param this - The instance performing the check.
477
+ * @param other - The object to test.
478
+ * @returns `true` if `other` is the same instance of this type or a subtype.
723
479
  */
724
- getSigilLabel(): string;
480
+ isOfType<T_1>(this: T_1, other: unknown): other is GetInstance<T_1>;
725
481
  /**
726
- * Returns the runtime sigil type symbol of this instance's constructor.
482
+ * Strict lineage check: compares the type label lineage arrays element-by-element.
483
+ *
484
+ * Allows 'instanceof' like checks but in instances.
727
485
  *
728
- * @returns The symbol that identifies this type at runtime.
486
+ * @typeParam T - The instance type.
487
+ * @param this - The instance performing the check.
488
+ * @param other - The object to test.
489
+ * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
729
490
  */
730
- getSigilType(): symbol;
491
+ isOfTypeStrict<T_1>(this: T_1, other: unknown): other is GetInstance<T_1>;
731
492
  /**
732
- * Returns a copy of the sigil type symbol lineage for this instance's constructor.
493
+ * Returns the human-readable sigil label of this instance's constructor.
494
+ *
495
+ * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
496
+ */
497
+ getSigilLabel(): string;
498
+ /**
499
+ * Returns a copy of the sigil type label lineage for this instance's constructor.
733
500
  *
734
- * @returns readonly array of symbols representing the type lineage.
501
+ * @returns readonly array of labels representing the type lineage.
735
502
  */
736
- getSigilTypeLineage(): readonly symbol[];
503
+ getSigilLabelLineage(): readonly string[];
737
504
  /**
738
- * Returns a readonly copy of the sigil type symbol set for this instance's constructor.
505
+ * Returns a readonly copy of the sigil type label set for this instance's constructor.
739
506
  *
740
- * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.
507
+ * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
741
508
  */
742
- getSigilTypeSet(): Readonly<Set<symbol>>;
509
+ getSigilLabelSet(): Readonly<Set<string>>;
743
510
  };
744
511
  /**
745
512
  * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.
@@ -756,28 +523,21 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
756
523
  */
757
524
  get SigilLabel(): string;
758
525
  /**
759
- * Class-level unique runtime symbol used as the type identifier.
760
- *
761
- * This symbol is created with `Symbol.for(label)` during decoration so it is
762
- * stable across realms that share the same global symbol registry.
763
- */
764
- get SigilType(): symbol;
765
- /**
766
- * Copy of the linearized sigil type symbol chain for the current constructor.
526
+ * Copy of the linearized sigil type label chain for the current constructor.
767
527
  *
768
528
  * Useful for debugging and performing strict lineage comparisons.
769
529
  *
770
- * @returns An array of symbols representing parent → child type symbols.
530
+ * @returns An array of labels representing parent → child type labels.
771
531
  */
772
- get SigilTypeLineage(): readonly symbol[];
532
+ get SigilLabelLineage(): readonly string[];
773
533
  /**
774
- * Copy of the sigil type symbol set for the current constructor.
534
+ * Copy of the sigil type label set for the current constructor.
775
535
  *
776
536
  * Useful for quick membership checks (O(1) lookups) and debugging.
777
537
  *
778
- * @returns A Readonly Set of symbols that represent the type lineage.
538
+ * @returns A Readonly Set of labels that represent the type lineage.
779
539
  */
780
- get SigilTypeSet(): Readonly<Set<symbol>>;
540
+ get SigilLabelSet(): Readonly<Set<string>>;
781
541
  /**
782
542
  * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
783
543
  *
@@ -788,10 +548,6 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
788
548
  /**
789
549
  * Check whether `other` is (or inherits from) the type represented by the calling constructor.
790
550
  *
791
- * Implementation detail:
792
- * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.
793
- * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
794
- *
795
551
  * This replaces `instanceof` so that checks remain valid across bundles/realms
796
552
  * and when subclassing.
797
553
  *
@@ -802,11 +558,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
802
558
  */
803
559
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
804
560
  /**
805
- * Strict lineage check: compares the type symbol lineage arrays element-by-element.
806
- *
807
- * Implementation detail:
808
- * - Works in O(n) time where n is the depth of the lineage.
809
- * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
561
+ * Strict lineage check: compares the type label lineage arrays element-by-element.
810
562
  *
811
563
  * @typeParam T - The calling constructor type.
812
564
  * @param this - The constructor performing the check.
@@ -820,7 +572,6 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
820
572
  * helpers. Accept and return 'abstract' class.
821
573
  *
822
574
  * The returned class:
823
- * - registers a stable symbol for the provided `label` (via `WithSigil`)
824
575
  * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
825
576
  * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
826
577
  *
@@ -843,29 +594,45 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
843
594
  Sigil: true;
844
595
  } & { [K_1 in L]: true; } extends infer T ? { [K in keyof T]: T[K]; } : never;
845
596
  /**
846
- * Returns the human-readable sigil label of this instance's constructor.
597
+ * Check whether `other` is (or inherits from) the type instance.
847
598
  *
848
- * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
599
+ * Allows 'instanceof' like checks but in instances.
600
+ *
601
+ * @typeParam T - The instance type.
602
+ * @param this - The instance performing the check.
603
+ * @param other - The object to test.
604
+ * @returns `true` if `other` is the same instance of this type or a subtype.
849
605
  */
850
- getSigilLabel(): string;
606
+ isOfType<T_1>(this: T_1, other: unknown): other is GetInstance<T_1>;
607
+ /**
608
+ * Strict lineage check: compares the type label lineage arrays element-by-element.
609
+ *
610
+ * Allows 'instanceof' like checks but in instances.
611
+ *
612
+ * @typeParam T - The instance type.
613
+ * @param this - The instance performing the check.
614
+ * @param other - The object to test.
615
+ * @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
616
+ */
617
+ isOfTypeStrict<T_1>(this: T_1, other: unknown): other is GetInstance<T_1>;
851
618
  /**
852
- * Returns the runtime sigil type symbol of this instance's constructor.
619
+ * Returns the human-readable sigil label of this instance's constructor.
853
620
  *
854
- * @returns The symbol that identifies this type at runtime.
621
+ * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
855
622
  */
856
- getSigilType(): symbol;
623
+ getSigilLabel(): string;
857
624
  /**
858
- * Returns a copy of the sigil type symbol lineage for this instance's constructor.
625
+ * Returns a copy of the sigil type label lineage for this instance's constructor.
859
626
  *
860
- * @returns readonly array of symbols representing the type lineage.
627
+ * @returns readonly array of labels representing the type lineage.
861
628
  */
862
- getSigilTypeLineage(): readonly symbol[];
629
+ getSigilLabelLineage(): readonly string[];
863
630
  /**
864
- * Returns a readonly copy of the sigil type symbol set for this instance's constructor.
631
+ * Returns a readonly copy of the sigil type label set for this instance's constructor.
865
632
  *
866
- * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.
633
+ * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
867
634
  */
868
- getSigilTypeSet(): Readonly<Set<symbol>>;
635
+ getSigilLabelSet(): Readonly<Set<string>>;
869
636
  }) & {
870
637
  /**
871
638
  * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.
@@ -882,28 +649,21 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
882
649
  */
883
650
  get SigilLabel(): string;
884
651
  /**
885
- * Class-level unique runtime symbol used as the type identifier.
886
- *
887
- * This symbol is created with `Symbol.for(label)` during decoration so it is
888
- * stable across realms that share the same global symbol registry.
889
- */
890
- get SigilType(): symbol;
891
- /**
892
- * Copy of the linearized sigil type symbol chain for the current constructor.
652
+ * Copy of the linearized sigil type label chain for the current constructor.
893
653
  *
894
654
  * Useful for debugging and performing strict lineage comparisons.
895
655
  *
896
- * @returns An array of symbols representing parent → child type symbols.
656
+ * @returns An array of labels representing parent → child type labels.
897
657
  */
898
- get SigilTypeLineage(): readonly symbol[];
658
+ get SigilLabelLineage(): readonly string[];
899
659
  /**
900
- * Copy of the sigil type symbol set for the current constructor.
660
+ * Copy of the sigil type label set for the current constructor.
901
661
  *
902
662
  * Useful for quick membership checks (O(1) lookups) and debugging.
903
663
  *
904
- * @returns A Readonly Set of symbols that represent the type lineage.
664
+ * @returns A Readonly Set of labels that represent the type lineage.
905
665
  */
906
- get SigilTypeSet(): Readonly<Set<symbol>>;
666
+ get SigilLabelSet(): Readonly<Set<string>>;
907
667
  /**
908
668
  * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
909
669
  *
@@ -915,7 +675,7 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
915
675
  * Check whether `other` is (or inherits from) the type represented by the calling constructor.
916
676
  *
917
677
  * Implementation detail:
918
- * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.
678
+ * - Uses the other instance's `__LABEL_SET__` for O(1) membership test.
919
679
  * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
920
680
  *
921
681
  * This replaces `instanceof` so that checks remain valid across bundles/realms
@@ -928,7 +688,7 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
928
688
  */
929
689
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
930
690
  /**
931
- * Strict lineage check: compares the type symbol lineage arrays element-by-element.
691
+ * Strict lineage check: compares the type label lineage arrays element-by-element.
932
692
  *
933
693
  * Implementation detail:
934
694
  * - Works in O(n) time where n is the depth of the lineage.
@@ -942,4 +702,4 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
942
702
  isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
943
703
  }) & B;
944
704
 
945
- export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, REGISTRY, Sigil, type SigilBrandOf, SigilError, type SigilOptions, SigilRegistry, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, getActiveRegistry, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, typed, updateOptions, withSigil, withSigilTyped };
705
+ export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, Sigil, type SigilBrandOf, SigilError, type SigilOptions, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, updateOptions, withSigil, withSigilTyped };