semajsx 0.5.2 → 0.6.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.
Files changed (67) hide show
  1. package/dist/client-CButR91p.mjs +740 -0
  2. package/dist/client-CButR91p.mjs.map +1 -0
  3. package/dist/dom/index.d.mts +2 -2
  4. package/dist/dom/jsx-dev-runtime.d.mts +3 -3
  5. package/dist/dom/jsx-runtime.d.mts +3 -3
  6. package/dist/{helpers-CfRDJgcP.d.mts → helpers-C8GKdDrJ.d.mts} +3 -3
  7. package/dist/{helpers-CfRDJgcP.d.mts.map → helpers-C8GKdDrJ.d.mts.map} +1 -1
  8. package/dist/{index-Ch9GwToI.d.mts → index-D_FIlSk3.d.mts} +3 -3
  9. package/dist/{index-Ch9GwToI.d.mts.map → index-D_FIlSk3.d.mts.map} +1 -1
  10. package/dist/{index-B1pjI-Su.d.mts → index-PYr1aNIz.d.mts} +2 -2
  11. package/dist/{index-B1pjI-Su.d.mts.map → index-PYr1aNIz.d.mts.map} +1 -1
  12. package/dist/index.d.mts +6 -6
  13. package/dist/{island-marker-BJIO07Vj.d.mts → island-marker-Dne5tuWe.d.mts} +1 -1
  14. package/dist/island-marker-Dne5tuWe.d.mts.map +1 -0
  15. package/dist/{jsx-fNlLjLou.d.mts → jsx-CFnuxPMI.d.mts} +2 -2
  16. package/dist/{jsx-fNlLjLou.d.mts.map → jsx-CFnuxPMI.d.mts.map} +1 -1
  17. package/dist/{jsx-runtime-BFuFPDzn.d.mts → jsx-runtime-Dc77fsnM.d.mts} +3 -3
  18. package/dist/{jsx-runtime-BFuFPDzn.d.mts.map → jsx-runtime-Dc77fsnM.d.mts.map} +1 -1
  19. package/dist/{jsx-runtime-BBi9E0Hz.d.mts → jsx-runtime-tIuFmhTh.d.mts} +4 -4
  20. package/dist/{jsx-runtime-BBi9E0Hz.d.mts.map → jsx-runtime-tIuFmhTh.d.mts.map} +1 -1
  21. package/dist/{lucide-CVtHepGM.mjs → lucide-C5BghhSl.mjs} +1 -1
  22. package/dist/{lucide-CVtHepGM.mjs.map → lucide-C5BghhSl.mjs.map} +1 -1
  23. package/dist/{resource-BQI6AeJ0.d.mts → resource-CNwiNxJX.d.mts} +2 -2
  24. package/dist/{resource-BQI6AeJ0.d.mts.map → resource-CNwiNxJX.d.mts.map} +1 -1
  25. package/dist/signal/index.d.mts +2 -2
  26. package/dist/{signal-BwxUlXKs.d.mts → signal-BcaF-fWG.d.mts} +1 -1
  27. package/dist/{signal-BwxUlXKs.d.mts.map → signal-BcaF-fWG.d.mts.map} +1 -1
  28. package/dist/{src-L88LbwEv.mjs → src-75qcxwT_.mjs} +2 -2
  29. package/dist/{src-L88LbwEv.mjs.map → src-75qcxwT_.mjs.map} +1 -1
  30. package/dist/{src-DuSN6go_.mjs → src-B4VBiHa8.mjs} +116 -4
  31. package/dist/src-B4VBiHa8.mjs.map +1 -0
  32. package/dist/ssg/index.d.mts +2 -2
  33. package/dist/ssg/index.mjs +2 -2
  34. package/dist/ssg/plugins/docs-theme.d.mts +7 -4
  35. package/dist/ssg/plugins/docs-theme.d.mts.map +1 -1
  36. package/dist/ssg/plugins/docs-theme.mjs +170 -46
  37. package/dist/ssg/plugins/docs-theme.mjs.map +1 -1
  38. package/dist/ssg/plugins/fonts/MAPLE_MONO_LICENSE.txt +93 -0
  39. package/dist/ssg/plugins/fonts/MapleMono-NF-CN-Regular.woff2 +0 -0
  40. package/dist/ssg/plugins/lucide.d.mts +2 -2
  41. package/dist/ssg/plugins/lucide.mjs +1 -1
  42. package/dist/ssr/client.d.mts +7 -6
  43. package/dist/ssr/client.d.mts.map +1 -1
  44. package/dist/ssr/client.mjs +4 -682
  45. package/dist/ssr/index.d.mts +2 -2
  46. package/dist/ssr/index.d.mts.map +1 -1
  47. package/dist/ssr/index.mjs +1 -1
  48. package/dist/style/index.d.mts +2 -2
  49. package/dist/style/react.d.mts +2 -2
  50. package/dist/style/vue.d.mts +2 -2
  51. package/dist/terminal/index.d.mts +4 -4
  52. package/dist/terminal/jsx-dev-runtime.d.mts +4 -4
  53. package/dist/terminal/jsx-runtime.d.mts +4 -4
  54. package/dist/{types-D0jRO840.d.mts → types-Bj5q5x2Q.d.mts} +1 -1
  55. package/dist/{types-D0jRO840.d.mts.map → types-Bj5q5x2Q.d.mts.map} +1 -1
  56. package/dist/{types-C9fiRu6l.d.mts → types-BmDIxXiP.d.mts} +2 -2
  57. package/dist/{types-C9fiRu6l.d.mts.map → types-BmDIxXiP.d.mts.map} +1 -1
  58. package/dist/{types-CZMcXQTW.d.mts → types-C83YtOen.d.mts} +2 -2
  59. package/dist/{types-CZMcXQTW.d.mts.map → types-C83YtOen.d.mts.map} +1 -1
  60. package/dist/{types-BlaUrkq0.d.mts → types-CVPg8ByY.d.mts} +2 -2
  61. package/dist/{types-BlaUrkq0.d.mts.map → types-CVPg8ByY.d.mts.map} +1 -1
  62. package/dist/{types-DucvOZQ2.d.mts → types-ii0bAipe.d.mts} +2 -2
  63. package/dist/{types-DucvOZQ2.d.mts.map → types-ii0bAipe.d.mts.map} +1 -1
  64. package/package.json +2 -2
  65. package/dist/island-marker-BJIO07Vj.d.mts.map +0 -1
  66. package/dist/src-DuSN6go_.mjs.map +0 -1
  67. package/dist/ssr/client.mjs.map +0 -1
