typetify 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/chunk-7G4ZSMQX.js +470 -0
  2. package/dist/chunk-7G4ZSMQX.js.map +1 -0
  3. package/dist/chunk-CWHYQWNU.mjs +224 -0
  4. package/dist/chunk-CWHYQWNU.mjs.map +1 -0
  5. package/dist/{chunk-JAOGY4JO.mjs → chunk-FEX5C4OH.mjs} +2 -2
  6. package/dist/chunk-FEX5C4OH.mjs.map +1 -0
  7. package/dist/chunk-FN553YPU.js +441 -0
  8. package/dist/chunk-FN553YPU.js.map +1 -0
  9. package/dist/chunk-FT2EK4AM.mjs +420 -0
  10. package/dist/chunk-FT2EK4AM.mjs.map +1 -0
  11. package/dist/chunk-N6IUADIP.mjs +414 -0
  12. package/dist/chunk-N6IUADIP.mjs.map +1 -0
  13. package/dist/chunk-OKB3MS5F.js +547 -0
  14. package/dist/chunk-OKB3MS5F.js.map +1 -0
  15. package/dist/chunk-POD52NJ3.mjs +526 -0
  16. package/dist/chunk-POD52NJ3.mjs.map +1 -0
  17. package/dist/{chunk-SIA5BSVY.js → chunk-S535LAXW.js} +2 -2
  18. package/dist/chunk-S535LAXW.js.map +1 -0
  19. package/dist/chunk-X55EORNF.js +259 -0
  20. package/dist/chunk-X55EORNF.js.map +1 -0
  21. package/dist/index.d.mts +995 -28
  22. package/dist/index.d.ts +995 -28
  23. package/dist/index.js +869 -23
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +838 -17
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/iterator/index.js +77 -514
  28. package/dist/iterator/index.js.map +1 -1
  29. package/dist/iterator/index.mjs +1 -499
  30. package/dist/iterator/index.mjs.map +1 -1
  31. package/dist/logic/index.js +193 -408
  32. package/dist/logic/index.js.map +1 -1
  33. package/dist/logic/index.mjs +1 -364
  34. package/dist/logic/index.mjs.map +1 -1
  35. package/dist/narrowing/index.js +133 -212
  36. package/dist/narrowing/index.js.map +1 -1
  37. package/dist/narrowing/index.mjs +1 -183
  38. package/dist/narrowing/index.mjs.map +1 -1
  39. package/dist/schema/index.js +102 -402
  40. package/dist/schema/index.js.map +1 -1
  41. package/dist/schema/index.mjs +2 -381
  42. package/dist/schema/index.mjs.map +1 -1
  43. package/dist/typed/index.js +47 -47
  44. package/dist/typed/index.mjs +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-JAOGY4JO.mjs.map +0 -1
  47. package/dist/chunk-SIA5BSVY.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
+ import { logic_exports } from './chunk-FT2EK4AM.mjs';
2
+ import { narrowing_exports } from './chunk-CWHYQWNU.mjs';
3
+ import { schema_exports } from './chunk-N6IUADIP.mjs';
1
4
  import { dx_exports } from './chunk-4NXETABV.mjs';
2
5
  export { assertNever, debug, deprecated, exhaustive, getLogLevel, invariant, log, measure, measureAsync, setLogLevel, todo } from './chunk-4NXETABV.mjs';
3
- export { brand, createMap, createSet, defineConst, defineEnum, defineTuple, narrow } from './chunk-JAOGY4JO.mjs';
6
+ export { brand, createMap, createSet, defineConst, defineEnum, defineTuple, narrow } from './chunk-FEX5C4OH.mjs';
4
7
  import { string_exports } from './chunk-YOPAXITF.mjs';
5
8
  export { camelCase, capitalize, kebabCase, pascalCase, slugify, snakeCase, template, truncate, uncapitalize, words } from './chunk-YOPAXITF.mjs';
6
9
  import { fn_exports } from './chunk-ZE4FDBRI.mjs';
@@ -9,6 +12,7 @@ import { math_exports } from './chunk-JB6UXRKD.mjs';
9
12
  export { average, max, median, min, percentage, randomFloat, randomInt, round, sum } from './chunk-JB6UXRKD.mjs';
10
13
  import { result_exports } from './chunk-CN3GYRJN.mjs';
11
14
  export { andThen, fromNullable, isErr, isOk, mapErr, mapOption, mapResult, matchOption, matchResult, none, orElse, some, toNullable, unwrap, unwrapOption, unwrapOptionOr, unwrapOr } from './chunk-CN3GYRJN.mjs';
