@duskmoon-dev/art-components 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +53 -0
  2. package/dist/index.js +187 -119
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -68,6 +68,59 @@ and `ArtSun` also accept `size="xl"`. Components forward refs to their root
68
68
  element, accept `className`, `style`, and DuskMoon CSS custom properties through
69
69
  `style`.
70
70
 
71
+ ## CSS and browser contracts
72
+
73
+ The wrappers supply the HTML required by CSS Art 1.20.7. They do not add
74
+ JavaScript animation engines or browser polyfills. CSS art uses modern CSS;
75
+ check feature support in your supported browsers, especially the following:
76
+
77
+ - `ArtCircularGallery` uses CSS Motion Path, `:has()`, `@property`, and CSS
78
+ Anchor Positioning. The upstream design has 20 items indexed 1–20; smaller
79
+ arrays remain supported but occupy only part of that arc. An item opens its
80
+ native hash-target preview when its `href` is omitted or points to its own
81
+ ID. A custom `href` performs ordinary link navigation. The published CSS sets
82
+ card width to `0.09 * --art-circular-gallery-size` (the upstream docs token
83
+ table's `0.07` differs from the shipped stylesheet). CSS Art 1.20.7 fixes
84
+ native preview centering ([duskmoonui#77](https://github.com/duskmoon-dev/duskmoonui/issues/77));
85
+ upgrade the CSS dependency to receive that fix. The wrapper uses upstream
86
+ positioning without a local override.
87
+ - `ArtCsswitch` changes its layout at viewport widths 1010, 670, 460, and 360px.
88
+ These are viewport breakpoints, independent of the `size` prop. Its native
89
+ buttons provide press feedback; app actions are consumer-owned.
90
+ - `ArtSnowballPreloader` requires `--art-snowball-preloader-bg` to match the
91
+ surrounding background so its track mask blends in. Upstream documents
92
+ relative-color support as Chrome 119+, Firefox 128+, or Safari 16.4+; verify
93
+ the features in your actual browser. Its snow texture loads from the URL in
94
+ upstream CSS. It is decorative by default; add a separate status message
95
+ when announcing loading.
96
+ - `ArtGeminiInput` uses `field-sizing: content` for multiline growth and
97
+ `@property`, gradients, and masks for its border. It defaults to `rows={1}`;
98
+ callers can set `rows` explicitly. Give the textarea an accessible name with
99
+ `textareaProps={{ "aria-label": "Message" }}` or an associated `<label>`.
100
+ The Add and Send buttons have no default application action. Set
101
+ `afterButtonProps={{ type: "submit" }}` to submit a surrounding form, or
102
+ provide button callbacks. `disabled` disables the textarea and both actions.
103
+
104
+ ```tsx
105
+ <ArtSnowballPreloader
106
+ style={{ "--art-snowball-preloader-bg": "#101827" }}
107
+ />
108
+ <ArtGeminiInput
109
+ placeholder="Write a message"
110
+ textareaProps={{ "aria-label": "Message" }}
111
+ afterButtonProps={{ type: "submit" }}
112
+ />
113
+ ```
114
+
115
+ Animation customization stays in CSS. Moon glow, Sun rays/pulse, Atom orbits,
116
+ Eclipse layers, Mountain aurora, falling Snowflake, Cat blinking, Flower garden
117
+ growth, ColorSpin rings, and Snowball orbit have no additional React activation
118
+ API. `ArtSynthwaveStarfield paused` freezes the upstream scene animations.
119
+ `ArtPlasmaBall` provides native checkbox state through `checked`,
120
+ `defaultChecked`, `onCheckedChange`, and `inputProps`; use
121
+ `inputProps={{ disabled: true }}` to prevent activation. Its checkbox precedes
122
+ the glass ball so upstream checked/hover selectors remain effective.
123
+
71
124
  ## Development
72
125
 
73
126
  ```bash
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ function PlasmaRay({ bigwave = false }) {
115
115
  children: [
116
116
  /* @__PURE__ */ jsx("span", {}),
117
117
  /* @__PURE__ */ jsx("span", {}),
118
- /* @__PURE__ */ jsx("span", {})
118
+ !bigwave && /* @__PURE__ */ jsx("span", {})
119
119
  ]
120
120
  });
121
121
  }
@@ -124,7 +124,7 @@ function PlasmaRays({ group }) {
124
124
  return /* @__PURE__ */ jsx("div", {
125
125
  className: "rays",
126
126
  children: Array.from({ length: rayCount }, (_, index) => /* @__PURE__ */ jsx(PlasmaRay, {
127
- bigwave: group >= 4 || index % 2 === 1
127
+ bigwave: group < 4 && index % 2 === 1
128
128
  }, index))
129
129
  });
130
130
  }
@@ -249,17 +249,17 @@ var ArtCatStargazer = forwardRef(({ size = "default", decorative, className, ...
249
249
  className: "cat",
250
250
  children: [
251
251
  /* @__PURE__ */ jsx("div", {
252
- className: "bubble"
252
+ className: "tail"
253
253
  }),
254
254
  /* @__PURE__ */ jsx("div", {
255
255
  className: "backpack"
256
256
  }),
257
- /* @__PURE__ */ jsx("div", {
258
- className: "tail"
259
- }),
260
257
  /* @__PURE__ */ jsxs("div", {
261
258
  className: "body",
262
259
  children: [
260
+ /* @__PURE__ */ jsx("div", {
261
+ className: "leg"
262
+ }),
263
263
  /* @__PURE__ */ jsx("div", {
264
264
  className: "leg"
265
265
  }),
@@ -284,15 +284,18 @@ var ArtCatStargazer = forwardRef(({ size = "default", decorative, className, ...
284
284
  className: "whisker"
285
285
  }, index)),
286
286
  /* @__PURE__ */ jsx("div", {
287
- className: "nose"
287
+ className: "eye"
288
288
  }),
289
289
  /* @__PURE__ */ jsx("div", {
290
290
  className: "eye"
291
291
  }),
292
292
  /* @__PURE__ */ jsx("div", {
293
- className: "eye"
293
+ className: "nose"
294
294
  })
295
295
  ]
296
+ }),
297
+ /* @__PURE__ */ jsx("div", {
298
+ className: "bubble"
296
299
  })
297
300
  ]
298
301
  })
@@ -346,26 +349,51 @@ function FlowerGrass({ index }) {
346
349
  ]
347
350
  });
348
351
  }
352
+ var grassGrowthDelays = [
353
+ [3, 2.2, 3.4, 3.6],
354
+ [3.6, 3.8, 4, 4.2],
355
+ [4, 4.2, 4.4, 4.6],
356
+ [4, 4.2, 3, 3.6],
357
+ [4, 4.2, 3, 3.6],
358
+ [4, 4.2, 3, 3.6],
359
+ [4.2, 4.4, 4.6, 4.8],
360
+ [3, 3.2, 3.5, 3.6]
361
+ ];
362
+ function GrowingArt({
363
+ delay,
364
+ children
365
+ }) {
366
+ return /* @__PURE__ */ jsx("div", {
367
+ className: "grow-ans",
368
+ style: { "--d": `${delay}s` },
369
+ children
370
+ });
371
+ }
349
372
  function LongGrass({ index }) {
350
373
  return /* @__PURE__ */ jsx("div", {
351
374
  className: cn("long-g", `long-g--${index}`),
352
- children: Array.from({ length: 4 }, (_, leafIndex) => /* @__PURE__ */ jsx("div", {
353
- className: cn("leaf", `leaf--${leafIndex}`)
375
+ children: grassGrowthDelays[index].map((delay, leafIndex) => /* @__PURE__ */ jsx(GrowingArt, {
376
+ delay,
377
+ children: /* @__PURE__ */ jsx("div", {
378
+ className: cn("leaf", `leaf--${leafIndex}`)
379
+ })
354
380
  }, leafIndex))
355
381
  });
356
382
  }
357
383
  function FrontGrass() {
358
- return /* @__PURE__ */ jsx("div", {
384
+ return /* @__PURE__ */ jsxs("div", {
359
385
  className: "flower__g-front",
360
- children: /* @__PURE__ */ jsx("div", {
361
- className: "flower__g-front__line",
362
- children: Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx("div", {
386
+ children: [
387
+ Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx("div", {
363
388
  className: cn("flower__g-front__leaf-wrapper", `flower__g-front__leaf-wrapper--${index + 1}`),
364
389
  children: /* @__PURE__ */ jsx("div", {
365
390
  className: "flower__g-front__leaf"
366
391
  })
367
- }, index))
368
- })
392
+ }, index)),
393
+ /* @__PURE__ */ jsx("div", {
394
+ className: "flower__g-front__line"
395
+ })
396
+ ]
369
397
  });
370
398
  }
371
399
  function FrontRightGrass() {
@@ -418,50 +446,66 @@ var ArtFlowerAnimation = forwardRef(({ size = "default", decorative, className,
418
446
  /* @__PURE__ */ jsx(Flower, {
419
447
  index: 4
420
448
  }),
421
- /* @__PURE__ */ jsxs("div", {
422
- className: "growing-grass",
423
- children: [
424
- /* @__PURE__ */ jsx(FlowerGrass, {
425
- index: 1
426
- }),
427
- /* @__PURE__ */ jsx(FlowerGrass, {
428
- index: 2
429
- })
430
- ]
449
+ /* @__PURE__ */ jsx(GrowingArt, {
450
+ delay: 1.2,
451
+ children: /* @__PURE__ */ jsxs("div", {
452
+ className: "flower__g-long",
453
+ children: [
454
+ /* @__PURE__ */ jsx("div", {
455
+ className: "flower__g-long__top"
456
+ }),
457
+ /* @__PURE__ */ jsx("div", {
458
+ className: "flower__g-long__bottom"
459
+ })
460
+ ]
461
+ })
431
462
  }),
432
- /* @__PURE__ */ jsxs("div", {
433
- className: "flower__g-long",
434
- children: [
435
- /* @__PURE__ */ jsx("div", {
436
- className: "flower__g-long__top"
437
- }),
438
- /* @__PURE__ */ jsx("div", {
439
- className: "flower__g-long__bottom"
440
- })
441
- ]
463
+ /* @__PURE__ */ jsx("div", {
464
+ className: "growing-grass",
465
+ children: /* @__PURE__ */ jsx(FlowerGrass, {
466
+ index: 1
467
+ })
442
468
  }),
443
469
  /* @__PURE__ */ jsx("div", {
444
- className: "flower__g-right flower__g-right--1",
470
+ className: "growing-grass",
471
+ children: /* @__PURE__ */ jsx(FlowerGrass, {
472
+ index: 2
473
+ })
474
+ }),
475
+ /* @__PURE__ */ jsx(GrowingArt, {
476
+ delay: 2.4,
445
477
  children: /* @__PURE__ */ jsx("div", {
446
- className: "leaf"
478
+ className: "flower__g-right flower__g-right--1",
479
+ children: /* @__PURE__ */ jsx("div", {
480
+ className: "leaf"
481
+ })
447
482
  })
448
483
  }),
449
- /* @__PURE__ */ jsx("div", {
450
- className: "flower__g-right flower__g-right--2",
484
+ /* @__PURE__ */ jsx(GrowingArt, {
485
+ delay: 2.8,
451
486
  children: /* @__PURE__ */ jsx("div", {
452
- className: "leaf"
487
+ className: "flower__g-right flower__g-right--2",
488
+ children: /* @__PURE__ */ jsx("div", {
489
+ className: "leaf"
490
+ })
453
491
  })
454
492
  }),
455
- /* @__PURE__ */ jsx(FrontGrass, {}),
456
- /* @__PURE__ */ jsx(FrontRightGrass, {}),
457
- Array.from({ length: 7 }, (_, index) => /* @__PURE__ */ jsx(LongGrass, {
458
- index: index + 1
459
- }, index)),
460
- /* @__PURE__ */ jsx("div", {
461
- className: "bubbles",
462
- children: Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ jsx(Bubble, {}, index))
463
- })
493
+ /* @__PURE__ */ jsx(GrowingArt, {
494
+ delay: 2.8,
495
+ children: /* @__PURE__ */ jsx(FrontGrass, {})
496
+ }),
497
+ /* @__PURE__ */ jsx(GrowingArt, {
498
+ delay: 3.2,
499
+ children: /* @__PURE__ */ jsx(FrontRightGrass, {})
500
+ }),
501
+ grassGrowthDelays.map((_, index) => /* @__PURE__ */ jsx(LongGrass, {
502
+ index
503
+ }, index))
464
504
  ]
505
+ }),
506
+ /* @__PURE__ */ jsx("div", {
507
+ className: "bubbles",
508
+ children: Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ jsx(Bubble, {}, index))
465
509
  })
466
510
  ]
467
511
  }));
@@ -485,10 +529,10 @@ var ArtSynthwaveStarfield = forwardRef(({ size = "default", paused = false, deco
485
529
  ...props,
486
530
  children: [
487
531
  /* @__PURE__ */ jsx("div", {
488
- className: "art-synthwave-starfield-sides art-synthwave-starfield-lefrig"
532
+ className: "art-synthwave-starfield-sides art-synthwave-starfield-topbot"
489
533
  }),
490
534
  /* @__PURE__ */ jsx("div", {
491
- className: "art-synthwave-starfield-sides art-synthwave-starfield-topbot"
535
+ className: "art-synthwave-starfield-sides art-synthwave-starfield-lefrig"
492
536
  }),
493
537
  /* @__PURE__ */ jsx("div", {
494
538
  className: "art-synthwave-starfield-stars"
@@ -519,6 +563,9 @@ function SwitchBar({
519
563
  return /* @__PURE__ */ jsxs("div", {
520
564
  className: "bar",
521
565
  children: [
566
+ /* @__PURE__ */ jsx("div", {
567
+ className: "cord"
568
+ }),
522
569
  /* @__PURE__ */ jsx(SwitchButton, {
523
570
  className: "sub-lr",
524
571
  label: `${side} SL`,
@@ -529,46 +576,55 @@ function SwitchBar({
529
576
  label: `${side} SR`,
530
577
  hidden
531
578
  }),
532
- /* @__PURE__ */ jsx("span", {
533
- className: "minus-sign"
534
- }),
535
- /* @__PURE__ */ jsx("span", {
579
+ /* @__PURE__ */ jsx("div", {
536
580
  className: "peripheral"
537
581
  }),
538
- /* @__PURE__ */ jsx("span", {
539
- className: "cord"
582
+ /* @__PURE__ */ jsx("div", {
583
+ className: "minus-sign"
540
584
  })
541
585
  ]
542
586
  });
543
587
  }
544
- function SwitchConnector() {
588
+ function SwitchConnector({
589
+ side,
590
+ hidden
591
+ }) {
545
592
  return /* @__PURE__ */ jsxs("div", {
546
593
  className: "connector",
547
594
  children: [
548
- /* @__PURE__ */ jsx("div", {
595
+ /* @__PURE__ */ jsx(SwitchButton, {
549
596
  className: "con-lr",
550
- children: /* @__PURE__ */ jsx("div", {
551
- className: "con-part"
552
- })
597
+ label: `${side} connector L`,
598
+ hidden
553
599
  }),
554
- /* @__PURE__ */ jsx("div", {
600
+ /* @__PURE__ */ jsx(SwitchButton, {
555
601
  className: "con-rr",
556
- children: /* @__PURE__ */ jsx("div", {
557
- className: "con-part"
558
- })
602
+ label: `${side} connector R`,
603
+ hidden
604
+ }),
605
+ /* @__PURE__ */ jsx("div", {
606
+ className: "con-part"
559
607
  })
560
608
  ]
561
609
  });
562
610
  }
563
611
  function LeftJoycon({ hidden }) {
564
612
  return /* @__PURE__ */ jsxs("div", {
565
- className: "controller",
613
+ className: "controller left",
566
614
  children: [
567
615
  /* @__PURE__ */ jsx(SwitchBar, {
568
616
  side: "Left",
569
617
  hidden
570
618
  }),
571
- /* @__PURE__ */ jsx(SwitchConnector, {}),
619
+ /* @__PURE__ */ jsx(SwitchConnector, {
620
+ side: "Left",
621
+ hidden
622
+ }),
623
+ /* @__PURE__ */ jsx(SwitchButton, {
624
+ className: "lr",
625
+ label: "L",
626
+ hidden
627
+ }),
572
628
  /* @__PURE__ */ jsx(SwitchButton, {
573
629
  className: "minus",
574
630
  label: "Minus",
@@ -584,11 +640,6 @@ function LeftJoycon({ hidden }) {
584
640
  label: "Up",
585
641
  hidden
586
642
  }),
587
- /* @__PURE__ */ jsx(SwitchButton, {
588
- className: "direction arrow down round",
589
- label: "Down",
590
- hidden
591
- }),
592
643
  /* @__PURE__ */ jsx(SwitchButton, {
593
644
  className: "direction arrow left round",
594
645
  label: "Left",
@@ -599,6 +650,11 @@ function LeftJoycon({ hidden }) {
599
650
  label: "Right",
600
651
  hidden
601
652
  }),
653
+ /* @__PURE__ */ jsx(SwitchButton, {
654
+ className: "direction arrow down round",
655
+ label: "Down",
656
+ hidden
657
+ }),
602
658
  /* @__PURE__ */ jsx(SwitchButton, {
603
659
  className: "menu",
604
660
  label: "Capture",
@@ -615,37 +671,45 @@ function RightJoycon({ hidden }) {
615
671
  side: "Right",
616
672
  hidden
617
673
  }),
618
- /* @__PURE__ */ jsx(SwitchConnector, {}),
674
+ /* @__PURE__ */ jsx(SwitchConnector, {
675
+ side: "Right",
676
+ hidden
677
+ }),
619
678
  /* @__PURE__ */ jsx(SwitchButton, {
620
- className: "minus plus",
621
- label: "Plus",
679
+ className: "lr rr",
680
+ label: "R",
622
681
  hidden
623
682
  }),
624
683
  /* @__PURE__ */ jsx(SwitchButton, {
625
- className: "mushroom round",
626
- label: "Right stick",
684
+ className: "minus plus",
685
+ label: "Plus",
627
686
  hidden
628
687
  }),
629
688
  /* @__PURE__ */ jsx(SwitchButton, {
630
- className: "direction x round",
689
+ className: "direction up x round",
631
690
  label: "X",
632
691
  hidden
633
692
  }),
634
693
  /* @__PURE__ */ jsx(SwitchButton, {
635
- className: "direction y round",
694
+ className: "direction left y round",
636
695
  label: "Y",
637
696
  hidden
638
697
  }),
639
698
  /* @__PURE__ */ jsx(SwitchButton, {
640
- className: "direction a round",
699
+ className: "direction right a round",
641
700
  label: "A",
642
701
  hidden
643
702
  }),
644
703
  /* @__PURE__ */ jsx(SwitchButton, {
645
- className: "direction b round",
704
+ className: "direction down b round",
646
705
  label: "B",
647
706
  hidden
648
707
  }),
708
+ /* @__PURE__ */ jsx(SwitchButton, {
709
+ className: "mushroom round",
710
+ label: "Right stick",
711
+ hidden
712
+ }),
649
713
  /* @__PURE__ */ jsx(SwitchButton, {
650
714
  className: "home round",
651
715
  label: "Home",
@@ -654,24 +718,20 @@ function RightJoycon({ hidden }) {
654
718
  ]
655
719
  });
656
720
  }
657
- function SwitchBody() {
721
+ function SwitchBody({ hidden }) {
658
722
  return /* @__PURE__ */ jsxs("div", {
659
723
  className: "body",
660
724
  children: [
661
- /* @__PURE__ */ jsx("div", {
662
- className: "frame",
663
- children: /* @__PURE__ */ jsx("div", {
664
- className: "screen"
665
- })
666
- }),
667
- /* @__PURE__ */ jsx("div", {
668
- className: "lr"
725
+ /* @__PURE__ */ jsx(SwitchButton, {
726
+ className: "volume",
727
+ label: "Volume",
728
+ hidden
669
729
  }),
670
730
  /* @__PURE__ */ jsx("div", {
671
- className: "lr rr"
731
+ className: "frame"
672
732
  }),
673
733
  /* @__PURE__ */ jsx("div", {
674
- className: "volume"
734
+ className: "screen"
675
735
  })
676
736
  ]
677
737
  });
@@ -687,33 +747,38 @@ function ComfortGrip() {
687
747
  className: "grip right"
688
748
  }),
689
749
  /* @__PURE__ */ jsx("div", {
690
- className: "holder",
691
- children: /* @__PURE__ */ jsxs("div", {
692
- className: "main-frame",
693
- children: [
694
- /* @__PURE__ */ jsx("div", {
695
- className: "logo"
696
- }),
697
- /* @__PURE__ */ jsx("div", {
698
- className: "logo right"
699
- }),
700
- /* @__PURE__ */ jsx("div", {
701
- className: "nintendo",
702
- children: "NINTENDO"
703
- }),
704
- /* @__PURE__ */ jsx("div", {
705
- className: "switch",
706
- children: "SWITCH"
707
- }),
708
- Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx("div", {
709
- className: "light"
710
- }, index))
711
- ]
712
- })
750
+ className: "holder"
713
751
  })
714
752
  ]
715
753
  });
716
754
  }
755
+ function ComfortGripBack() {
756
+ return /* @__PURE__ */ jsx("div", {
757
+ className: "comfort-grip",
758
+ children: /* @__PURE__ */ jsxs("div", {
759
+ className: "main-frame",
760
+ children: [
761
+ Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx("div", {
762
+ className: "light"
763
+ }, index)),
764
+ /* @__PURE__ */ jsx("div", {
765
+ className: "logo"
766
+ }),
767
+ /* @__PURE__ */ jsx("div", {
768
+ className: "logo right"
769
+ }),
770
+ /* @__PURE__ */ jsx("div", {
771
+ className: "nintendo",
772
+ children: "NINTENDO"
773
+ }),
774
+ /* @__PURE__ */ jsx("div", {
775
+ className: "switch",
776
+ children: "SWITCH"
777
+ })
778
+ ]
779
+ })
780
+ });
781
+ }
717
782
  var ArtCsswitch = forwardRef(({ size = "default", decorative = false, className, ...props }, ref) => {
718
783
  const decorativeProps = getDecorativeProps(decorative, props);
719
784
  const rootAriaHidden = props["aria-hidden"] ?? ("aria-hidden" in decorativeProps ? decorativeProps["aria-hidden"] : undefined);
@@ -724,14 +789,17 @@ var ArtCsswitch = forwardRef(({ size = "default", decorative = false, className,
724
789
  ...decorativeProps,
725
790
  ...props,
726
791
  children: [
727
- /* @__PURE__ */ jsx(SwitchBody, {}),
728
792
  /* @__PURE__ */ jsx(ComfortGrip, {}),
729
793
  /* @__PURE__ */ jsx(LeftJoycon, {
730
794
  hidden: controlsAreHidden
731
795
  }),
732
796
  /* @__PURE__ */ jsx(RightJoycon, {
733
797
  hidden: controlsAreHidden
734
- })
798
+ }),
799
+ /* @__PURE__ */ jsx(SwitchBody, {
800
+ hidden: controlsAreHidden
801
+ }),
802
+ /* @__PURE__ */ jsx(ComfortGripBack, {})
735
803
  ]
736
804
  });
737
805
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duskmoon-dev/art-components",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "React components for @duskmoon-dev/css-art pure CSS illustrations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "react-dom": ">=19.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@duskmoon-dev/css-art": "1.20.5",
52
+ "@duskmoon-dev/css-art": "1.20.7",
53
53
  "@testing-library/react": "16.3.2",
54
54
  "@types/react": "19.2.18",
55
55
  "@types/react-dom": "19.2.4",