@@ -1,17 +1,22 @@
1
- import { d as defineCollection, v as __exportAll } from "../../src-L88LbwEv.mjs";
1
+ import { d as defineCollection, v as __exportAll } from "../../src-75qcxwT_.mjs";
2
+ import { t as signal } from "../../signal-BN8vHXDb.mjs";
2
3
  import { a as jsxs, i as jsx, v as Fragment } from "../../src-DW3tIczg.mjs";
3
4
  import "../../src-BqX3sryB.mjs";
4
5
  import { G as rules, K as classes, M as createTheme, N as defineTokens, U as isStyleToken, W as rule } from "../../src-Ds9vl42d.mjs";
5
6
  import "../../jsx-runtime-D9ZNjMJ2.mjs";
6
7
  import "../../src-DUpFNNM_.mjs";
7
8
  import "../../jsx-runtime-BjCGsceN.mjs";
8
- import "../../resource-DSlXDZZi.mjs";
9
- import "../../src-DuSN6go_.mjs";
9
+ import { d as island } from "../../resource-DSlXDZZi.mjs";
10
+ import "../../src-B4VBiHa8.mjs";
10
11
  import "../../document-BOJDaiBc.mjs";
11
- import { n as Icon, t as lucide } from "../../lucide-CVtHepGM.mjs";
12
+ import "../../client-CButR91p.mjs";
13
+ import { n as Icon, t as lucide } from "../../lucide-C5BghhSl.mjs";
12
14
  import { dirname, join } from "path";
13
15
  import { mkdir, writeFile } from "fs/promises";
14
16
  import { z } from "zod";
17
+ import { copyFile, mkdir as mkdir$1 } from "node:fs/promises";
18
+ import { dirname as dirname$1, join as join$1 } from "node:path";
19
+ import { fileURLToPath } from "node:url";
15
20
  import remarkGfm from "remark-gfm";
16
21
 
17
22
  //#region ../ssg/src/plugins/docs-theme/styles.ts
