semajsx 0.5.1 → 0.6.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 (65) 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 +172 -47
  37. package/dist/ssg/plugins/docs-theme.mjs.map +1 -1
  38. package/dist/ssg/plugins/lucide.d.mts +2 -2
  39. package/dist/ssg/plugins/lucide.mjs +1 -1
  40. package/dist/ssr/client.d.mts +7 -6
  41. package/dist/ssr/client.d.mts.map +1 -1
  42. package/dist/ssr/client.mjs +4 -682
  43. package/dist/ssr/index.d.mts +2 -2
  44. package/dist/ssr/index.d.mts.map +1 -1
  45. package/dist/ssr/index.mjs +1 -1
  46. package/dist/style/index.d.mts +2 -2
  47. package/dist/style/react.d.mts +2 -2
  48. package/dist/style/vue.d.mts +2 -2
  49. package/dist/terminal/index.d.mts +4 -4
  50. package/dist/terminal/jsx-dev-runtime.d.mts +4 -4
  51. package/dist/terminal/jsx-runtime.d.mts +4 -4
  52. package/dist/{types-D0jRO840.d.mts → types-Bj5q5x2Q.d.mts} +1 -1
  53. package/dist/{types-D0jRO840.d.mts.map → types-Bj5q5x2Q.d.mts.map} +1 -1
  54. package/dist/{types-C9fiRu6l.d.mts → types-BmDIxXiP.d.mts} +2 -2
  55. package/dist/{types-C9fiRu6l.d.mts.map → types-BmDIxXiP.d.mts.map} +1 -1
  56. package/dist/{types-CZMcXQTW.d.mts → types-C83YtOen.d.mts} +2 -2
  57. package/dist/{types-CZMcXQTW.d.mts.map → types-C83YtOen.d.mts.map} +1 -1
  58. package/dist/{types-BlaUrkq0.d.mts → types-CVPg8ByY.d.mts} +2 -2
  59. package/dist/{types-BlaUrkq0.d.mts.map → types-CVPg8ByY.d.mts.map} +1 -1
  60. package/dist/{types-DucvOZQ2.d.mts → types-ii0bAipe.d.mts} +2 -2
  61. package/dist/{types-DucvOZQ2.d.mts.map → types-ii0bAipe.d.mts.map} +1 -1
  62. package/package.json +7 -1
  63. package/dist/island-marker-BJIO07Vj.d.mts.map +0 -1
  64. package/dist/src-DuSN6go_.mjs.map +0 -1
  65. package/dist/ssr/client.mjs.map +0 -1
@@ -1,17 +1,23 @@
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";
20
+ import remarkGfm from "remark-gfm";
15
21
 
16
22
  //#region ../ssg/src/plugins/docs-theme/styles.ts
17
23
  /**
@@ -36,6 +42,18 @@ const THEME_CSS = `
36
42
  to { opacity: 1; transform: scale(1) translateY(0); }
37
43
  }
38
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
+
39
57
  /* ==============================================
40
58
  * Global Reset & Base
41
59
  * ============================================== */
