cally 0.9.0 → 0.9.2

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 (3) hide show
  1. package/dist/cally.d.ts +3 -466
  2. package/dist/cally.js +211 -204
  3. package/package.json +10 -20
package/dist/cally.d.ts CHANGED
@@ -1,26 +1,6 @@
1
- declare interface Atomico<Props, PropsForInstance, Base>
2
- extends AtomicoStatic<Props> {
3
- new (
4
- props?: JSXProxy<
5
- DOMTag<DOMThis<Base>, Props>,
6
- AtomicoThis<PropsForInstance, Base>
7
- >
8
- ): AtomicoThis<PropsForInstance, Base>;
9
- }
10
-
11
- declare interface AtomicoStatic<Props> extends HTMLElement {
12
- styles: Sheets[];
13
- props: SchemaInfer<Props>;
14
- /**
15
- * Meta property, allows associating the component's
16
- * props in typescript to external environments.
17
- */
18
- readonly "##props": Props;
19
- /**
20
- * Allows to identify a constructor created with Atomico
21
- */
22
- readonly "##atomico": true;
23
- }
1
+ import { Atomico } from 'atomico/types/dom';
2
+ import { DaysOfWeek } from '../utils/date.js';
3
+ import { Pagination } from '../calendar-base/useCalendarBase.js';
24
4
 
25
5
  declare type AtomicoThis<Props = {}, Base = HTMLElement> = Props &