@@ -37,6 +42,18 @@ const THEME_CSS = `
37
42
  to { opacity: 1; transform: scale(1) translateY(0); }
38
43
  }
39
44
 
45
+ /* ==============================================
46
+ * Font Face
47
+ * ============================================== */
48
+
49
+ @font-face {
50
+ font-family: "Maple Mono NF CN";
51
+ src: url("/fonts/MapleMono-NF-CN-Regular.woff2") format("woff2");
52
+ font-weight: 400;
53
+ font-style: normal;
54
+ font-display: swap;
55
+ }
56
+
40
57
  /* ==============================================
41
58
  * Global Reset & Base
42
59
  * ============================================== */
@@ -447,7 +464,7 @@ body {
447
464
  background: rgba(0, 0, 0, 0.04);
448
465
  padding: 0.15rem 0.4rem;
449
466
  border-radius: 5px;
450
- font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
467
+ font-family: "Maple Mono NF CN", "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
451
468
  font-size: 0.875em;
452
469
  color: #1d1d1f;
453
470
  border: 0.5px solid rgba(0, 0, 0, 0.06);
@@ -505,15 +522,18 @@ body {
505
522
 
506
523
  /* Tables */
507
524
 
525
+ .dt-table-wrapper {
526
+ margin: 1.5rem 0;
527
+ border-radius: 10px;
528
+ border: 0.5px solid rgba(0, 0, 0, 0.08);
529
+ overflow: hidden;
530
+ }
531
+
508
532
  .dt-content table {
509
533
  width: 100%;
510
534
  border-collapse: collapse;
511
- margin: 1.5rem 0;
512
535
  font-size: 0.9375rem;
513
536
  line-height: 1.5;
514
- border-radius: 10px;
515
- overflow: hidden;
516
- border: 0.5px solid rgba(0, 0, 0, 0.08);
517
537
  }
518
538
 
519
539
  .dt-content thead {
@@ -545,11 +565,36 @@ body {
545
565
  background: rgba(0, 0, 0, 0.02);
546
566
  }
547
567
 
568
+ /* Table scrollbar styling */
569
+ .dt-table-wrapper {
570
+ scrollbar-width: thin;
571
+ scrollbar-color: rgba(0, 0, 0, 0.12) rgba(0, 0, 0, 0.02);
572
+ }
573
+
574
+ .dt-table-wrapper::-webkit-scrollbar {
575
+ height: 6px;
576
+ }
577
+
578
+ .dt-table-wrapper::-webkit-scrollbar-track {
579
+ background: rgba(0, 0, 0, 0.02);
580
+ border-radius: 3px;
581
+ }
582
+
583
+ .dt-table-wrapper::-webkit-scrollbar-thumb {
584
+ background: rgba(0, 0, 0, 0.12);
585
+ border-radius: 3px;
586
+ }
587
+
588
+ .dt-table-wrapper::-webkit-scrollbar-thumb:hover {
589
+ background: rgba(0, 0, 0, 0.2);
590
+ }
591
+
548
592
  /* ==============================================
549
593
  * Code Blocks
550
594
  * ============================================== */
551
595
 
552
596
  .dt-code-block {
597
+ position: relative;
553
598
  margin: 1.5rem 0;
554
599
  border-radius: 12px;
555
600
  overflow: hidden;
@@ -557,52 +602,34 @@ body {
557
602
  }
558
603
 
559
604
  .dt-code-header {
560
- background: #161617;
561
- padding: 0.5rem 1.25rem;
562
- display: flex;
563
- justify-content: space-between;
564
- align-items: center;
605
+ position: absolute;
606
+ top: 0;
607
+ right: 0;
608
+ padding: 0.625rem 1rem;
609
+ z-index: 1;
610
+ pointer-events: none;
611
+ background: linear-gradient(to left, rgba(34, 39, 46, 0.95) 70%, transparent);
612
+ padding-left: 2rem;
565
613
  }
566
614
 
567
615
  .dt-code-lang {
568
- color: #86868b;
616
+ color: #636e7b;
569
617
  font-size: 0.6875rem;
570
618
  text-transform: uppercase;
571
619
  font-weight: 600;
572
620
  letter-spacing: 0.04em;
621
+ user-select: none;
573
622
  }
574
623
 
575
624
  .dt-code-block pre {
576
625
  margin: 0;
577
626
  border-radius: 0;
578
627
  border: none;
579
- }
580
-
581
- .dt-code-header + pre {
582
- border-radius: 0;
628
+ padding-top: 2.25rem;
583
629
  }
584
630
 
585
631
  /* Shiki integration */
586
632
 
587
- .dt-content pre.shiki {
588
- position: relative;
589
- padding: 2.25rem 1.5rem 1.25rem;
590
- }
591
-
592
- .dt-content pre.shiki[data-language]::before {
593
- content: attr(data-language);
594
- position: absolute;
595
- top: 0.625rem;
596
- right: 1rem;
597
- color: #636e7b;
598
- font-size: 0.6875rem;
599
- text-transform: uppercase;
600
- font-weight: 600;
601
- letter-spacing: 0.04em;
602
- pointer-events: none;
603
- user-select: none;
604
- }
605
-
606
633
  .dt-content pre.shiki code {
607
634
  display: block;
608
635
  }
@@ -611,6 +638,15 @@ body {
611
638
  display: inline;
612
639
  }
613
640
 
641
+ /* ==============================================
642
+ * Tabs interactivity (aria-selected)
643
+ * ============================================== */
644
+
645
+ [role="tab"][aria-selected="true"] {
646
+ color: #0071e3;
647
+ border-bottom-color: #0071e3;
648
+ }
649
+
614
650
  /* ==============================================
615
651
  * 404 Page
616
652
  * ============================================== */
@@ -717,14 +753,28 @@ body {
717
753
  .dt-content pre { padding: 1rem; font-size: 0.8125rem; border-radius: 10px; }
718
754
  .dt-content ul, .dt-content ol { margin-left: 1.25rem; }
719
755
 
720
- .dt-content table {
721
- font-size: 0.8125rem;
722
- display: block;
756
+ .dt-table-wrapper {
723
757
  overflow-x: auto;
724
758
  -webkit-overflow-scrolling: touch;
759
+ border-radius: 8px;
725
760
  }
726
761
 
727
- .dt-content th, .dt-content td { padding: 0.625rem 0.75rem; }
762
+ .dt-content table {
763
+ font-size: 0.8125rem;
764
+ }
765
+
766
+ .dt-content th {
767
+ padding: 0.5rem 0.75rem;
768
+ font-size: 0.75rem;
769
+ }
770
+
771
+ .dt-content td {
772
+ padding: 0.5rem 0.75rem;
773
+ }
774
+
775
+ .dt-content td:first-child {
776
+ font-weight: 500;
777
+ }
728
778
 
729
779
  .dt-code-block { border-radius: 10px; }
730
780
  .dt-code-header { padding: 0.375rem 1rem; }
@@ -766,6 +816,10 @@ body {
766
816
  pointer-events: none;
767
817
  }
768
818
 
819
+ .dt-preview-box.dt-preview-interactive > * {
820
+ pointer-events: auto;
821
+ }
822
+
769
823
  .dt-preview-box::before {
770
824
  content: "";
771
825
  position: absolute;
@@ -1378,10 +1432,39 @@ const panel = rule`${c$8.panel} {
1378
1432
 
1379
1433
  //#endregion
1380
1434
  //#region ../ui/src/components/tabs/tabs.tsx
1435
+ /**
1436
+ * Module-level state for SSR initial rendering.
1437
+ *
1438
+ * Set by `Tabs` before returning JSX; read by `Tab` / `TabPanel` when they
1439
+ * render during the same synchronous (or awaited) SSR pass. This lets the
1440
+ * server output include the correct `aria-selected` and `hidden` attributes
1441
+ * so the page is styled correctly before any JS loads.
1442
+ *
1443
+ * On the client the `ref` callback in `Tabs` immediately overwrites these
1444
+ * attributes once the component mounts, so the initial values are harmless.
1445
+ */
1446
+ let _ssrDefaultTab;
1381
1447
  function Tabs(props) {
1448
+ const active = signal(props.defaultValue);
1449
+ _ssrDefaultTab = props.defaultValue;
1382
1450
  return /* @__PURE__ */ jsx("div", {
1383
1451
  class: [root$8, props.class],
1384
- "data-tabs": props.defaultValue,
1452
+ "data-tabs": active,
1453
+ onClick: (e) => {
1454
+ const tab = e.target.closest("[role=tab]");
1455
+ if (!tab) return;
1456
+ const value = tab.getAttribute("data-tab-value");
1457
+ if (value) active.value = value;
1458
+ },
1459
+ ref: (el) => {
1460
+ if (!el) return;
1461
+ const sync = (value) => {
1462
+ for (const t of el.querySelectorAll("[role=tab]")) t.setAttribute("aria-selected", String(t.getAttribute("data-tab-value") === value));
1463
+ for (const p of el.querySelectorAll("[role=tabpanel]")) p.hidden = p.getAttribute("data-tab-panel") !== value;
1464
+ };
1465
+ sync(active.value);
1466
+ active.subscribe(sync);
1467
+ },
1385
1468
  children: props.children
1386
1469
  });
1387
1470
  }
@@ -1401,14 +1484,17 @@ function Tab(props) {
1401
1484
  ],
1402
1485
  role: "tab",
1403
1486
  "data-tab-value": props.value,
1487
+ "aria-selected": _ssrDefaultTab !== void 0 ? props.value === _ssrDefaultTab ? "true" : "false" : void 0,
1404
1488
  children: props.children
1405
1489
  });