@@ -446,7 +464,7 @@ body {
446
464
  background: rgba(0, 0, 0, 0.04);
447
465
  padding: 0.15rem 0.4rem;
448
466
  border-radius: 5px;
449
- 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;
450
468
  font-size: 0.875em;
451
469
  color: #1d1d1f;
452
470
  border: 0.5px solid rgba(0, 0, 0, 0.06);
@@ -504,15 +522,18 @@ body {
504
522
 
505
523
  /* Tables */
506
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
+
507
532
  .dt-content table {
508
533
  width: 100%;
509
534
  border-collapse: collapse;
510
- margin: 1.5rem 0;
511
535
  font-size: 0.9375rem;
512
536
  line-height: 1.5;
513
- border-radius: 10px;
514
- overflow: hidden;
515
- border: 0.5px solid rgba(0, 0, 0, 0.08);
516
537
  }
517
538
 
518
539
  .dt-content thead {
@@ -544,11 +565,36 @@ body {
544
565
  background: rgba(0, 0, 0, 0.02);
545
566
  }
546
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
+
547
592
  /* ==============================================
548
593
  * Code Blocks
549
594
  * ============================================== */
550
595
 
551
596
  .dt-code-block {
597
+ position: relative;
552
598
  margin: 1.5rem 0;
553
599
  border-radius: 12px;
554
600
  overflow: hidden;
@@ -556,52 +602,34 @@ body {
556
602
  }
557
603
 
558
604
  .dt-code-header {
559
- background: #161617;
560
- padding: 0.5rem 1.25rem;
561
- display: flex;
562
- justify-content: space-between;
563
- 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;
564
613
  }
565
614
 
566
615
  .dt-code-lang {
567
- color: #86868b;
616
+ color: #636e7b;
568
617
  font-size: 0.6875rem;
569
618
  text-transform: uppercase;
570
619
  font-weight: 600;
571
620
  letter-spacing: 0.04em;
621
+ user-select: none;
572
622
  }
573
623
 
574
624
  .dt-code-block pre {
575
625
  margin: 0;
576
626
  border-radius: 0;
577
627
  border: none;
578
- }
579
-
580
- .dt-code-header + pre {
581
- border-radius: 0;
628
+ padding-top: 2.25rem;
582
629
  }
583
630
 
584
631
  /* Shiki integration */
585
632
 
586
- .dt-content pre.shiki {
587
- position: relative;
588
- padding: 2.25rem 1.5rem 1.25rem;
589
- }
590
-
591
- .dt-content pre.shiki[data-language]::before {
592
- content: attr(data-language);
593
- position: absolute;
594
- top: 0.625rem;
595
- right: 1rem;
596
- color: #636e7b;
597
- font-size: 0.6875rem;
598
- text-transform: uppercase;
599
- font-weight: 600;
600
- letter-spacing: 0.04em;
601
- pointer-events: none;
602
- user-select: none;
603
- }
604
-
605
633
  .dt-content pre.shiki code {
606
634
  display: block;
607
635
  }
@@ -610,6 +638,15 @@ body {
610
638
  display: inline;
611
639
  }
612
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
+
613
650
  /* ==============================================
614
651
  * 404 Page
615
652
  * ============================================== */
@@ -716,14 +753,28 @@ body {
716
753
  .dt-content pre { padding: 1rem; font-size: 0.8125rem; border-radius: 10px; }
717
754
  .dt-content ul, .dt-content ol { margin-left: 1.25rem; }
718
755
 
719
- .dt-content table {
720
- font-size: 0.8125rem;
721
- display: block;
756
+ .dt-table-wrapper {
722
757
  overflow-x: auto;
723
758
  -webkit-overflow-scrolling: touch;
759
+ border-radius: 8px;
724
760
  }
725
761
 
726
- .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
+ }
727
778
 
728
779
  .dt-code-block { border-radius: 10px; }
729
780
  .dt-code-header { padding: 0.375rem 1rem; }
@@ -765,6 +816,10 @@ body {
765
816
  pointer-events: none;
766
817
  }
767
818
 
819
+ .dt-preview-box.dt-preview-interactive > * {
820
+ pointer-events: auto;
821
+ }
822
+
768
823
  .dt-preview-box::before {
769
824
  content: "";
770
825
  position: absolute;
@@ -1377,10 +1432,39 @@ const panel = rule`${c$8.panel} {
1377
1432
 
1378
1433
  //#endregion
1379
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;
1380
1447
  function Tabs(props) {
1448
+ const active = signal(props.defaultValue);
1449
+ _ssrDefaultTab = props.defaultValue;
1381
1450
  return /* @__PURE__ */ jsx("div", {
1382
1451
  class: [root$8, props.class],
1383
- "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
+ },
1384
1468
  children: props.children
1385
1469
  });
1386
1470
  }
@@ -1400,14 +1484,17 @@ function Tab(props) {
1400
1484
  ],
1401
1485
  role: "tab",
1402
1486
  "data-tab-value": props.value,
1487
+ "aria-selected": _ssrDefaultTab !== void 0 ? props.value === _ssrDefaultTab ? "true" : "false" : void 0,
1403
1488
  children: props.children
1404
1489
  });
1405
1490
  }
1406
1491
  function TabPanel(props) {
1492
+ const hidden = _ssrDefaultTab !== void 0 ? props.value !== _ssrDefaultTab : void 0;
1407
1493
  return /* @__PURE__ */ jsx("div", {
1408
1494
  class: [panel, props.class],
1409
1495
  role: "tabpanel",
1410
1496
  "data-tab-panel": props.value,
1497
+ hidden: hidden || void 0,
1411
1498
  children: props.children
1412
1499
  });
1413
1500
  }
@@ -2192,11 +2279,36 @@ function Switch(props) {
2192
2279
  function cx(...args) {
2193
2280
  return args.filter(Boolean).join(" ");
2194
2281
  }
2195
- 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 }) {
2196
2308
  return /* @__PURE__ */ jsx("div", {
2197
2309
  class: "dt-preview",
2198
2310
  children: /* @__PURE__ */ jsxs("div", {
2199
- class: "dt-preview-box",
2311
+ class: interactive ? "dt-preview-box dt-preview-interactive" : "dt-preview-box",
2200
2312
  children: [label && /* @__PURE__ */ jsx("span", {
2201
2313
  class: "dt-preview-label",
2202
2314
  children: label
@@ -3115,6 +3227,7 @@ function llms(options) {
3115
3227
 
3116
3228
  //#endregion
3117
3229
  //#region ../ssg/src/plugins/docs-theme/index.ts
3230
+ const TabsIsland = island(Tabs, "@semajsx/ui/components/tabs");
3118
3231
  const docsSchema = z.object({
3119
3232
  title: z.string(),
3120
3233
  description: z.string().optional(),
@@ -3185,8 +3298,18 @@ function docsTheme(options) {
3185
3298
  const docsBasePath = options.docs?.basePath ?? "/docs";
3186
3299
  const guidesBasePath = options.guides?.basePath ?? "/guides";
3187
3300
  const uiBasePath = options.ui?.basePath ?? "/ui";
3301
+ let outDir = "";
3188
3302
  const plugins = [{
3189
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
+ },
3190
3313
  config() {
3191
3314
  const collections = [];
3192
3315
  const routes = [];
@@ -3321,10 +3444,12 @@ function docsTheme(options) {
3321
3444
  props: { title: `404 - Page Not Found | ${options.title}` }
3322
3445
  });
3323
3446
  const mdxComponents = {
3447
+ table: Table,
3448
+ pre: Pre,
3324
3449
  ComponentPreview,
3325
3450
  Callout,
3326
3451
  CodeBlock,
3327
- Tabs,
3452
+ Tabs: TabsIsland,
3328
3453
  TabList,
3329
3454
  Tab,
3330
3455
  TabPanel,
@@ -3345,7 +3470,7 @@ function docsTheme(options) {
3345
3470
  collections,
3346
3471
  routes,
3347
3472
  mdx: {
3348
- remarkPlugins: options.mdx?.remarkPlugins,
3473
+ remarkPlugins: [remarkGfm, ...options.mdx?.remarkPlugins ?? []],
3349
3474
  rehypePlugins: options.mdx?.rehypePlugins,
3350
3475
  components: mdxComponents
3351
3476
  }