@lacspace/og 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -298,7 +298,515 @@ function ogSvg(options) {
298
298
  function ogSvgDataUri(options) {
299
299
  return `data:image/svg+xml;utf8,${encodeURIComponent(ogSvg(options))}`;
300
300
  }
301
+ var ogThemes = {
302
+ lacspace: { from: "#22d3ee", to: "#6366f1" },
303
+ ocean: { from: "#0ea5e9", to: "#2563eb" },
304
+ sunset: { from: "#f43f5e", to: "#f59e0b" },
305
+ forest: { from: "#10b981", to: "#065f46" },
306
+ grape: { from: "#a855f7", to: "#6366f1" },
307
+ slate: { from: "#94a3b8", to: "#1e293b" }
308
+ };
309
+ function withGradient(o) {
310
+ if (o.gradient && ogThemes[o.gradient]) {
311
+ const g = ogThemes[o.gradient];
312
+ return { ...o, from: o.from ?? g.from, to: o.to ?? g.to };
313
+ }
314
+ return o;
315
+ }
316
+ function glowLayer(r, p) {
317
+ return el("div", {
318
+ position: "absolute",
319
+ top: `-${Math.round(r.height * 0.35)}px`,
320
+ right: `-${Math.round(r.width * 0.18)}px`,
321
+ width: `${Math.round(r.width * 0.55)}px`,
322
+ height: `${Math.round(r.width * 0.55)}px`,
323
+ borderRadius: "9999px",
324
+ background: `linear-gradient(135deg, ${p.from}, ${p.to})`,
325
+ opacity: r.theme === "dark" ? "0.22" : "0.16",
326
+ filter: "blur(20px)"
327
+ });
328
+ }
329
+ function patternLayer(kind, r, p, over = "ground") {
330
+ const k = kind ?? "none";
331
+ if (k === "none") return null;
332
+ if (k === "glow") {
333
+ if (over === "gradient") {
334
+ return el("div", {
335
+ position: "absolute",
336
+ top: "0",
337
+ left: "0",
338
+ width: "100%",
339
+ height: "100%",
340
+ background: "radial-gradient(circle at 82% 12%, rgba(255,255,255,0.28), transparent 55%)"
341
+ });
342
+ }
343
+ return glowLayer(r, p);
344
+ }
345
+ const dot = over === "gradient" ? "rgba(255,255,255,0.16)" : r.theme === "dark" ? "rgba(255,255,255,0.10)" : "rgba(10,10,15,0.08)";
346
+ return el("div", {
347
+ position: "absolute",
348
+ top: "0",
349
+ left: "0",
350
+ width: "100%",
351
+ height: "100%",
352
+ backgroundImage: `radial-gradient(${dot} 2px, transparent 2px)`,
353
+ backgroundSize: "44px 44px"
354
+ });
355
+ }
356
+ function eyebrowNode(text, color) {
357
+ return el(
358
+ "div",
359
+ {
360
+ display: "flex",
361
+ fontSize: "26px",
362
+ fontWeight: 600,
363
+ letterSpacing: "0.12em",
364
+ textTransform: "uppercase",
365
+ color
366
+ },
367
+ text.toUpperCase()
368
+ );
369
+ }
370
+ function badgeNode(text, p) {
371
+ return el(
372
+ "div",
373
+ {
374
+ display: "flex",
375
+ alignItems: "center",
376
+ padding: "8px 20px",
377
+ borderRadius: "9999px",
378
+ fontSize: "24px",
379
+ fontWeight: 700,
380
+ color: p.fg,
381
+ background: `linear-gradient(90deg, ${p.from}33, ${p.to}33)`,
382
+ border: `1px solid ${p.border}`
383
+ },
384
+ text
385
+ );
386
+ }
387
+ function ogCardSplit(options) {
388
+ const r = resolve(withGradient(options));
389
+ const p = palette(r);
390
+ const pad = Math.round(r.width * 0.065);
391
+ const titleSize = fitFontSize(r.title, { max: 68, min: 40 });
392
+ const leftChildren = [];
393
+ if (r.eyebrow) leftChildren.push(eyebrowNode(r.eyebrow, p.from));
394
+ leftChildren.push(
395
+ el(
396
+ "div",
397
+ {
398
+ display: "flex",
399
+ fontSize: `${titleSize}px`,
400
+ fontWeight: 800,
401
+ lineHeight: 1.05,
402
+ letterSpacing: "-0.02em",
403
+ color: p.fg
404
+ },
405
+ r.title
406
+ )
407
+ );
408
+ if (r.subtitle) {
409
+ leftChildren.push(
410
+ el(
411
+ "div",
412
+ { display: "flex", fontSize: "32px", fontWeight: 500, color: p.muted },
413
+ r.subtitle
414
+ )
415
+ );
416
+ }
417
+ if (r.badge) leftChildren.push(badgeNode(r.badge, p));
418
+ const left = el(
419
+ "div",
420
+ {
421
+ display: "flex",
422
+ flexDirection: "column",
423
+ justifyContent: "center",
424
+ gap: "24px",
425
+ width: "62%",
426
+ height: "100%",
427
+ padding: `${pad}px`
428
+ },
429
+ leftChildren
430
+ );
431
+ const mark = r.logo ?? (r.title.trim().charAt(0).toUpperCase() || "\u2022");
432
+ const right = el(
433
+ "div",
434
+ {
435
+ display: "flex",
436
+ alignItems: "center",
437
+ justifyContent: "center",
438
+ width: "38%",
439
+ height: "100%",
440
+ background: `linear-gradient(135deg, ${p.from}, ${p.to})`
441
+ },
442
+ [
443
+ el(
444
+ "div",
445
+ { display: "flex", fontSize: "220px", fontWeight: 800, color: "#0a0a0f" },
446
+ mark
447
+ )
448
+ ]
449
+ );
450
+ const children = [];
451
+ const pat = patternLayer(options.pattern, r, p);
452
+ if (pat) children.push(pat);
453
+ children.push(left, right);
454
+ if (r.footer) {
455
+ children.push(
456
+ el(
457
+ "div",
458
+ {
459
+ position: "absolute",
460
+ bottom: `${Math.round(pad * 0.7)}px`,
461
+ left: `${pad}px`,
462
+ display: "flex",
463
+ fontSize: "26px",
464
+ fontWeight: 500,
465
+ color: p.muted
466
+ },
467
+ r.footer
468
+ )
469
+ );
470
+ }
471
+ return el(
472
+ "div",
473
+ {
474
+ position: "relative",
475
+ display: "flex",
476
+ flexDirection: "row",
477
+ width: "100%",
478
+ height: "100%",
479
+ background: p.bg,
480
+ color: p.fg,
481
+ fontFamily: "sans-serif"
482
+ },
483
+ children
484
+ );
485
+ }
486
+ function ogCardMinimal(options) {
487
+ const r = resolve(withGradient(options));
488
+ const p = palette(r);
489
+ const pad = Math.round(r.width * 0.09);
490
+ const titleSize = fitFontSize(r.title, { max: 96, min: 52 });
491
+ const center = [];
492
+ if (r.eyebrow) {
493
+ center.push(
494
+ el(
495
+ "div",
496
+ {
497
+ display: "flex",
498
+ fontSize: "28px",
499
+ fontWeight: 600,
500
+ letterSpacing: "0.16em",
501
+ textTransform: "uppercase",
502
+ color: "rgba(255,255,255,0.85)"
503
+ },
504
+ r.eyebrow.toUpperCase()
505
+ )
506
+ );
507
+ }
508
+ center.push(
509
+ el(
510
+ "div",
511
+ {
512
+ display: "flex",
513
+ fontSize: `${titleSize}px`,
514
+ fontWeight: 800,
515
+ lineHeight: 1.04,
516
+ letterSpacing: "-0.02em",
517
+ color: "#ffffff",
518
+ textAlign: "center"
519
+ },
520
+ r.title
521
+ )
522
+ );
523
+ if (r.subtitle) {
524
+ center.push(
525
+ el(
526
+ "div",
527
+ {
528
+ display: "flex",
529
+ fontSize: "34px",
530
+ fontWeight: 500,
531
+ color: "rgba(255,255,255,0.82)",
532
+ textAlign: "center"
533
+ },
534
+ r.subtitle
535
+ )
536
+ );
537
+ }
538
+ const children = [];
539
+ const pat = patternLayer(options.pattern, r, p, "gradient");
540
+ if (pat) children.push(pat);
541
+ children.push(
542
+ el(
543
+ "div",
544
+ {
545
+ display: "flex",
546
+ flexDirection: "column",
547
+ alignItems: "center",
548
+ justifyContent: "center",
549
+ gap: "28px",
550
+ width: "100%",
551
+ height: "100%",
552
+ padding: `${pad}px`
553
+ },
554
+ center
555
+ )
556
+ );
557
+ if (r.footer) {
558
+ children.push(
559
+ el(
560
+ "div",
561
+ {
562
+ position: "absolute",
563
+ bottom: `${Math.round(r.height * 0.06)}px`,
564
+ left: "0",
565
+ width: "100%",
566
+ display: "flex",
567
+ justifyContent: "center",
568
+ fontSize: "26px",
569
+ fontWeight: 500,
570
+ color: "rgba(255,255,255,0.78)"
571
+ },
572
+ r.footer
573
+ )
574
+ );
575
+ }
576
+ return el(
577
+ "div",
578
+ {
579
+ position: "relative",
580
+ display: "flex",
581
+ width: "100%",
582
+ height: "100%",
583
+ background: `linear-gradient(135deg, ${p.from}, ${p.to})`,
584
+ color: "#ffffff",
585
+ fontFamily: "sans-serif"
586
+ },
587
+ children
588
+ );
589
+ }
590
+ function metaDot(color) {
591
+ return el(
592
+ "div",
593
+ { display: "flex", fontSize: "26px", color, opacity: "0.6" },
594
+ "\xB7"
595
+ );
596
+ }
597
+ function ogArticle(options) {
598
+ const r = resolve(withGradient(options));
599
+ const p = palette(r);
600
+ const pad = Math.round(r.width * 0.075);
601
+ const titleSize = fitFontSize(r.title, { max: 74, min: 40 });
602
+ const accentBar = el("div", {
603
+ position: "absolute",
604
+ top: "0",
605
+ left: "0",
606
+ width: "100%",
607
+ height: `${Math.round(r.height * 0.02)}px`,
608
+ background: `linear-gradient(90deg, ${p.from}, ${p.to})`
609
+ });
610
+ const header = el(
611
+ "div",
612
+ {
613
+ display: "flex",
614
+ alignItems: "center",
615
+ justifyContent: "space-between",
616
+ width: "100%"
617
+ },
618
+ [
619
+ r.eyebrow ? eyebrowNode(r.eyebrow, p.from) : el("div", { display: "flex" }, ""),
620
+ r.logo ? el(
621
+ "div",
622
+ {
623
+ display: "flex",
624
+ alignItems: "center",
625
+ justifyContent: "center",
626
+ width: "72px",
627
+ height: "72px",
628
+ borderRadius: "18px",
629
+ fontSize: "38px",
630
+ fontWeight: 800,
631
+ color: "#0a0a0f",
632
+ background: `linear-gradient(135deg, ${p.from}, ${p.to})`
633
+ },
634
+ r.logo
635
+ ) : el("div", { display: "flex" }, "")
636
+ ]
637
+ );
638
+ const title = el(
639
+ "div",
640
+ {
641
+ display: "flex",
642
+ fontSize: `${titleSize}px`,
643
+ fontWeight: 800,
644
+ lineHeight: 1.06,
645
+ letterSpacing: "-0.02em",
646
+ color: p.fg
647
+ },
648
+ r.title
649
+ );
650
+ const metaItems = [];
651
+ if (options.author) {
652
+ metaItems.push(
653
+ el(
654
+ "div",
655
+ { display: "flex", fontSize: "28px", fontWeight: 700, color: p.fg },
656
+ options.author
657
+ )
658
+ );
659
+ }
660
+ const muted = (t) => el(
661
+ "div",
662
+ { display: "flex", fontSize: "26px", fontWeight: 500, color: p.muted },
663
+ t
664
+ );
665
+ if (options.date) {
666
+ if (metaItems.length) metaItems.push(metaDot(p.muted));
667
+ metaItems.push(muted(options.date));
668
+ }
669
+ if (options.readingTime) {
670
+ if (metaItems.length) metaItems.push(metaDot(p.muted));
671
+ metaItems.push(muted(options.readingTime));
672
+ }
673
+ const footerRow = metaItems.length ? el(
674
+ "div",
675
+ { display: "flex", alignItems: "center", gap: "16px" },
676
+ metaItems
677
+ ) : r.footer ? muted(r.footer) : el("div", { display: "flex" }, "");
678
+ const children = [accentBar];
679
+ const pat = patternLayer(options.pattern, r, p);
680
+ if (pat) children.push(pat);
681
+ children.push(
682
+ header,
683
+ el("div", { display: "flex", flexDirection: "column" }, [title]),
684
+ footerRow
685
+ );
686
+ return el(
687
+ "div",
688
+ {
689
+ position: "relative",
690
+ display: "flex",
691
+ flexDirection: "column",
692
+ justifyContent: "space-between",
693
+ width: "100%",
694
+ height: "100%",
695
+ padding: `${pad}px`,
696
+ background: p.bg,
697
+ color: p.fg,
698
+ fontFamily: "sans-serif"
699
+ },
700
+ children
701
+ );
702
+ }
703
+ function ogProduct(options) {
704
+ const r = resolve(withGradient(options));
705
+ const p = palette(r);
706
+ const pad = Math.round(r.width * 0.075);
707
+ const titleSize = fitFontSize(r.title, { max: 76, min: 42 });
708
+ const header = el(
709
+ "div",
710
+ {
711
+ display: "flex",
712
+ alignItems: "center",
713
+ justifyContent: "space-between",
714
+ width: "100%"
715
+ },
716
+ [
717
+ r.badge ? badgeNode(r.badge, p) : el("div", { display: "flex" }, ""),
718
+ r.logo ? el(
719
+ "div",
720
+ {
721
+ display: "flex",
722
+ alignItems: "center",
723
+ justifyContent: "center",
724
+ width: "76px",
725
+ height: "76px",
726
+ borderRadius: "20px",
727
+ fontSize: "40px",
728
+ fontWeight: 800,
729
+ color: "#0a0a0f",
730
+ background: `linear-gradient(135deg, ${p.from}, ${p.to})`
731
+ },
732
+ r.logo
733
+ ) : el("div", { display: "flex" }, "")
734
+ ]
735
+ );
736
+ const body = [
737
+ el(
738
+ "div",
739
+ {
740
+ display: "flex",
741
+ fontSize: `${titleSize}px`,
742
+ fontWeight: 800,
743
+ lineHeight: 1.05,
744
+ letterSpacing: "-0.02em",
745
+ color: p.fg
746
+ },
747
+ r.title
748
+ )
749
+ ];
750
+ if (r.subtitle) {
751
+ body.push(
752
+ el(
753
+ "div",
754
+ {
755
+ display: "flex",
756
+ marginTop: "22px",
757
+ fontSize: "32px",
758
+ fontWeight: 500,
759
+ color: p.muted
760
+ },
761
+ r.subtitle
762
+ )
763
+ );
764
+ }
765
+ const priceStr = options.price === void 0 || options.price === null ? void 0 : `${options.currency ?? ""}${options.price}`;
766
+ const priceNode = priceStr ? el(
767
+ "div",
768
+ {
769
+ display: "flex",
770
+ alignItems: "center",
771
+ fontSize: "88px",
772
+ fontWeight: 800,
773
+ letterSpacing: "-0.02em",
774
+ background: `linear-gradient(90deg, ${p.from}, ${p.to})`,
775
+ backgroundClip: "text",
776
+ color: "transparent"
777
+ },
778
+ priceStr
779
+ ) : r.footer ? el(
780
+ "div",
781
+ { display: "flex", fontSize: "26px", fontWeight: 500, color: p.muted },
782
+ r.footer
783
+ ) : el("div", { display: "flex" }, "");
784
+ const children = [];
785
+ const pat = patternLayer(options.pattern, r, p);
786
+ if (pat) children.push(pat);
787
+ children.push(
788
+ header,
789
+ el("div", { display: "flex", flexDirection: "column" }, body),
790
+ priceNode
791
+ );
792
+ return el(
793
+ "div",
794
+ {
795
+ position: "relative",
796
+ display: "flex",
797
+ flexDirection: "column",
798
+ justifyContent: "space-between",
799
+ width: "100%",
800
+ height: "100%",
801
+ padding: `${pad}px`,
802
+ background: p.bg,
803
+ color: p.fg,
804
+ fontFamily: "sans-serif"
805
+ },
806
+ children
807
+ );
808
+ }
301
809
 
302
- export { fitFontSize, ogCard, ogSvg, ogSvgDataUri };
810
+ export { fitFontSize, ogArticle, ogCard, ogCardMinimal, ogCardSplit, ogProduct, ogSvg, ogSvgDataUri, ogThemes };
303
811
  //# sourceMappingURL=index.js.map
304
812
  //# sourceMappingURL=index.js.map