15
+ import { iterator_exports } from './chunk-POD52NJ3.mjs';
12
16
  import { decorator_exports } from './chunk-TZEWREAC.mjs';
13
17
  export { Bind, Debounce, Deprecated, Frozen, Lazy, Log, Measure, Memoize, Retry, Sealed, Throttle, Validate } from './chunk-TZEWREAC.mjs';
14
18
  import { core_exports } from './chunk-QFR7DVAJ.mjs';
@@ -28,6 +32,809 @@ export { compose, constant, ifElse, match, pipe, tap, tryCatch, tryCatchAsync, u
28
32
  export { err, ok } from './chunk-FXWYPHA3.mjs';
29
33
  import { __export } from './chunk-J5LGTIGS.mjs';
30
34
 
35
+ // src/reactive/index.ts
36
+ var reactive_exports = {};
37
+ __export(reactive_exports, {
38
+ batch: () => batch,
39
+ computed: () => computed,
40
+ createAutoUndoableState: () => createAutoUndoableState,
41
+ createUndoableState: () => createUndoableState,
42
+ effect: () => effect,
43
+ signal: () => signal
44
+ });
45
+
46
+ // src/reactive/signal.ts
47
+ var currentComputed = null;
48
+ function signal(initialValue) {
49
+ let value = initialValue;
50
+ const subscribers = /* @__PURE__ */ new Set();
51
+ const read = () => {
52
+ if (currentComputed) {
53
+ subscribers.add(currentComputed);
54
+ }
55
+ return value;
56
+ };
57
+ read.set = (newValue) => {
58
+ if (!Object.is(value, newValue)) {
59
+ value = newValue;
60
+ subscribers.forEach((fn) => fn(value));
61
+ }
62
+ };
63
+ read.update = (fn) => {
64
+ read.set(fn(value));
65
+ };
66
+ read.subscribe = (fn) => {
67
+ subscribers.add(fn);
68
+ return () => subscribers.delete(fn);
69
+ };
70
+ read.peek = () => value;
71
+ return read;
72
+ }
73
+ function computed(fn) {
74
+ const internalSignal = signal(void 0);
75
+ const recompute = () => {
76
+ const prevComputed = currentComputed;
77
+ currentComputed = recompute;
78
+ try {
79
+ internalSignal.set(fn());
80
+ } finally {
81
+ currentComputed = prevComputed;
82
+ }
83
+ };
84
+ recompute();
85
+ const read = () => internalSignal();
86
+ read.subscribe = internalSignal.subscribe;
87
+ read.peek = internalSignal.peek;
88
+ return read;
89
+ }
90
+ function effect(fn) {
91
+ let cleanup;
92
+ const run = () => {
93
+ if (cleanup) cleanup();
94
+ const prevComputed = currentComputed;
95
+ currentComputed = run;
96
+ try {
97
+ cleanup = fn();
98
+ } finally {
99
+ currentComputed = prevComputed;
100
+ }
101
+ };
102
+ run();
103
+ return () => {
104
+ if (cleanup) cleanup();
105
+ };
106
+ }
107
+ var batchDepth = 0;
108
+ var pendingEffects = /* @__PURE__ */ new Set();
109
+ function batch(fn) {
110
+ batchDepth++;
111
+ try {
112
+ fn();
113
+ } finally {
114
+ batchDepth--;
115
+ if (batchDepth === 0) {
116
+ const effects = pendingEffects;
117
+ pendingEffects = /* @__PURE__ */ new Set();
118
+ effects.forEach((effect2) => effect2());
119
+ }
120
+ }
121
+ }
122
+
123
+ // src/reactive/undoable.ts
124
+ function createUndoableState(initialValue, options = {}) {
125
+ const { maxHistory = 100 } = options;
126
+ const value = signal(initialValue);
127
+ const history = [initialValue];
128
+ let currentIndex = 0;
129
+ const canUndo = () => currentIndex > 0;
130
+ const canRedo = () => currentIndex < history.length - 1;
131
+ const undo = () => {
132
+ if (canUndo()) {
133
+ currentIndex--;
134
+ value.set(structuredClone(history[currentIndex]));
135
+ }
136
+ };
137
+ const redo = () => {
138
+ if (canRedo()) {
139
+ currentIndex++;
140
+ value.set(structuredClone(history[currentIndex]));
141
+ }
142
+ };
143
+ const commit = () => {
144
+ const currentValue = value();
145
+ if (currentIndex < history.length && JSON.stringify(history[currentIndex]) === JSON.stringify(currentValue)) {
146
+ return;
147
+ }
148
+ history.splice(currentIndex + 1);
149
+ history.push(structuredClone(currentValue));
150
+ currentIndex = history.length - 1;
151
+ if (history.length > maxHistory) {
152
+ history.shift();
153
+ currentIndex--;
154
+ }
155
+ };
156
+ const clearHistory = () => {
157
+ const currentValue = value();
158
+ history.length = 0;
159
+ history.push(structuredClone(currentValue));
160
+ currentIndex = 0;
161
+ };
162
+ const historyLength = () => history.length;
163
+ return {
164
+ value,
165
+ undo,
166
+ redo,
167
+ canUndo,
168
+ canRedo,
169
+ clearHistory,
170
+ historyLength,
171
+ commit
172
+ };
173
+ }
174
+ function createAutoUndoableState(initialValue, options = {}) {
175
+ const undoable = createUndoableState(initialValue, options);
176
+ const read = () => undoable.value();
177
+ read.set = (newValue) => {
178
+ undoable.value.set(newValue);
179
+ undoable.commit();
180
+ };
181
+ read.update = (fn) => {
182
+ read.set(fn(undoable.value()));
183
+ };
184
+ read.undo = undoable.undo;
185
+ read.redo = undoable.redo;
186
+ read.canUndo = undoable.canUndo;
187
+ read.canRedo = undoable.canRedo;
188
+ return read;
189
+ }
190
+
191
+ // src/cache/index.ts
192
+ var cache_exports = {};
193
+ __export(cache_exports, {
194
+ memoize: () => memoize2,
195
+ smartCache: () => smartCache
196
+ });
197
+
198
+ // src/cache/smartCache.ts
199
+ function parseTTL(ttl) {
200
+ if (typeof ttl === "number") return ttl;
201
+ const match2 = ttl.match(/^(\d+)(ms|s|m|h|d)$/);
202
+ if (!match2) throw new Error(`Invalid TTL format: ${ttl}`);
203
+ const [, value, unit] = match2;
204
+ const num = parseInt(value, 10);
205
+ switch (unit) {
206
+ case "ms":
207
+ return num;
208
+ case "s":
209
+ return num * 1e3;
210
+ case "m":
211
+ return num * 60 * 1e3;
212
+ case "h":
213
+ return num * 60 * 60 * 1e3;
214
+ case "d":
215
+ return num * 24 * 60 * 60 * 1e3;
216
+ default:
217
+ return num;
218
+ }
219
+ }
220
+ function smartCache(fn, options = {}) {
221
+ const {
222
+ ttl = Infinity,
223
+ maxSize = 1e3,
224
+ key = (...args) => JSON.stringify(args),
225
+ onHit,
226
+ onMiss
227
+ } = options;
228
+ const ttlMs = parseTTL(ttl);
229
+ const cache = /* @__PURE__ */ new Map();
230
+ const getKey = (...args) => key(...args);
231
+ const isExpired = (entry) => {
232
+ return Date.now() > entry.expiresAt;
233
+ };
234
+ const evictOldest = () => {
235
+ if (cache.size >= maxSize) {
236
+ const firstKey = cache.keys().next().value;
237
+ if (firstKey) cache.delete(firstKey);
238
+ }
239
+ };
240
+ const cached = async (...args) => {
241
+ const cacheKey = getKey(...args);
242
+ const entry = cache.get(cacheKey);
243
+ if (entry && !isExpired(entry)) {
244
+ onHit?.(cacheKey, entry.value);
245
+ return entry.value;
246
+ }
247
+ onMiss?.(cacheKey);
248
+ if (entry) cache.delete(cacheKey);
249
+ evictOldest();
250
+ const value = await fn(...args);
251
+ cache.set(cacheKey, {
252
+ value,
253
+ expiresAt: Date.now() + ttlMs
254
+ });
255
+ return value;
256
+ };
257
+ cached.invalidate = (...args) => {
258
+ const cacheKey = getKey(...args);
259
+ cache.delete(cacheKey);
260
+ };
261
+ cached.invalidateAll = () => {
262
+ cache.clear();
263
+ };
264
+ cached.clear = cached.invalidateAll;
265
+ cached.has = (...args) => {
266
+ const cacheKey = getKey(...args);
267
+ const entry = cache.get(cacheKey);
268
+ return entry !== void 0 && !isExpired(entry);
269
+ };
270
+ cached.size = () => cache.size;
271
+ return cached;
272
+ }
273
+ function memoize2(fn) {
274
+ const cache = /* @__PURE__ */ new Map();
275
+ return (...args) => {
276
+ const key = JSON.stringify(args);
277
+ if (cache.has(key)) {
278
+ return cache.get(key);
279
+ }
280
+ const result = fn(...args);
281
+ cache.set(key, result);
282
+ return result;
283
+ };
284
+ }
285
+
286
+ // src/event/index.ts
287
+ var event_exports = {};
288
+ __export(event_exports, {
289
+ createEventBus: () => createEventBus,
290
+ createTypedEmitter: () => createTypedEmitter
291
+ });
292
+
293
+ // src/event/eventBus.ts
294
+ function createEventBus() {
295
+ const handlers = /* @__PURE__ */ new Map();
296
+ const getHandlers = (event) => {
297
+ if (!handlers.has(event)) {
298
+ handlers.set(event, /* @__PURE__ */ new Set());
299
+ }
300
+ return handlers.get(event);
301
+ };
302
+ return {
303
+ on(event, handler) {
304
+ const eventHandlers = getHandlers(event);
305
+ eventHandlers.add(handler);
306
+ return () => eventHandlers.delete(handler);
307
+ },
308
+ once(event, handler) {
309
+ const wrappedHandler = (data) => {
310
+ handler(data);
311
+ getHandlers(event).delete(wrappedHandler);
312
+ };
313
+ return this.on(event, wrappedHandler);
314
+ },
315
+ emit(event, data) {
316
+ const eventHandlers = getHandlers(event);
317
+ eventHandlers.forEach((handler) => handler(data));
318
+ },
319
+ off(event) {
320
+ handlers.delete(event);
321
+ },
322
+ clear() {
323
+ handlers.clear();
324
+ },
325
+ listenerCount(event) {
326
+ return getHandlers(event).size;
327
+ }
328
+ };
329
+ }
330
+ function createTypedEmitter() {
331
+ return createEventBus();
332
+ }
333
+
334
+ // src/pipeline/index.ts
335
+ var pipeline_exports = {};
336
+ __export(pipeline_exports, {
337
+ compose: () => compose2,
338
+ createMiddleware: () => createMiddleware,
339
+ flow: () => flow,
340
+ pipe: () => pipe2,
341
+ pipeAsync: () => pipeAsync
342
+ });
343
+
344
+ // src/pipeline/pipe.ts
345
+ function pipe2(value, ...fns) {
346
+ return fns.reduce((acc, fn) => fn(acc), value);
347
+ }
348
+ async function pipeAsync(value, ...fns) {
349
+ let result = value;
350
+ for (const fn of fns) {
351
+ result = await fn(result);
352
+ }
353
+ return result;
354
+ }
355
+ function flow(...fns) {
356
+ return (value) => fns.reduce((acc, fn) => fn(acc), value);
357
+ }
358
+
359
+ // src/pipeline/middleware.ts
360
+ function createMiddleware() {
361
+ const middlewares = [];
362
+ const pipeline = {
363
+ use(middleware) {
364
+ middlewares.push(middleware);
365
+ return pipeline;
366
+ },
367
+ async execute(ctx) {
368
+ let index = 0;
369
+ const next = async () => {
370
+ if (index < middlewares.length) {
371
+ const middleware = middlewares[index++];
372
+ await middleware(ctx, next);
373
+ }
374
+ };
375
+ await next();
376
+ },
377
+ handler() {
378
+ return (ctx) => pipeline.execute(ctx);
379
+ }
380
+ };
381
+ return pipeline;
382
+ }
383
+ function compose2(...middlewares) {
384
+ return async (ctx, next) => {
385
+ let index = 0;
386
+ const dispatch = async () => {
387
+ if (index < middlewares.length) {
388
+ const middleware = middlewares[index++];
389
+ await middleware(ctx, dispatch);
390
+ } else {
391
+ await next();
392
+ }
393
+ };
394
+ await dispatch();
395
+ };
396
+ }
397
+
398
+ // src/di/index.ts
399
+ var di_exports = {};
400
+ __export(di_exports, {
401
+ createContainer: () => createContainer,
402
+ createTypedContainer: () => createTypedContainer
403
+ });
404
+
405
+ // src/di/container.ts
406
+ function createContainer(parent) {
407
+ const services = /* @__PURE__ */ new Map();
408
+ const container = {
409
+ register(key, factory) {
410
+ services.set(key, { factory, singleton: false });
411
+ return container;
412
+ },
413
+ singleton(key, factory) {
414
+ services.set(key, { factory, singleton: true });
415
+ return container;
416
+ },
417
+ constant(key, value) {
418
+ services.set(key, {
419
+ factory: () => value,
420
+ singleton: true,
421
+ instance: value
422
+ });
423
+ return container;
424
+ },
425
+ resolve(key) {
426
+ const descriptor = services.get(key);
427
+ if (!descriptor) {
428
+ if (parent) {
429
+ return parent.resolve(key);
430
+ }
431
+ throw new Error(`Service not found: ${String(key)}`);
432
+ }
433
+ if (descriptor.singleton) {
434
+ if (descriptor.instance === void 0) {
435
+ descriptor.instance = descriptor.factory(container);
436
+ }
437
+ return descriptor.instance;
438
+ }
439
+ return descriptor.factory(container);
440
+ },
441
+ has(key) {
442
+ return services.has(key) || (parent?.has(key) ?? false);
443
+ },
444
+ createChild() {
445
+ return createContainer(container);
446
+ }
447
+ };
448
+ return container;
449
+ }
450
+ function createTypedContainer() {
451
+ const container = createContainer();
452
+ return {
453
+ register(key, factory) {
454
+ container.register(key, factory);
455
+ return this;
456
+ },
457
+ singleton(key, factory) {
458
+ container.singleton(key, factory);
459
+ return this;
460
+ },
461
+ constant(key, value) {
462
+ container.constant(key, value);
463
+ return this;
464
+ },
465
+ resolve(key) {
466
+ return container.resolve(key);
467
+ },
468
+ has(key) {
469
+ return container.has(key);
470
+ }
471
+ };
472
+ }
473
+
474
+ // src/env/index.ts
475
+ var env_exports = {};
476
+ __export(env_exports, {
477
+ createEnv: () => createEnv,
478
+ env: () => env
479
+ });
480
+
481
+ // src/env/env.ts
482
+ var env = {
483
+ /**
484
+ * String environment variable
485
+ */
486
+ string(options) {
487
+ return {
488
+ _type: "",
489
+ _parse: (value) => {
490
+ if (value === void 0) {
491
+ if (options?.default !== void 0) return options.default;
492
+ throw new Error("Required environment variable is missing");
493
+ }
494
+ return value;
495
+ },
496
+ _default: options?.default
497
+ };
498
+ },
499
+ /**
500
+ * Number environment variable
501
+ */
502
+ number(options) {
503
+ return {
504
+ _type: 0,
505
+ _parse: (value) => {
506
+ if (value === void 0) {
507
+ if (options?.default !== void 0) return options.default;
508
+ throw new Error("Required environment variable is missing");
509
+ }
510
+ const num = Number(value);
511
+ if (isNaN(num)) throw new Error(`Invalid number: ${value}`);
512
+ return num;
513
+ },
514
+ _default: options?.default
515
+ };
516
+ },
517
+ /**
518
+ * Boolean environment variable
519
+ */
520
+ boolean(options) {
521
+ return {
522
+ _type: false,
523
+ _parse: (value) => {
524
+ if (value === void 0) {
525
+ if (options?.default !== void 0) return options.default;
526
+ throw new Error("Required environment variable is missing");
527
+ }
528
+ return value === "true" || value === "1" || value === "yes";
529
+ },
530
+ _default: options?.default
531
+ };
532
+ },
533
+ /**
534
+ * Enum environment variable
535
+ */
536
+ enum(values, options) {
537
+ return {
538
+ _type: "",
539
+ _parse: (value) => {
540
+ if (value === void 0) {
541
+ if (options?.default !== void 0) return options.default;
542
+ throw new Error("Required environment variable is missing");
543
+ }
544
+ if (!values.includes(value)) {
545
+ throw new Error(`Invalid value: ${value}. Expected one of: ${values.join(", ")}`);
546
+ }
547
+ return value;
548
+ },
549
+ _default: options?.default
550
+ };
551
+ },
552
+ /**
553
+ * URL environment variable
554
+ */
555
+ url(options) {
556
+ return {
557
+ _type: "",
558
+ _parse: (value) => {
559
+ if (value === void 0) {
560
+ if (options?.default !== void 0) return options.default;
561
+ throw new Error("Required environment variable is missing");
562
+ }
563
+ try {
564
+ new URL(value);
565
+ return value;
566
+ } catch {
567
+ throw new Error(`Invalid URL: ${value}`);
568
+ }
569
+ },
570
+ _default: options?.default
571
+ };
572
+ },
573
+ /**
574
+ * JSON environment variable
575
+ */
576
+ json(options) {
577
+ return {
578
+ _type: {},
579
+ _parse: (value) => {
580
+ if (value === void 0) {
581
+ if (options?.default !== void 0) return options.default;
582
+ throw new Error("Required environment variable is missing");
583
+ }
584
+ try {
585
+ return JSON.parse(value);
586
+ } catch {
587
+ throw new Error(`Invalid JSON: ${value}`);
588
+ }
589
+ },
590
+ _default: options?.default
591
+ };
592
+ },
593
+ /**
594
+ * Array environment variable (comma-separated)
595
+ */
596
+ array(options) {
597
+ const separator = options?.separator ?? ",";
598
+ return {
599
+ _type: [],
600
+ _parse: (value) => {
601
+ if (value === void 0) {
602
+ if (options?.default !== void 0) return options.default;
603
+ throw new Error("Required environment variable is missing");
604
+ }
605
+ return value.split(separator).map((s) => s.trim());
606
+ },
607
+ _default: options?.default
608
+ };
609
+ }
610
+ };
611
+ function createEnv(schema, envSource = typeof process !== "undefined" ? process.env : {}) {
612
+ const result = {};
613
+ const errors = [];
614
+ for (const [key, varDef] of Object.entries(schema)) {
615
+ try {
616
+ result[key] = varDef._parse(envSource[key]);
617
+ } catch (error) {
618
+ errors.push(`${key}: ${error.message}`);
619
+ }
620
+ }
621
+ if (errors.length > 0) {
622
+ throw new Error(`Environment validation failed:
623
+ ${errors.join("\n")}`);
624
+ }
625
+ return result;
626
+ }
627
+
628
+ // src/router/index.ts
629
+ var router_exports = {};
630
+ __export(router_exports, {
631
+ createRouter: () => createRouter,
632
+ route: () => route
633
+ });
634
+
635
+ // src/router/router.ts
636
+ function route(path, params) {
637
+ const paramNames = (path.match(/:(\w+)/g) || []).map((p) => p.slice(1));
638
+ const paramDefs = params || {};
639
+ const build = (values) => {
640
+ let result = path;
641
+ for (const name of paramNames) {
642
+ const value = values[name];
643
+ result = result.replace(`:${name}`, String(value));
644
+ }
645
+ return result;
646
+ };
647
+ const match2 = (testPath) => {
648
+ const pattern = path.replace(/:(\w+)/g, "([^/]+)");
649
+ const regex = new RegExp(`^${pattern}$`);
650
+ const matches = testPath.match(regex);
651
+ if (!matches) return null;
652
+ const result = {};
653
+ paramNames.forEach((name, index) => {
654
+ const value = matches[index + 1];
655
+ const type = paramDefs[name];
656
+ if (type === "number") {
657
+ result[name] = Number(value);
658
+ } else if (type === "boolean") {
659
+ result[name] = value === "true";
660
+ } else {
661
+ result[name] = value;
662
+ }
663
+ });
664
+ return result;
665
+ };
666
+ return { path, params: paramDefs, build, match: match2 };
667
+ }
668
+ function createRouter(routes) {
669
+ return {
670
+ routes,
671
+ navigate(name, params) {
672
+ const routeDef = routes[name];
673
+ if (!routeDef) throw new Error(`Route not found: ${String(name)}`);
674
+ return routeDef.build(params);
675
+ },
676
+ match(path) {
677
+ for (const [name, routeDef] of Object.entries(routes)) {
678
+ const params = routeDef.match(path);
679
+ if (params) {
680
+ return { name, params };
681
+ }
682
+ }
683
+ return null;
684
+ }
685
+ };
686
+ }
687
+
688
+ // src/form/index.ts
689
+ var form_exports = {};
690
+ __export(form_exports, {
691
+ createForm: () => createForm,
692
+ field: () => field
693
+ });
694
+
695
+ // src/form/form.ts
696
+ function field(initial, validate) {
697
+ return { initial, validate };
698
+ }
699
+ function createForm(config) {
700
+ const fieldEntries = Object.entries(config);
701
+ const fields = {};
702
+ for (const [key, fieldConfig] of fieldEntries) {
703
+ const value = signal(fieldConfig.initial);
704
+ const error = signal(null);
705
+ const touched = signal(false);
706
+ const dirty = signal(false);
707
+ const initialValue = fieldConfig.initial;
708
+ value.subscribe((v) => {
709
+ dirty.set(v !== initialValue);
710
+ if (fieldConfig.validate) {
711
+ error.set(fieldConfig.validate(v));
712
+ }
713
+ });
714
+ fields[key] = { value, error, touched, dirty };
715
+ }
716
+ const values = () => {
717
+ const result = {};
718
+ for (const key of Object.keys(fields)) {
719
+ result[key] = fields[key].value();
720
+ }
721
+ return result;
722
+ };
723
+ const errors = () => {
724
+ const result = {};
725
+ for (const key of Object.keys(fields)) {
726
+ const err2 = fields[key].error();
727
+ if (err2) result[key] = err2;
728
+ }
729
+ return result;
730
+ };
731
+ const isValid = () => {
732
+ return Object.keys(fields).every(
733
+ (key) => fields[key].error() === null
734
+ );
735
+ };
736
+ const isDirty = () => {
737
+ return Object.keys(fields).some(
738
+ (key) => fields[key].dirty()
739
+ );
740
+ };
741
+ const isTouched = () => {
742
+ return Object.keys(fields).some(
743
+ (key) => fields[key].touched()
744
+ );
745
+ };
746
+ const reset = () => {
747
+ for (const [key, fieldConfig] of fieldEntries) {
748
+ fields[key].value.set(fieldConfig.initial);
749
+ fields[key].error.set(null);
750
+ fields[key].touched.set(false);
751
+ fields[key].dirty.set(false);
752
+ }
753
+ };
754
+ const validate = () => {
755
+ for (const [key, fieldConfig] of fieldEntries) {
756
+ if (fieldConfig.validate) {
757
+ const err2 = fieldConfig.validate(fields[key].value());
758
+ fields[key].error.set(err2);
759
+ }
760
+ fields[key].touched.set(true);
761
+ }
762
+ return isValid();
763
+ };
764
+ const submit = async (handler) => {
765
+ if (validate()) {
766
+ await handler(values());
767
+ }
768
+ };
769
+ return {
770
+ fields,
771
+ values,
772
+ errors,
773
+ isValid,
774
+ isDirty,
775
+ isTouched,
776
+ reset,
777
+ validate,
778
+ submit
779
+ };
780
+ }
781
+
782
+ // src/feature/index.ts
783
+ var feature_exports = {};
784
+ __export(feature_exports, {
785
+ createFeatureFlags: () => createFeatureFlags,
786
+ flag: () => flag
787
+ });
788
+
789
+ // src/feature/featureFlags.ts
790
+ var flag = {
791
+ boolean(defaultValue = false) {
792
+ return { type: "boolean", default: defaultValue };
793
+ },
794
+ string(defaultValue = "") {
795
+ return { type: "string", default: defaultValue };
796
+ },
797
+ number(defaultValue = 0) {
798
+ return { type: "number", default: defaultValue };
799
+ }
800
+ };
801
+ function createFeatureFlags(schema) {
802
+ const values = {};
803
+ for (const [key, config] of Object.entries(schema)) {
804
+ values[key] = config.default;
805
+ }
806
+ return {
807
+ is(key) {
808
+ const config = schema[key];
809
+ if (config?.type !== "boolean") {
810
+ throw new Error(`Flag '${String(key)}' is not a boolean flag`);
811
+ }
812
+ return values[key];
813
+ },
814
+ get(key) {
815
+ return values[key];
816
+ },
817
+ set(key, value) {
818
+ values[key] = value;
819
+ },
820
+ all() {
821
+ return { ...values };
822
+ },
823
+ reset() {
824
+ for (const [key, config] of Object.entries(schema)) {
825
+ values[key] = config.default;
826
+ }
827
+ },
828
+ load(flags) {
829
+ for (const [key, value] of Object.entries(flags)) {
830
+ if (key in schema && value !== void 0) {
831
+ values[key] = value;
832
+ }
833
+ }
834
+ }
835
+ };
836
+ }
837
+
31
838
  // src/array/index.ts
32
839
  var array_exports = {};
33
840
  __export(array_exports, {
@@ -461,10 +1268,10 @@ function sortedUniqBy(array, iteratee) {
461
1268
  const result = [array[0]];
462
1269
  let lastComputed = iteratee(array[0]);
463
1270
  for (let i = 1; i < array.length; i++) {
464
- const computed = iteratee(array[i]);
465
- if (computed !== lastComputed) {
1271
+ const computed2 = iteratee(array[i]);
1272
+ if (computed2 !== lastComputed) {
466
1273
  result.push(array[i]);
467
- lastComputed = computed;
1274
+ lastComputed = computed2;
468
1275
  }
469
1276
  }
470
1277
  return result;
@@ -510,9 +1317,9 @@ function unionBy(iteratee, ...arrays) {
510
1317
  const result = [];
511
1318
  for (const array of arrays) {
512
1319
  for (const item of array) {
513
- const computed = iteratee(item);
514
- if (!seen.has(computed)) {
515
- seen.add(computed);
1320
+ const computed2 = iteratee(item);
1321
+ if (!seen.has(computed2)) {
1322
+ seen.add(computed2);
516
1323
  result.push(item);
517
1324
  }
518
1325
  }
@@ -539,9 +1346,9 @@ function uniqBy(array, iteratee) {
539
1346
  const seen = /* @__PURE__ */ new Set();
540
1347
  const result = [];
541
1348
  for (const item of array) {
542
- const computed = iteratee(item);
543
- if (!seen.has(computed)) {
544
- seen.add(computed);
1349
+ const computed2 = iteratee(item);
1350
+ if (!seen.has(computed2)) {
1351
+ seen.add(computed2);
545
1352
  result.push(item);
546
1353
  }
547
1354
  }
@@ -605,14 +1412,14 @@ function xorBy(iteratee, ...arrays) {
605
1412
  for (const array of arrays) {
606
1413
  const seen = /* @__PURE__ */ new Set();
607
1414
  for (const item of array) {
608
- const computed = iteratee(item);
609
- if (!seen.has(computed)) {
610
- seen.add(computed);
611
- const existing = counts.get(computed);
1415
+ const computed2 = iteratee(item);
1416
+ if (!seen.has(computed2)) {
1417
+ seen.add(computed2);
1418
+ const existing = counts.get(computed2);
612
1419
  if (existing) {
613
1420
  existing.count++;
614
1421
  } else {
615
- counts.set(computed, { count: 1, item });
1422
+ counts.set(computed2, { count: 1, item });
616
1423
  }
617
1424
  }
618
1425
  }
@@ -716,10 +1523,24 @@ var _ = {
716
1523
  ...math_exports,
717
1524
  ...result_exports,
718
1525
  ...decorator_exports,
719
- ...array_exports
1526
+ ...array_exports,
1527
+ // typed: excluded due to unique symbol export limitations - use direct imports
1528
+ ...logic_exports,
1529
+ ...iterator_exports,
1530
+ ...narrowing_exports,
1531
+ ...schema_exports,
1532
+ ...reactive_exports,
1533
+ ...cache_exports,
1534
+ ...event_exports,
1535
+ ...pipeline_exports,
1536
+ ...di_exports,
1537
+ ...env_exports,
1538
+ ...router_exports,
1539
+ ...form_exports,
1540
+ ...feature_exports
720
1541
  };
721
1542
  var src_default = _;
722
1543
 
723
- export { _, concat, src_default as default, differenceBy, differenceWith, dropRight, dropRightWhile, fill, findIndex, findLastIndex, flattenDeep, flattenDepth, fromPairs, indexOf, intersectionBy, intersectionWith, join, lastIndexOf, nth, pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, takeRight, takeRightWhile, union, unionBy, unionWith, uniqBy, uniqWith, unzipWith, without, xor, xorBy, xorWith, zipObject, zipObjectDeep, zipWith };
1544
+ export { _, batch, compose2 as composeMiddleware, computed, concat, createAutoUndoableState, createContainer, createEnv, createEventBus, createFeatureFlags, createForm, createMiddleware, createRouter, createTypedContainer, createTypedEmitter, createUndoableState, src_default as default, differenceBy, differenceWith, dropRight, dropRightWhile, effect, env, field, fill, findIndex, findLastIndex, flag, flattenDeep, flattenDepth, flow, fromPairs, indexOf, intersectionBy, intersectionWith, join, lastIndexOf, nth, pipeAsync, pipe2 as pipeValue, pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, reverse, route, signal, slice, smartCache, memoize2 as smartMemoize, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, takeRight, takeRightWhile, union, unionBy, unionWith, uniqBy, uniqWith, unzipWith, without, xor, xorBy, xorWith, zipObject, zipObjectDeep, zipWith };
724
1545
  //# sourceMappingURL=index.mjs.map
725
1546
  //# sourceMappingURL=index.mjs.map