26
6
  DOMThis<Base> & {
@@ -209,461 +189,18 @@ prototype: HTMLElement;
209
189
 
210
190
  export declare type CalendarSelectYearProps = ComponentProps<typeof CalendarSelectYear>;
211
191
 
212
- declare type CheckEvent<CurrentEvent, True> = CurrentEvent extends Event ? True : never;
213
-
214
192
  declare type ComponentProps<T extends abstract new (...args: any) => any> = Simplify<Partial<Omit<InstanceType<T>, keyof HTMLElement | keyof AtomicoThis>>>;
215
193
 
216
- declare type DaysOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
217
-
218
- declare interface DOM$Attrs {
219
- [prop: `\$${string}`]: Nullable<string>;
220
- }
221
-
222
- declare type DOMCleanKeys =
223
- | keyof DOMGenericProperties
224
- | `add${string}`
225
- | `get${string}`
226
- | `set${string}`
227
- | `has${string}`
228
- | `matches${string}`
229
- | `remove${string}`
230
- | `replace${string}`
231
- | `querySelector${string}`
232
- | `offset${string}`
233
- | `append${string}`
234
- | `request${string}`
235
- | `scroll${string}`
236
- | `is${string}`
237
- | `toggle${string}`
238
- | `webkit${string}`
239
- | `insert${string}`
240
- | `client${string}`
241
- | `child${string}`
242
- | `${string}_${string}`
243
- | `${string}HTML`
244
- | `${string}Child`
245
- | `${string}Validity`
246
- | `${string}Capture`
247
- | `${string}ElementSibling`
248
- | "classList"
249
- | "attributes"
250
- | "normalize"
251
- | "closest"
252
- | "localName"
253
- | "contains"
254
- | "animate"
255
- | "attachShadow"
256
- | "outerText"
257
- | "attachInternals"
258
- | "click"
259
- | "tagName"
260
- | "focus"
261
- | "submit"
262
- | "accessKeyLabel"
263
- | "elements"
264
- | "isContentEditable"
265
- | "innerText"
266
- | "prepend"
267
- | "namespaceURI"
268
- | "blur"
269
- | "dataset"
270
- | "shadowRoot"
271
- | keyof Omit<ChildNode, "textContent">;
272
-
273
- declare type DOMCustomTarget<Target> = { customTarget: Target };
274
-
275
- declare type DOMEvent<
276
- Target = HTMLElement,
277
- CurrentEvent = Event
278
- > = Target extends string
279
- ? CurrentEvent extends AtomicoStatic<any>
280
- ? DOMGetEvent<Target, CurrentEvent>
281
- : DOMEventType<Target, CurrentEvent>
282
- : DOMTarget<DOMThis<Target>, CurrentEvent>;
283
-
284
- declare type DOMEventHandler<Target, Handler> = Handler extends (
285
- ev: infer CurrentEvent
286
- ) => any
287
- ? CurrentEvent extends Event
288
- ? (ev: DOMEvent<Target, CurrentEvent>) => any
289
- : Handler
290
- : Handler;
291
-
292
- /**
293
- * @todo Rename Handler to Listener
294
- */
295
-
296
- declare type DOMEventHandlerKeys<P> = {
297
- [I in keyof P]-?: NonNullable<P[I]> extends DOMEventHandlerValue<infer E>
298
- ? CheckEvent<E, I>
299
- : P[I] extends { value: DOMEventHandlerValue<infer E> }
300
- ? CheckEvent<E, I>
301
- : never;
302
- }[keyof P];
303
-
304
- declare interface DOMEventHandlerType extends FunctionConstructor {}
305
-
306
- declare interface DOMEventHandlerValue<CurrentEvent> {
307
- (event: CurrentEvent): any;
308
- }
309
-
310
- declare type DOMEvents<Target> = {
311
- [Prop in keyof Target]?: Prop extends `on${string}`
312
- ? DOMEventHandler<Target, Target[Prop]>
313
- : Target[Prop];
314
- };
315
-
316
- declare type DOMEventTarget<CurrentEvent, CurrentTarget, Target> = {
317
- [I in keyof CurrentEvent]: I extends "currentTarget"
318
- ? CurrentTarget
319
- : I extends "target"
320
- ? Target
321
- : CurrentEvent[I];
322
- };
323
-
324
- declare type DOMEventType<Type extends string, CurrentEvent> = {
325
- [I in keyof "0" as `on${Type}`]: {
326
- type: DOMEventHandlerType;
327
- value: DOMEventHandlerValue<CurrentEvent>;
328
- };
329
- };
330
-
331
- declare interface DOMGenericProperties {
332
- style?: string | Partial<CSSStyleDeclaration> | object;
333
- class?: string;
334
- id?: string;
335
- slot?: string;
336
- part?: string;
337
- is?: string;
338
- tabindex?: string | number;
339
- role?: string;
340
- shadowDom?: boolean | Partial<ShadowRootInit>;
341
- staticNode?: boolean;
342
- cloneNode?: boolean;
343
- width?: string | number;
344
- height?: string | number;
345
- key?: any;
346
- children?: any;
347
- }
348
-
349
- declare type DOMGetEvent<
350
- Type extends string,
351
- Element extends AtomicoStatic<any>
352
- > = Element extends {
353
- "##props": infer Props;
354
- }
355
- ? `on${Type}` extends keyof Props
356
- ? DOMGetEventBefore<NonNullable<Props[`on${Type}`]>, DOMThis<Element>>
357
- : Event
358
- : Event;
359
-
360
- declare type DOMGetEventBefore<Value, Target> = Value extends DOMEventHandlerValue<
361
- infer Event
362
- >
363
- ? DOMEvent<HTMLElement, Event & DOMCustomTarget<Target>>
364
- : null;
365
-
366
- declare type DOMRef<Target> = {
367
- ref?: DOMRefValue<Target>;
368
- };
369
-
370
- declare type DOMRefValue<Target> = FillObject | ((target: Target) => any);
371
-
372
- declare type DOMTag<Element, Props = null> = Props extends null
373
- ? PropsNullable<
374
- Omit<DOMEvents<Element>, DOMCleanKeys> &
375
- DOMGenericProperties &
376
- DOMRef<Element>
377
- > &
378
- DOM$Attrs &
379
- DOMUnknown
380
- : PropsNullable<
381
- Props &
382
- Omit<DOMEvents<Element & Props>, keyof Props | DOMCleanKeys> &
383
- DOMGenericProperties &
384
- DOMRef<Element & Props>
385
- > &
386
- DOM$Attrs &
387
- DOMUnknown;
388
-
389
- declare type DOMTarget<
390
- Target,
391
- CurrentEvent,
392
- Targets = Element | Node
393
- > = CurrentEvent extends {
394
- customTarget: infer EventTarget;
395
- }
396
- ? DOMTarget<Target, Omit<CurrentEvent, "customTarget">, EventTarget>
397
- : DOMEventTarget<CurrentEvent, Target, Targets>;
398
-
399
194
  declare type DOMThis<Element> = Element extends new (
400
195
  ...args: any[]
401
196
  ) => infer This
402
197
  ? This
403
198
  : Element;
404
199
 
405
- declare interface DOMUnknown {
406
- [prop: string]: any;
407
- }
408
-
409
- declare type EventInit_2 = CustomEventInit<any> & {
410
- type: string;
411
- base?: typeof CustomEvent | typeof Event;
412
- };
413
-
414
- declare type FillArray = any[];
415
-
416
- declare type FillConstructor = abstract new (...args: any) => any;
417
-
418
- declare type FillFunction = (...args: any[]) => any;
419
-
420
- /**
421
- * Interface to fill in unknown properties like any | null | undefined
422
- */
423
- declare interface FillObject {
424
- [index: string]: any;
425
- }
426
-
427
- declare type FillPromise = Promise<any>;
428
-
429
- declare type GetTypeSelf<value extends TypesSelfValues> = {
430
- [I in keyof SelfConstructors]-?: value extends InstanceType<
431
- SelfConstructors[I]
432
- >
433
- ? keyof value extends keyof InstanceType<SelfConstructors[I]>
434
- ? SelfConstructors[I]
435
- : never
436
- : never;
437
- }[keyof SelfConstructors];
438
-
439
- declare type JSXProxy<Props, This> = {
440
- [I in keyof Props]?: I extends `on${string}`
441
- ? NonNullable<Props[I]> extends DOMEventHandlerValue<infer CurrentEvent>
442
- ? Nullable<
443
- (
444
- ev: DOMEventTarget<CurrentEvent, This, Element | Node>
445
- ) => any
446
- >
447
- : Props[I]
448
- : I extends "ref"
449
- ? DOMRefValue<This>
450
- : Props[I];
451
- };
452
-
453
- declare type Nullable<T> = NonNullable<T> | undefined | null;
454
-
455
- declare type Pagination = "single" | "months";
456
-
457
- declare type PropsNullable<Data> = {
458
- [I in keyof Data]?: Nullable<Data[I]>;
459
- };
460
-
461
- declare type SafeGlobal =
462
- | "Event"
463
- | "URL"
464
- | "Range"
465
- | "Image"
466
- | "Crypto"
467
- | "File"
468
- | "Date"
469
- | "Set"
470
- | "Map"
471
- | "RegExp"
472
- | "Animation"
473
- | `${string}Event`
474
- | `Event${string}`
475
- | `Clipboard${string}`
476
- | `Animation${string}`
477
- | `Form${string}`
478
- | `Font${string}`
479
- | `DOM${string}`
480
- | `Touch${string}`
481
- | `Mutation${string}`
482
- | `Intersection${string}`
483
- | `Message${string}`
484
- | `HTML${string}`
485
- | `SVG${string}`
486
- | `Audio${string}`
487
- | `Document${string}`
488
- | `Weak${string}`
489
- | `CSS${string}`
490
- | `File${string}`;
491
-
492
- declare type SchemaAny<Type> =
493
- | SchemaReflect<{
494
- value: Type;
495
- }>
496
- | SchemaReflect<{
497
- value: () => Type;
498
- }>
499
- | SchemaReflect<{}>;
500
-
501
- declare type SchemaBase = SchemaEvent & {
502
- attr?: string;
503
- };
504
-
505
- declare type SchemaEvent = {
506
- event?: EventInit_2;
507
- };
508
-
509
- declare type SchemaInfer<Props> = Required<
510
- Omit<
511
- {
512
- [I in keyof Props]: Type<Props[I]>;
513
- },
514
- DOMEventHandlerKeys<Props>
515
- >
516
- >;
517
-
518
- declare type SchemaOnlyPropWrapper<Constructor, Type> =
519
- | SchemaProp<{
520
- type: Constructor;
521
- }>
522
- | SchemaProp<{
523
- type: Constructor;
524
- value: Type;
525
- }>
526
- | SchemaProp<{
527
- type: Constructor;
528
- value: () => Type;
529
- }>;
530
-
531
- declare type SchemaProp<type> = SchemaEvent & type;
532
-
533
- declare type SchemaReflect<type> = SchemaBase & {
534
- reflect?: boolean;
535
- } & type;
536
-
537
- declare type SchemaReflectWrapper<Constructor, Type> =
538
- | SchemaReflect<{
539
- type: Constructor;
540
- }>
541
- | SchemaReflect<{
542
- type: Constructor;
543
- value: Type;
544
- }>
545
- | SchemaReflect<{
546
- type: Constructor;
547
- value: () => Type;
548
- }>;
549
-
550
- declare type SchemaTypeCustom =
551
- | TypeCustom<FillFunction>
552
- | SchemaReflectWrapper<TypeCustom<FillFunction>, any>;
553
-
554
- declare type Self = typeof window;
555
-
556
- declare type SelfConstructors = Pick<
557
- Self,
558
- {
559
- [I in keyof Self]-?: I extends string
560
- ? I extends Capitalize<I>
561
- ? Self[I] extends FillConstructor
562
- ? Self[I] extends SelfIgnore
563
- ? never
564
- : I extends SafeGlobal
565
- ? I
566
- : never
567
- : never
568
- : never
569
- : never;
570
- }[keyof Self]
571
- >;
572
-
573
- declare type SelfIgnore =
574
- | StringConstructor
575
- | NumberConstructor
576
- | BooleanConstructor
577
- | FunctionConstructor
578
- | ObjectConstructor
579
- | PromiseConstructor
580
- | SymbolConstructor
581
- | ArrayConstructor;
582
-
583
- declare type Sheet = CSSStyleSheet | HTMLStyleElement;
584
-
585
- declare type Sheets = Sheet | Sheet[] | Sheets[];
586
-
587
200
  declare type Simplify<T> = {
588
201
  [K in keyof T]: T[K];
589
202
  } & {};
590
203
 
591
- declare type Type<type> = type extends string
592
- ? TypeString<type>
593
- : type extends number
594
- ? TypeNumber<type>
595
- : type extends boolean
596
- ? TypeBoolean
597
- : type extends TypeCustom<FillFunction>
598
- ? SchemaTypeCustom
599
- : type extends FillPromise
600
- ? TypePromise<type>
601
- : type extends symbol
602
- ? TypeSymbol<type>
603
- : type extends FillArray
604
- ? TypeArray<type>
605
- : type extends DOMStringMap
606
- ? TypeObject<type>
607
- : type extends TypesSelfValues
608
- ? GetTypeSelf<type> extends never
609
- ? TypesDiscard<type>
610
- : TypeConstructor<GetTypeSelf<type>>
611
- : TypesDiscard<type>;
612
-
613
- declare type TypeAny<type = any> = null | SchemaAny<type>;
614
-
615
- declare type TypeArray<type extends FillArray> =
616
- | ArrayConstructor
617
- | SchemaReflectWrapper<ArrayConstructor, type>;
618
-
619
- declare type TypeBoolean =
620
- | BooleanConstructor
621
- | SchemaReflectWrapper<BooleanConstructor, true | false>;
622
-
623
- declare type TypeConstructor<type extends FillConstructor> =
624
- | type
625
- | SchemaOnlyPropWrapper<type, InstanceType<type>>;
626
-
627
- declare type TypeCustom<Map extends FillFunction> = {
628
- name: "Custom";
629
- map: Map;
630
- serialize?: (value: ReturnType<Map>) => string;
631
- };
632
-
633
- declare type TypeFunction<type extends FillFunction> =
634
- | FunctionConstructor
635
- | SchemaOnlyPropWrapper<FunctionConstructor, type>;
636
-
637
- declare type TypeNumber<type extends number> =
638
- | NumberConstructor
639
- | SchemaReflectWrapper<NumberConstructor, type>;
640
-
641
- declare type TypeObject<type extends FillObject> =
642
- | ObjectConstructor
643
- | SchemaReflectWrapper<ObjectConstructor, type>;
644
-
645
- declare type TypePromise<type extends FillPromise> =
646
- | PromiseConstructor
647
- | SchemaOnlyPropWrapper<PromiseConstructor, type>;
648
-
649
- declare type TypesDiscard<type> = type extends FillFunction
650
- ? TypeFunction<type>
651
- : type extends FillObject
652
- ? TypeObject<type>
653
- : TypeAny<type>;
654
-
655
- declare type TypesSelfValues = {
656
- [I in keyof SelfConstructors]-?: InstanceType<SelfConstructors[I]>;
657
- }[keyof SelfConstructors];
658
-
659
- declare type TypeString<type extends string> =
660
- | StringConstructor
661
- | SchemaReflectWrapper<StringConstructor, type>;
662
-
663
- declare type TypeSymbol<type extends symbol> =
664
- | SymbolConstructor
665
- | SchemaOnlyPropWrapper<SymbolConstructor, type>;
666
-
667
204
  export { }
668
205
  // this is just a hacky workaround to ensure the global declarations make it into the dts rollup
669
206
  // they get appended to the end of the file on vite build