1406
1490
  }
1407
1491
  function TabPanel(props) {
1492
+ const hidden = _ssrDefaultTab !== void 0 ? props.value !== _ssrDefaultTab : void 0;
1408
1493
  return /* @__PURE__ */ jsx("div", {
1409
1494
  class: [panel, props.class],
1410
1495
  role: "tabpanel",
1411
1496
  "data-tab-panel": props.value,
1497
+ hidden: hidden || void 0,
1412
1498
  children: props.children
1413
1499
  });
1414
1500
  }
@@ -2193,11 +2279,36 @@ function Switch(props) {
2193
2279
  function cx(...args) {
2194
2280
  return args.filter(Boolean).join(" ");
2195
2281
  }
2196
- function ComponentPreview({ label, children }) {
2282
+ function Table({ children, ...props }) {
2283
+ return /* @__PURE__ */ jsx("div", {
2284
+ class: "dt-table-wrapper",
2285
+ children: /* @__PURE__ */ jsx("table", {
2286
+ ...props,
2287
+ children
2288
+ })
2289
+ });
2290
+ }
2291
+ function Pre({ children, "data-language": lang, ...props }) {
2292
+ return /* @__PURE__ */ jsxs("div", {
2293
+ class: "dt-code-block",
2294
+ children: [lang && /* @__PURE__ */ jsx("div", {
2295
+ class: "dt-code-header",
2296
+ children: /* @__PURE__ */ jsx("span", {
2297
+ class: "dt-code-lang",
2298
+ children: lang
2299
+ })
2300
+ }), /* @__PURE__ */ jsx("pre", {
2301
+ "data-language": lang,
2302
+ ...props,
2303
+ children
2304
+ })]
2305
+ });
2306
+ }
2307
+ function ComponentPreview({ label, interactive, children }) {
2197
2308
  return /* @__PURE__ */ jsx("div", {
2198
2309
  class: "dt-preview",
2199
2310
  children: /* @__PURE__ */ jsxs("div", {
2200
- class: "dt-preview-box",
2311
+ class: interactive ? "dt-preview-box dt-preview-interactive" : "dt-preview-box",
2201
2312
  children: [label && /* @__PURE__ */ jsx("span", {
2202
2313
  class: "dt-preview-label",
2203
2314
  children: label
@@ -3116,6 +3227,7 @@ function llms(options) {
3116
3227
 
3117
3228
  //#endregion
3118
3229
  //#region ../ssg/src/plugins/docs-theme/index.ts
3230
+ const TabsIsland = island(Tabs, "@semajsx/ui/components/tabs");
3119
3231
  const docsSchema = z.object({
3120
3232
  title: z.string(),
3121
3233
  description: z.string().optional(),
@@ -3186,8 +3298,18 @@ function docsTheme(options) {
3186
3298
  const docsBasePath = options.docs?.basePath ?? "/docs";
3187
3299
  const guidesBasePath = options.guides?.basePath ?? "/guides";
3188
3300
  const uiBasePath = options.ui?.basePath ?? "/ui";
3301
+ let outDir = "";
3189
3302
  const plugins = [{
3190
3303
  name: "docs-theme",
3304
+ configResolved(config) {
3305
+ outDir = config.outDir ?? "./dist";
3306
+ },
3307
+ async buildEnd() {
3308
+ const fontSrc = join$1(dirname$1(fileURLToPath(import.meta.url)), "fonts", "MapleMono-NF-CN-Regular.woff2");
3309
+ const fontDest = join$1(outDir, "fonts", "MapleMono-NF-CN-Regular.woff2");
3310
+ await mkdir$1(dirname$1(fontDest), { recursive: true });
3311
+ await copyFile(fontSrc, fontDest);
3312
+ },
3191
3313
  config() {
3192
3314
  const collections = [];
3193
3315
  const routes = [];
@@ -3322,10 +3444,12 @@ function docsTheme(options) {
3322
3444
  props: { title: `404 - Page Not Found | ${options.title}` }
3323
3445
  });
3324
3446
  const mdxComponents = {
3447
+ table: Table,
3448
+ pre: Pre,
3325
3449
  ComponentPreview,
3326
3450
  Callout,
3327
3451
  CodeBlock,
3328
- Tabs,
3452
+ Tabs: TabsIsland,
3329
3453
  TabList,
3330
3454
  Tab,
3331
3455
  TabPanel,