@muten/shadcn 0.1.2 → 0.1.4

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/AGENTS.md CHANGED
@@ -45,6 +45,11 @@ its own bugs, and is one more thing to fix. So before you write any UI piece, wa
45
45
  | a menu, a searchable picker | `DropdownMenu`, `Combobox` | a native `<select>` |
46
46
  | dates and times, an agenda | `Calendar`, `DateField`, `TimeField`, `AgendaLive` | an input with a library |
47
47
  | a KPI, a price, a status | `StatCard`, `Price`, `Badge` / `StatusBadge` | a styled number |
48
+ | a chart: bars, line, area, pie, donut, scatter | muten's `Chart` primitive (styled by the library) | an SVG or a chart library |
49
+ | bars over time with stacked series, a pickable bar, an axis in money | `StackedBars(rows, series, selected, unit, empty, busy, onPick)` | bars of divs |
50
+ | how a whole splits (citas vs pedidos, new vs returning) | `ShareBar(parts)` | two flex boxes |
51
+ | how much happens where two things cross (day × hour) | `Heatmap(rows, cols, cells)` | a grid of coloured cells |
52
+ | a bar per row (channels, a ranking) | `Progress(value, tone)` | a width in % |
48
53
  | a legal or long document | `DocHead`, `DocToc` + `DocTocLink`, `DocSection` | a wall of paragraphs |
49
54
  | a hero background, a product tour | `GradientBlinds(colors, from)`, `ScreenTour` | your own canvas or gradient |
50
55
  | text with the library's type scale | `Txt(value, variant: "title" \| "heading" \| "muted" \| "caption")` | font sizes in your CSS |
package/kit.css CHANGED
@@ -5006,22 +5006,186 @@ a.cx-bc-item:hover { color: var(--foreground); }
5006
5006
  /* ScreenTour: the step's bar is placed by left/right; the progress part's own width: 100% pushed it 40px past the step. */
5007
5007
  .cx-tour-steps > li > .cx-stp-bar { width: auto; }
5008
5008
 
5009
- /* ═════ CHART (muten's native primitive) ═════
5009
+ /* ═════ CHART (muten's native primitive) and THE SERIES PALETTE ═════
5010
+ One palette for every chart of the library: Chart's series (mu-chart-sN) and the tone of Progress, ShareBar,
5011
+ StackedBars and Heatmap (data-tone="brand|coral|teal|amber|blue|pink"), so a series keeps its colour everywhere. */
5012
+ /* (Chart)
5010
5013
  One series wears the skin's accent (the area's fill follows it, it is currentColor); a series per colour (pie, donut,
5011
5014
  color(field)) takes the palette below, chosen to stay apart from the accent in light and dark. The legend is swatch + name. */
5012
5015
  .mu-chart-wrap { width: 100%; max-width: 640px; margin: 0; gap: 14px; }
5013
5016
  .mu-chart { color: var(--selected, var(--primary)); }
5014
5017
  .mu-chart-bar, .mu-chart-dot { fill: currentColor; }
5015
5018
  .mu-chart-line { stroke: currentColor; }
5016
- .mu-chart-s0 { --s: var(--selected, var(--primary)); }
5017
- .mu-chart-s1 { --s: oklch(0.7 0.14 168); }
5018
- .mu-chart-s2 { --s: oklch(0.78 0.15 78); }
5019
- .mu-chart-s3 { --s: oklch(0.66 0.19 22); }
5020
- .mu-chart-s4 { --s: oklch(0.68 0.13 238); }
5021
- .mu-chart-s5 { --s: oklch(0.7 0.16 330); }
5022
- .mu-chart-s6 { --s: oklch(0.62 0.05 260); }
5023
- .mu-chart-s7 { --s: oklch(0.8 0.1 120); }
5024
- :is(.mu-chart-bar, .mu-chart-dot, .mu-chart-slice)[class*="mu-chart-s"] { fill: var(--s); }
5019
+ .mu-chart-s0 { --series: var(--selected, var(--primary)); }
5020
+ .mu-chart-s1, [data-tone="coral"] { --series: oklch(0.66 0.19 22); }
5021
+ .mu-chart-s2, [data-tone="teal"] { --series: oklch(0.7 0.14 168); }
5022
+ .mu-chart-s3, [data-tone="amber"] { --series: oklch(0.78 0.15 78); }
5023
+ .mu-chart-s4, [data-tone="blue"] { --series: oklch(0.68 0.13 238); }
5024
+ .mu-chart-s5, [data-tone="pink"] { --series: oklch(0.7 0.16 330); }
5025
+ .mu-chart-s6 { --series: oklch(0.62 0.05 260); }
5026
+ .mu-chart-s7 { --series: oklch(0.8 0.1 120); }
5027
+ [data-tone="brand"] { --series: var(--selected, var(--primary)); }
5028
+ :is(.mu-chart-bar, .mu-chart-dot, .mu-chart-slice)[class*="mu-chart-s"] { fill: var(--series); }
5025
5029
  .mu-chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 13px; color: var(--muted-foreground); }
5026
5030
  .mu-chart-legend-item { display: flex; flex-direction: row; align-items: center; gap: 7px; }
5027
- .mu-chart-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--s); flex: none; }
5031
+ .mu-chart-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--series); flex: none; }
5032
+
5033
+ /* Progress with a tone: the bar takes the series colour */
5034
+ .cn-progress[data-tone]:not([data-tone=""]) > .cn-progress-indicator { background: var(--series); }
5035
+
5036
+ /* ShareBar (share-bar.muten): one whole cut into its parts, each part's value and name under it */
5037
+ .cx-split { display: flex; flex-direction: column; gap: 14px; width: 100%; min-width: 0; }
5038
+ .cx-split-bar { display: flex; flex-direction: row; gap: 3px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--muted); }
5039
+ .cx-split-seg { flex: var(--f, 0) 1 0; min-width: 0; background: var(--series, var(--primary)); transition: flex-grow .5s cubic-bezier(.22, 1, .36, 1); }
5040
+ .cx-split-seg[style*="--f: 0;"], .cx-split-seg[style*="--f:0;"] { display: none; }
5041
+ .cx-split-keys { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px 32px; }
5042
+ .cx-split-key { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
5043
+ .cx-split-v { font-size: 18px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
5044
+ .cx-split-l { display: flex; flex-direction: row; align-items: center; gap: 7px; font-size: 13px; color: var(--muted-foreground); }
5045
+ .cx-split-l::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--series, var(--primary)); flex: none; }
5046
+ @media (prefers-reduced-motion: reduce) { .cx-split-seg { transition: none; } }
5047
+
5048
+ /* Heatmap (heatmap.muten): rows × columns, seven levels of the tone, a scale under it */
5049
+ .cx-heat { display: flex; flex-direction: column; gap: 12px; width: 100%; min-width: 0; }
5050
+ .cx-heat-grid { position: relative; display: grid; grid-template-columns: 40px repeat(var(--n, 12), minmax(0, 1fr)); gap: 4px; align-items: center; }
5051
+ .cx-heat-x { font-size: 11.5px; color: var(--muted-foreground); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
5052
+ .cx-heat-y { font-size: 12px; color: var(--muted-foreground); }
5053
+ .cx-heat-c { display: block; aspect-ratio: 1.4; min-width: 0; border-radius: 5px; background: var(--muted); }
5054
+ .cx-heat-c[data-level="1"] { background: color-mix(in oklab, var(--series) 18%, var(--muted)); }
5055
+ .cx-heat-c[data-level="2"] { background: color-mix(in oklab, var(--series) 34%, var(--muted)); }
5056
+ .cx-heat-c[data-level="3"] { background: color-mix(in oklab, var(--series) 52%, var(--muted)); }
5057
+ .cx-heat-c[data-level="4"] { background: color-mix(in oklab, var(--series) 72%, var(--muted)); }
5058
+ .cx-heat-c[data-level="5"] { background: var(--series); }
5059
+ .cx-heat-c[data-level="6"] { background: color-mix(in oklab, var(--series) 78%, black); }
5060
+ .cx-heat-grid > .cx-heat-c:hover { outline: 2px solid var(--foreground); outline-offset: 1px; }
5061
+ .cx-heat-scale { display: flex; flex-direction: row; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted-foreground); }
5062
+ .cx-heat-scale > .cx-heat-c { width: 16px; aspect-ratio: auto; height: 12px; border-radius: 3px; }
5063
+ .cx-heat-scale > span:first-child { margin-right: 3px; } .cx-heat-scale > span:last-child { margin-left: 3px; }
5064
+
5065
+ /* StackedBars (stacked-bars.js): series stacked per bar, an axis in the page's unit, a bar that can be picked */
5066
+ .cx-stb { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; }
5067
+ .cx-stb-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 6px 16px; font-size: 13px; color: var(--muted-foreground); }
5068
+ .cx-stb-legend li { display: flex; align-items: center; gap: 7px; }
5069
+ .cx-stb-legend li::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--series); }
5070
+ .cx-stb-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; }
5071
+ .cx-stb-y { display: flex; flex-direction: column; justify-content: space-between; height: 220px; font-size: 11.5px; color: var(--muted-foreground); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
5072
+ .cx-stb-y > span { line-height: 1; transform: translateY(-50%); } .cx-stb-y > span:first-child { transform: none; } .cx-stb-y > span:last-child { transform: translateY(0); }
5073
+ .cx-stb-plot { position: relative; height: 220px; }
5074
+ .cx-stb-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
5075
+ .cx-stb-grid i { border-top: 1px solid color-mix(in oklab, var(--border) 70%, transparent); }
5076
+ .cx-stb-bars { position: relative; height: 100%; display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: clamp(4px, 1.2vw, 14px); align-items: end; }
5077
+ .cx-stb-bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
5078
+ .cx-stb-bar:disabled { cursor: default; }
5079
+ .cx-stb-bar:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
5080
+ .cx-stb-stack { display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 6px 6px 3px 3px; overflow: hidden; transform-origin: bottom; opacity: .55; transition: height .5s cubic-bezier(.22, 1, .36, 1), opacity .2s; }
5081
+ .cx-stb-bars:not(:has([aria-pressed="true"])) .cx-stb-stack, .cx-stb-bar[aria-pressed="true"] .cx-stb-stack, .cx-stb-bar:hover .cx-stb-stack { opacity: 1; }
5082
+ .cx-stb-seg { display: block; flex: 1 1 0; min-height: 2px; background: var(--series); }
5083
+ .cx-stb-sk { display: block; width: 100%; border-radius: 6px 6px 3px 3px; }
5084
+ .cx-stb-x { display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: clamp(4px, 1.2vw, 14px); font-size: 12px; color: var(--muted-foreground); text-align: center; }
5085
+ .cx-stb-x > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
5086
+ .cx-stb-x > span[data-on] { color: var(--foreground); font-weight: 700; }
5087
+ @media (prefers-reduced-motion: reduce) { .cx-stb-stack { transition: none; } }
5088
+
5089
+ /* StatCard: the line under the number, the one thing to do at its foot, the skeleton while it loads */
5090
+ .cx-stat { display: flex; flex-direction: column; }
5091
+ .cx-stat > .cx-stat-body { flex: 1; }
5092
+ .cx-stat-line:empty, .cx-stat-delta:has(> .cn-badge:empty):has(> .cx-text:empty), .cx-stat-delta > .cn-badge:empty { display: none; }
5093
+ .cx-stat-go { margin-top: auto; padding-top: 8px; align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--selected, var(--primary)); text-decoration: none; }
5094
+ .cx-stat-go::after { content: "→"; transition: transform .15s; }
5095
+ .cx-stat-go:hover::after { transform: translateX(2px); }
5096
+ .cx-stat-go:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
5097
+ .cx-stat-sk-v { width: 55%; height: 26px; border-radius: 6px; }
5098
+ .cx-stat-sk-l { width: 80%; height: 12px; border-radius: 6px; }
5099
+
5100
+ /* RankItem (rank-item.muten): a ranking row or a thing to act on */
5101
+ .cx-rank { padding-inline: 0; align-items: center; }
5102
+ .cx-rank-lead { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 32px; width: auto; padding-inline: 6px; }
5103
+ .cx-rank-mid { gap: 6px; min-width: 0; }
5104
+ .cx-rank-t { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
5105
+ .cx-rank-t > .cn-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
5106
+ .cx-rank-t > .cn-badge { flex: none; }
5107
+ .cx-rank-sub:empty { display: none; }
5108
+ .cx-rank-end { flex-direction: row; align-items: center; gap: 10px; }
5109
+ .cx-rank-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
5110
+ .cx-rank-v:empty { display: none; }
5111
+ .cx-rank-sk-t { width: 60%; height: 13px; border-radius: 6px; }
5112
+ .cx-rank-sk-s { width: 35%; height: 11px; border-radius: 6px; }
5113
+ .cx-rank-sk-v { width: 64px; height: 13px; border-radius: 6px; }
5114
+
5115
+ /* Veil (veil.muten): a note over content that has nothing to show yet */
5116
+ .cx-veil { position: relative; width: 100%; display: block; }
5117
+ .cx-veil-body { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
5118
+ .cx-veil-body > * { width: 100%; }
5119
+ .cx-veil[data-on="true"] > .cx-veil-body { opacity: .45; filter: saturate(.4); pointer-events: none; user-select: none; }
5120
+ .cx-veil-note { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px; text-align: center; pointer-events: none; }
5121
+ .cx-veil-note > * { max-width: 34ch; }
5122
+ .cx-veil-t { font-size: 15px; font-weight: 650; }
5123
+ .cx-veil-s { font-size: 13.5px; color: var(--muted-foreground); line-height: 1.45; }
5124
+ .cx-veil-note * { text-wrap: balance; }
5125
+
5126
+ /* the one empty note of the charts (Veil, Heatmap, StackedBars): a floating box over the faded content */
5127
+ .cx-veil-box { display: flex; flex-direction: column; gap: 4px; max-width: 36ch; padding: 14px 18px; border-radius: 14px; background: var(--popover, var(--background)); box-shadow: 0 10px 30px -14px rgb(0 0 0 / .3), 0 0 0 1px var(--border); text-align: center; }
5128
+ .cx-veil-t:empty { display: none; }
5129
+ .cx-heat-grid > .cx-veil-note { inset: 0 0 0 44px; }
5130
+ .cx-heat:has(.cx-veil-note) .cx-heat-c:not(.cx-heat-scale > *) { background: var(--muted); }
5131
+ /* skeletons */
5132
+ .cx-heat[data-busy="true"] .cx-heat-grid > .cx-heat-c { background: var(--muted); animation: cx-sk-pulse 1.4s ease-in-out infinite; }
5133
+ .cx-split[data-busy="true"] .cx-split-seg { visibility: hidden; }
5134
+ .cx-split[data-busy="true"] .cx-split-bar { animation: cx-sk-pulse 1.4s ease-in-out infinite; }
5135
+ .cx-split[data-busy="true"] .cx-split-v { color: transparent; border-radius: 6px; background: var(--muted); animation: cx-sk-pulse 1.4s ease-in-out infinite; }
5136
+ @keyframes cx-sk-pulse { 50% { opacity: .55; } }
5137
+ @media (prefers-reduced-motion: reduce) { .cx-heat[data-busy="true"] .cx-heat-c, .cx-split[data-busy="true"] .cx-split-bar, .cx-split[data-busy="true"] .cx-split-v { animation: none; } }
5138
+
5139
+ .cx-stats { width: 100%; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); grid-auto-rows: 1fr; }
5140
+
5141
+ /* StatBand look "tiles": each number on a soft tile, left-aligned (a card inside an app) */
5142
+ .cx-statband[data-look="tiles"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; border-block: 0; }
5143
+ .cx-statband[data-look="tiles"] > .cx-statband-cell { align-items: flex-start; text-align: left; gap: 2px; padding: 14px 16px; border-radius: calc(var(--radius) * 1.2); background: var(--muted); }
5144
+ .cx-statband[data-look="tiles"] > .cx-statband-cell + .cx-statband-cell { border-left: 0; }
5145
+ .cx-statband[data-look="tiles"] .cx-statband-value { font-size: 26px; }
5146
+ .cx-statband[data-look="tiles"] .cx-statband-value > .cn-skeleton { width: 48px; height: 26px; border-radius: 6px; background: color-mix(in oklab, var(--foreground) 12%, var(--muted)); }
5147
+ /* StackedBars in a narrow card (a phone): twelve month labels still fit, a size smaller and never cut with «…» */
5148
+ .cx-stb { container-type: inline-size; }
5149
+ @container (max-width: 520px) { .cx-stb-x { gap: 2px; font-size: 10px; } .cx-stb-x > span { text-overflow: clip; overflow: visible; } .cx-stb-bars { gap: 4px; } .cx-stb-y { font-size: 10.5px; } }
5150
+
5151
+ /* ── MARKETING PARTS (registry/marketing.muten) ──────────────────────────────────────────────────────────────────────
5152
+ The pieces that had lived in Storio's landing as its own classes, now the library's: a lead under a section title,
5153
+ a note after a block, the tag on a fund card, columns of facts, outlined boxes, a path of numbered steps and a
5154
+ checked list with explanations. */
5155
+ .style-nova .cx-mk-sub { margin-top: -12px; max-width: 60ch; }
5156
+ .style-nova .cx-mk-note { margin: -8px 0 0; font-size: 14px; color: var(--muted-foreground); max-width: 70ch; }
5157
+ .style-nova .cx-mk-fund-c:has(> .cx-mk-fund-tag) { grid-row: span 3; }
5158
+ .style-nova .cx-mk-fund-tag { justify-self: start; align-self: start; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted-foreground); background: var(--background); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; }
5159
+ .style-nova .cx-mk-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
5160
+ .style-nova .cx-mk-fact { display: flex; flex-direction: column; gap: 6px; padding: 22px 20px 4px 0; min-width: 0; }
5161
+ .style-nova .cx-mk-fact + .cx-mk-fact { padding-left: 20px; border-left: 1px solid var(--border); }
5162
+ .style-nova .cx-mk-fact-k { font-weight: 700; font-size: 16px; }
5163
+ .style-nova .cx-mk-fact-p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted-foreground); }
5164
+ .style-nova .cx-mk-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
5165
+ .style-nova .cx-mk-box { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 22px; border: 1px solid var(--border); border-radius: 18px; min-width: 0; }
5166
+ .style-nova .cx-mk-box-t { font-weight: 700; font-size: 16px; }
5167
+ .style-nova .cx-mk-box-p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted-foreground); }
5168
+ .style-nova .cx-mk-path { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
5169
+ .style-nova .cx-mk-path-s { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
5170
+ .style-nova .cx-mk-path-n { width: 34px; height: 34px; border-radius: 50%; background: var(--foreground); color: var(--background); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
5171
+ .style-nova .cx-mk-path-p { margin: 0; font-size: 15px; line-height: 1.55; }
5172
+ .style-nova .cx-mk-donelist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
5173
+ .style-nova .cx-mk-done { display: flex; flex-direction: row; align-items: flex-start; gap: 14px; padding: 20px 0; border-top: 1px solid var(--border); min-width: 0; }
5174
+ .style-nova .cx-mk-done-i { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; font-size: 15px; margin-top: 1px; }
5175
+ .style-nova .cx-mk-done-tx { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
5176
+ .style-nova .cx-mk-done-t { font-weight: 700; font-size: 16px; }
5177
+ .style-nova .cx-mk-done-p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted-foreground); }
5178
+ @media (max-width: 900px) {
5179
+ .style-nova .cx-mk-facts, .style-nova .cx-mk-path { grid-template-columns: 1fr 1fr; row-gap: 22px; }
5180
+ .style-nova .cx-mk-fact:nth-child(3) { padding-left: 0; border-left: 0; }
5181
+ .style-nova .cx-mk-boxes { grid-template-columns: 1fr 1fr; }
5182
+ }
5183
+ @media (max-width: 760px) { .style-nova .cx-mk-donelist { grid-template-columns: 1fr; gap: 0; } }
5184
+ @media (max-width: 560px) {
5185
+ .style-nova .cx-mk-facts, .style-nova .cx-mk-path, .style-nova .cx-mk-boxes { grid-template-columns: 1fr; }
5186
+ .style-nova .cx-mk-fact + .cx-mk-fact { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
5187
+ }
5188
+ /* The pricing table's note under a value (cx-pr-*): how or how much, stacked under it, never beside it. */
5189
+ .style-nova .cx-pr-td .cx-pr-note { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--muted-foreground); font-weight: 400; }
5190
+ .style-nova .cx-pr-table > .cx-pr-tr > .cx-pr-td:has(> .cx-pr-note), .style-nova .cx-pr-table > .cx-pr-tr > .cx-pr-rh:has(> .cx-pr-note) { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left; }
5191
+ .style-nova .cx-pr-rh > .cx-pr-note { display: block; font-size: 12.5px; line-height: 1.45; color: var(--muted-foreground); font-weight: 400; max-width: 30ch; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muten/shadcn",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "shadcn-style component registry for muten - own-the-source parts you add with `muten add`.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,30 @@
1
+ # Heatmap - how much happens where two things cross: rows × columns (weekday × hour, week × day), each cell darker the
2
+ # more it holds, a «less … more» scale under it. A cell says its count to a screen reader and on hover. With `empty`,
3
+ # a calm note sits over the grid until there is something to show (emptyTitle on top of it). busy: true shows the grid
4
+ # as a skeleton while it loads.
5
+ # Heatmap(rows: days, cols: hours, cells: heat, less: "Menos", more: "Más citas", label: "Citas por día y hora")
6
+ # rows {id, label} · cols {label} (an empty label keeps the column unlabelled) · cells {row, level 0-6, tip}, row by row,
7
+ # as many per row as there are cols. tone: the scale's colour (brand by default; coral | teal | amber | blue | pink).
8
+ # shadcn-for-muten · part · no deps · kit.css (.cx-heat).
9
+ part Heatmap(rows: list, cols: list, cells: list, label: text = "", less: text = "Menos", more: text = "Más", empty: text = "", emptyTitle: text = "", tone: text = "brand", busy: bool = false) {
10
+ Stack class("cx-heat") data(tone: $tone, busy: $busy) aria(busy: $busy) {
11
+ Stack class("cx-heat-grid") style(n: "{$cols.length}") aria(role: "img", label: $label) {
12
+ Span "" class("cx-heat-corner")
13
+ each $cols as col { Span "{col.label}" class("cx-heat-x") }
14
+ each $rows as row {
15
+ Span "{row.label}" class("cx-heat-y")
16
+ each $cells as cell where cell.row == row.id { Span "" class("cx-heat-c") data(level: cell.level, name: cell.tip) aria(label: cell.tip) }
17
+ }
18
+ when $empty != "" and not $busy { Stack class("cx-veil-note") { Stack class("cx-veil-box") { Span "{$emptyTitle}" class("cx-veil-t") Span "{$empty}" class("cx-veil-s") } } }
19
+ }
20
+ Stack class("cx-heat-scale") aria(hidden: true) {
21
+ Span "{$less}"
22
+ Span "" class("cx-heat-c") data(level: 0)
23
+ Span "" class("cx-heat-c") data(level: 2)
24
+ Span "" class("cx-heat-c") data(level: 4)
25
+ Span "" class("cx-heat-c") data(level: 5)
26
+ Span "" class("cx-heat-c") data(level: 6)
27
+ Span "{$more}"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,19 @@
1
+ # InfoTable - shadcn's Table for content (not a data grid: for rows from a list with filters, use TableView). A header row
2
+ # of InfoHead, then rows of InfoCell. variant "compare" is the comparison look (first column strong, the rest
3
+ # softer, stacked with their column's name on a phone); a cell's tone picks "strong" or "soft" inside it.
4
+ # InfoTable(variant: "compare") {
5
+ # InfoHeadRow { InfoHead(label: "") InfoHead(label: "Storio") InfoHead(label: "Linktree") }
6
+ # InfoRow { InfoCell(label: "Agenda", tone: "strong") InfoCell(label: "Incluida") InfoCell(label: "No", tone: "soft") }
7
+ # }
8
+ # shadcn-for-muten · parts · no deps · Nova (.cn-table) + kit.css (.cx-mk-vs-table).
9
+ part InfoTable(variant: text = "default") {
10
+ Stack class("cn-table-container") data(slot: "table-container") {
11
+ Stack class("cn-table", "cx-mk-vs-table" when $variant == "compare") data(slot: "table") aria(role: "table") { slot }
12
+ }
13
+ }
14
+ part InfoHeadRow() { Stack class("cn-table-row cx-mk-vs-head") data(slot: "table-row") aria(role: "row") { slot } }
15
+ part InfoRow() { Stack class("cn-table-row") data(slot: "table-row") aria(role: "row") { slot } }
16
+ part InfoHead(label: text) { Span "{$label}" class("cn-table-head") data(slot: "table-head") aria(role: "columnheader") }
17
+ part InfoCell(label: text, tone: text = "") {
18
+ Span "{$label}" class("cn-table-cell", "cx-mk-vs-what" when $tone == "strong", "cx-mk-vs-them" when $tone == "soft") data(slot: "table-cell") aria(role: "cell")
19
+ }
@@ -0,0 +1,144 @@
1
+ # Marketing - the pieces a site's pages are built from (the cx-mk-* system in kit.css): a section with its title, the
2
+ # hero's pill and two-line headline, the address field with its button, a list of checks, numbered steps, cards,
3
+ # columns of facts, a path of steps, a checked list with explanations and the closing call. Every argument is text,
4
+ # so the words can come from a translation function: MkCheck(label: "{t(lang, "x")}").
5
+ # MkSection(anchor: "how", title: "Así funciona") {
6
+ # MkChecks { MkCheck(label: "Sin app para tu cliente") MkCheck(label: "Confirma solo") }
7
+ # }
8
+ # MkHero { MkHeroCopy { MkPill(label: "Para músicos") { Icon "lucide:music" } MkHeadline(first: "Tu música,", second: "en un link.")
9
+ # MkClaim(value: handle, to: joinUrl, cta: "Crear mi tienda") class("animate-rise") } … }
10
+ # MkCta(title: "Tu negocio,", soft: "vende y agenda solo.") { MkClaim(value: handle, to: joinUrl, cta: "Crear mi tienda") }
11
+ # shadcn-for-muten · parts · no deps · kit.css (.cx-mk-*), uses InputGroup and LinkBtn.
12
+
13
+ # MkSection - a page section at reading width with its h2. anchor is its id (a link can go to #anchor).
14
+ part MkSection(anchor: text, title: text = "") {
15
+ Section class("cx-mk-sec cx-mk-col") id("{$anchor}") {
16
+ when $title != "" { Title "{$title}" h2 class("cx-mk-h2") }
17
+ slot
18
+ }
19
+ }
20
+ # MkHead - a section's heading block when it has more than the title: an eyebrow above, a lead under it, and in the
21
+ # slot whatever follows in the same block (a button, a field).
22
+ part MkHead(title: text, lead: text = "", eyebrow: text = "") {
23
+ Stack class("cx-mk-head") {
24
+ when $eyebrow != "" { Span "{$eyebrow}" class("cx-mk-eyebrow") }
25
+ Title "{$title}" h2 class("cx-mk-h2")
26
+ when $lead != "" { Text "{$lead}" class("cx-mk-lead") }
27
+ slot
28
+ }
29
+ }
30
+ # MkLead - the line under a section's title, a little closer to it than a paragraph.
31
+ part MkLead(text: text) { Text "{$text}" class("cx-mk-lead cx-mk-sub") }
32
+ # MkNote - a small line after a block: where a thing comes from, what it depends on.
33
+ part MkNote(text: text) { Text "{$text}" class("cx-mk-note") }
34
+
35
+ # ── the hero ──
36
+ part MkHero() { Section class("cx-mk-hero") { slot } }
37
+ part MkHeroCopy() { Stack class("cx-mk-hero-copy") { slot } }
38
+ # MkPill - the brand pill over a hero's headline; its icon goes in the slot.
39
+ part MkPill(label: text) { Stack class("cx-pill animate-rise cx-mk-pill") data(slot: "pill", tone: "brand") { slot Span "{$label}" } }
40
+ # MkHeadline - an h1 in two lines that fit the column (the second is part of the same sentence). fit: false keeps
41
+ # the poster size (a home page).
42
+ part MkHeadline(first: text, second: text, fit: bool = true) {
43
+ Stack class("words cx-mk-title") {
44
+ Title "{$first}" h1 class("cx-mk-h1", "cx-mk-h1-fit" when $fit)
45
+ Span "{$second}" class("cx-mk-h1", "cx-mk-h1-fit" when $fit)
46
+ }
47
+ }
48
+ # MkTitle - an h1 in one line of text. size: "fit" fits the column, "wrap" lets a whole sentence wrap a size smaller,
49
+ # "" keeps the poster size.
50
+ part MkTitle(text: text, size: text = "") {
51
+ Title "{$text}" h1 class("cx-mk-h1 words", "cx-mk-h1-fit" when $size == "fit", "cx-mk-h1-wrap" when $size == "wrap")
52
+ }
53
+ # MkClaim - the address field and its button: «storio.ink/ [your-name] [Create]». value is the page's text state.
54
+ part MkClaim(value: text, to: text, cta: text, placeholder: text = "", prefix: text = "storio.ink/") {
55
+ Stack class("cx-mk-claim") {
56
+ InputGroup(size: "2xl", variant: "filled") {
57
+ InputAddon { InputGroupText(label: $prefix) }
58
+ GroupInput(value: $value, placeholder: $placeholder)
59
+ }
60
+ LinkBtn(to: $to, variant: "default", size: "2xl") { Span "{$cta}" }
61
+ }
62
+ }
63
+ # MkCta - the closing call: two lines of title (the second softer) and, in the slot, what to do (an MkClaim).
64
+ part MkCta(title: text, soft: text) {
65
+ Stack class("cx-mk-cta") {
66
+ Stack class("cx-mk-cta-copy") { Span "{$title}" class("cx-mk-h2") Span "{$soft}" class("cx-mk-h2 cx-mk-soft") }
67
+ slot
68
+ }
69
+ }
70
+
71
+ # ── lists ──
72
+ # MkChecks / MkCheck - short claims, each with a check.
73
+ part MkChecks() { Stack class("cx-mk-checks") aria(role: "list") { slot } }
74
+ part MkCheck(label: text) { Stack class("cx-mk-check") aria(role: "listitem") { Stack class("cx-mk-ic") { Icon "lucide:check" } Span "{$label}" } }
75
+ # MkCheckList / MkCheckRow - two columns of things a product does, each a check, a title and how it works.
76
+ part MkCheckList() { Stack class("cx-mk-donelist") aria(role: "list") { slot } }
77
+ part MkCheckRow(title: text, text: text) {
78
+ Stack class("cx-mk-done") aria(role: "listitem") {
79
+ Icon "lucide:check" class("cx-mk-done-i")
80
+ Stack class("cx-mk-done-tx") { Span "{$title}" class("cx-mk-done-t") Text "{$text}" class("cx-mk-done-p") }
81
+ }
82
+ }
83
+ # MkSteps / MkStep - numbered steps in boxes; the step's picture goes in the slot (a Stack class("cx-mk-step-vis")).
84
+ part MkSteps() { Stack class("cx-mk-steps") aria(role: "list") { slot } }
85
+ part MkStep(n: text, title: text, text: text) {
86
+ Stack class("cx-mk-step") aria(role: "listitem") {
87
+ Span "{$n}" class("cx-mk-step-n") aria(hidden: true)
88
+ Span "{$title}" class("cx-mk-step-t")
89
+ Text "{$text}" class("cx-mk-step-p")
90
+ slot
91
+ }
92
+ }
93
+ # MkPath / MkPathStep - a short way through, one sentence per step, numbers in circles (four across, two, then one).
94
+ part MkPath() { Stack class("cx-mk-path") aria(role: "list") { slot } }
95
+ part MkPathStep(n: text, text: text) {
96
+ Stack class("cx-mk-path-s") aria(role: "listitem") { Span "{$n}" class("cx-mk-path-n") aria(hidden: true) Text "{$text}" class("cx-mk-path-p") }
97
+ }
98
+ # MkFund / MkFundCard - cards in a grid, each with a title and its paragraph; tag is a small label above (the piece
99
+ # that does it). MkFundSource is a card that also says where its number comes from.
100
+ part MkFund() { Stack class("cx-mk-fund") aria(role: "list") { slot } }
101
+ part MkFundCard(title: text, text: text, tag: text = "") {
102
+ Stack class("cx-mk-fund-c") aria(role: "listitem") {
103
+ when $tag != "" { Span "{$tag}" class("cx-mk-fund-tag") }
104
+ Title "{$title}" h3 class("cx-mk-fund-t")
105
+ Text "{$text}" class("cx-mk-fund-p")
106
+ }
107
+ }
108
+ part MkFundSource(n: text, title: text, text: text, source: text) {
109
+ Stack class("cx-mk-fund-c") aria(role: "listitem") {
110
+ Span "{$n}" class("cx-mk-fund-n")
111
+ Title "{$title}" h3 class("cx-mk-fund-t")
112
+ Text "{$text}" class("cx-mk-fund-p")
113
+ Span "{$source}" class("cx-mk-fund-src")
114
+ }
115
+ }
116
+ # MkFacts / MkFact - columns split by hairlines, a key word and its line (four across, two, then one).
117
+ part MkFacts() { Stack class("cx-mk-facts") aria(role: "list") { slot } }
118
+ part MkFact(key: text, text: text) { Stack class("cx-mk-fact") aria(role: "listitem") { Span "{$key}" class("cx-mk-fact-k") Text "{$text}" class("cx-mk-fact-p") } }
119
+ # MkBoxes / MkBox - outlined boxes with a title and a line (three across, two, then one).
120
+ part MkBoxes() { Stack class("cx-mk-boxes") aria(role: "list") { slot } }
121
+ part MkBox(title: text, text: text) { Stack class("cx-mk-box") aria(role: "listitem") { Span "{$title}" class("cx-mk-box-t") Text "{$text}" class("cx-mk-box-p") } }
122
+
123
+ # ── us and them ──
124
+ # VsTable / VsRow - a comparison of one thing per row: what, how we do it (with a check), how they do it. On a phone
125
+ # each row stacks and the cells carry their column's name. us is the first column's name, logo its picture.
126
+ part VsTable(us: text, them: text, logo: text = "") {
127
+ Stack class("cn-table-container") data(slot: "table-container") {
128
+ Stack class("cn-table cx-mk-vs-table") data(slot: "table") aria(role: "table") {
129
+ Stack class("cn-table-row cx-mk-vs-head") data(slot: "table-row") aria(role: "row") {
130
+ Span "" class("cn-table-head") data(slot: "table-head") aria(role: "columnheader")
131
+ Stack class("cn-table-head") data(slot: "table-head") aria(role: "columnheader") { Image "{$logo}" alt("{$us}") class("cx-mk-vs-logo") }
132
+ Span "{$them}" class("cn-table-head") data(slot: "table-head") aria(role: "columnheader")
133
+ }
134
+ slot
135
+ }
136
+ }
137
+ }
138
+ part VsRow(what: text, us: text, them: text, usName: text, themName: text) {
139
+ Stack class("cn-table-row") data(slot: "table-row") aria(role: "row") {
140
+ Span "{$what}" class("cn-table-cell cx-mk-vs-what") data(slot: "table-cell") aria(role: "cell")
141
+ Stack class("cn-table-cell cx-mk-vs-us") data(slot: "table-cell", label: $usName) aria(role: "cell") { Icon "lucide:check" Span "{$us}" }
142
+ Span "{$them}" class("cn-table-cell cx-mk-vs-them") data(slot: "table-cell", label: $themName) aria(role: "cell")
143
+ }
144
+ }
@@ -12,3 +12,19 @@ part NavButton(label: text = "", current: bool, onClick: action, variant: text =
12
12
  }
13
13
  }
14
14
  part NavBar(label: text = "Secciones", orientation: text = "horizontal") { Nav class("cx-navbar") data(orientation: $orientation) aria(label: $label) { slot } }
15
+
16
+ # NavLink - a NavButton that goes to another page (a Link): the tabs between sibling pages (Terms · Privacy · Delete).
17
+ # NavHere - the tab of the page you are on, which goes nowhere (aria-current="page", marked like a current NavButton).
18
+ # NavBar(label: "Documentos") { NavHere(label: "Términos", marker: "fill") NavLink(label: "Privacidad", to: "/privacy", marker: "fill") }
19
+ part NavLink(label: text, to: text, variant: text = "ghost", size: text = "default", marker: text = "dot") {
20
+ Link "" -> "{$to}" class("cn-button cn-button-variant-{$variant} cn-button-size-{$size} group/button cx-nav") data(slot: "button", marker: $marker) {
21
+ slot
22
+ Span "{$label}" class("cx-nav-label")
23
+ }
24
+ }
25
+ part NavHere(label: text, variant: text = "ghost", size: text = "default", marker: text = "dot") {
26
+ Stack class("cn-button cn-button-variant-{$variant} cn-button-size-{$size} group/button cx-nav") data(slot: "button", marker: $marker) aria(current: "page") {
27
+ slot
28
+ Span "{$label}" class("cx-nav-label")
29
+ }
30
+ }
@@ -1,7 +1,10 @@
1
1
  # Progress - a determinate bar, value 0-100; it eases between values. Progress(value: done, label: "Pasos hechos")
2
+ # tone: the bar's colour from the series palette: brand (the skin's accent) | coral | teal | amber | blue | pink. Empty: the
3
+ # primary colour. A row of channels or a ranking is a Progress per row, each in its tone.
4
+ # Progress(value: 46, tone: "coral", label: "Instagram")
2
5
  # shadcn-for-muten · part · no deps · Nova (.cn-progress) + kit.css (the value rides --w).
3
- part Progress(value: number, label: text = "Progreso") {
4
- Stack class("cn-progress") data(slot: "progress") aria(role: "progressbar", label: $label, valuemin: 0, valuemax: 100, valuenow: $value) {
6
+ part Progress(value: number, label: text = "Progreso", tone: text = "") {
7
+ Stack class("cn-progress") data(slot: "progress", tone: $tone) aria(role: "progressbar", label: $label, valuemin: 0, valuemax: 100, valuenow: $value) {
5
8
  Stack class("cn-progress-indicator") data(slot: "progress-indicator") style(w: "{$value}%")
6
9
  }
7
10
  }
@@ -0,0 +1,32 @@
1
+ # RankItem - one row of a ranking or a short list of things to act on: a lead (the rank «1», or a count «13»), the title
2
+ # with an optional tag, a line under it, an optional bar for its share, and the value on the right. Whatever goes in
3
+ # the slot sits at the end of the row (an action: «Agregar», «Responder»).
4
+ # RankItem(lead: "1", title: "Corte clásico", tag: "Servicio", sub: "38 veces", value: "USD 760", share: 100)
5
+ # RankItem(lead: "13", title: "«tinte»", sub: "No está entre tus servicios") { Btn(variant: "outline", size: "sm", onClick: addService) { Span "Agregar" } }
6
+ # share: 0-100 draws a Progress under the title (leave it at -1 for none). tone: the bar's colour (series palette).
7
+ # busy: true keeps the row's shape with a skeleton.
8
+ # shadcn-for-muten · part · no deps · kit.css (.cx-rank) + Item, Badge, Progress.
9
+ part RankItem(lead: text, title: text = "", tag: text = "", sub: text = "", value: text = "", share: number = -1, tone: text = "brand", busy: bool = false) {
10
+ Stack class("cn-item cn-item-variant-default cn-item-size-sm cx-rank") data(slot: "item", size: "sm", busy: $busy) {
11
+ Stack class("cn-item-media cn-item-media-variant-icon cx-rank-lead") data(slot: "item-media", variant: "icon") { Span "{$lead}" }
12
+ Stack class("cn-item-content cx-rank-mid") data(slot: "item-content") {
13
+ when $busy {
14
+ Skeleton() class("cx-rank-sk-t")
15
+ Skeleton() class("cx-rank-sk-s")
16
+ }
17
+ when not $busy {
18
+ Stack class("cx-rank-t") {
19
+ Span "{$title}" class("cn-item-title") data(slot: "item-title")
20
+ when $tag != "" { Span "{$tag}" class("cn-badge cn-badge-variant-secondary group/badge") data(slot: "badge") }
21
+ }
22
+ Text "{$sub}" class("cn-item-description cx-rank-sub") data(slot: "item-description")
23
+ when $share >= 0 { Progress(value: $share, label: $title, tone: $tone) }
24
+ }
25
+ }
26
+ Stack class("cn-item-actions cx-rank-end") data(slot: "item-actions") {
27
+ when $busy { Skeleton() class("cx-rank-sk-v") }
28
+ when not $busy { Span "{$value}" class("cx-rank-v") }
29
+ slot
30
+ }
31
+ }
32
+ }
@@ -4,9 +4,10 @@
4
4
  # SegmentedControl { SegmentedItem(value: "select", current: tool, label: "Select", onSelect: setTool) … }
5
5
  # SegmentedTabs fills its width; IconTab holds an Icon instead of a label.
6
6
  # shadcn-for-muten · part + Custom (TabsBehavior) · kit.css (.cx-tabs).
7
- part SegmentedControl() { Stack class("cx-tabs") data(slot: "segmented") aria(role: "group") { slot TabsBehavior() } }
8
- part SegmentedItem(value: text, current: text, label: text, onSelect: action) {
9
- Button "{$label}" -> $onSelect($value) class("cn-button cn-button-variant-ghost cn-button-size-sm cx-tab") aria(pressed: $value == $current)
7
+ # label names the group for a screen reader; fill: "phone" stretches it to its row on a phone (to line up with a field).
8
+ part SegmentedControl(label: text = "", fill: text = "") { Stack class("cx-tabs") data(slot: "segmented", fill: $fill) aria(role: "group", label: $label) { slot TabsBehavior() } }
9
+ part SegmentedItem(value: text, current: text, label: text, onSelect: action, size: text = "sm") {
10
+ Button "{$label}" -> $onSelect($value) class("cn-button cn-button-variant-ghost cn-button-size-{$size} cx-tab") aria(pressed: $value == $current)
10
11
  }
11
12
  part SegmentedTabs() { Stack class("cx-tabs cx-tabs-fill") data(slot: "segmented") { slot TabsBehavior() } }
12
13
  part IconTab(value: text, current: text, onSelect: action) {
@@ -0,0 +1,22 @@
1
+ # ShareBar - how one whole splits: a bar at 100 % cut into its parts, each in its tone, and under it each part's value
2
+ # and name. Citas against pedidos, new clients against returning ones. All parts at 0 leave the empty track. busy: true
3
+ # shows the bar and the values as a skeleton while they load.
4
+ # ShareBar(parts: split, label: "Ganado por tipo")
5
+ # parts {label, value (a number: the part's weight), text (what is written: "USD 3.240", "28"), tone}
6
+ # tone: brand | coral | teal | amber | blue | pink (the series palette; Chart and StackedBars use the same colours).
7
+ # shadcn-for-muten · part · no deps · kit.css (.cx-split).
8
+ part ShareBar(parts: list, label: text = "", busy: bool = false) {
9
+ Stack class("cx-split") data(busy: $busy) aria(busy: $busy) {
10
+ Stack class("cx-split-bar") aria(role: "img", label: $label) {
11
+ each $parts as part { Span "" class("cx-split-seg") data(tone: part.tone) style(f: "{part.value}") }
12
+ }
13
+ Stack class("cx-split-keys") {
14
+ each $parts as part {
15
+ Stack class("cx-split-key") {
16
+ Span "{part.text}" class("cx-split-v")
17
+ Span "{part.label}" class("cx-split-l") data(tone: part.tone)
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,75 @@
1
+ // StackedBars (muten Custom) - bars over time with one or more series stacked in each (citas + pedidos by month), an
2
+ // axis in the page's unit (USD 8K), a bar you can pick (it says so with aria-pressed and sends its id), a note over the
3
+ // plot while there is nothing to show, and a skeleton while it loads. The data changes in place: the bars slide to their
4
+ // new height, nothing blinks. inputs: rows [{id, label, <key>: number, …}], series [{key, label, tone}], selected,
5
+ // unit ("USD", "$" or empty for plain numbers), locale, empty, emptyTitle, busy, readonly, label. on: pick(id).
6
+ const NS = 'cx-stb';
7
+ const esc = (s) => String(s ?? '').replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c]);
8
+ const list = (v) => (Array.isArray(v) ? v : []);
9
+ const SKELETON = [38, 52, 44, 61, 57, 70, 48, 66, 59, 74, 30, 22];
10
+
11
+ // a round top for the axis: 4 steps of 1, 2, 2.5 or 5 × a power of ten
12
+ const niceTop = (max) => {
13
+ if (max <= 0) return 4;
14
+ const rough = max / 4, mag = Math.pow(10, Math.floor(Math.log10(rough))), norm = rough / mag;
15
+ const step = (norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 2.5 ? 2.5 : norm <= 5 ? 5 : 10) * mag;
16
+ return step * 4;
17
+ };
18
+
19
+ export function mount(el, inputs, on) {
20
+ let state = { ...inputs }, sel = inputs.selected ?? '', drawn = false;
21
+ const num = (locale) => new Intl.NumberFormat(locale || 'es', { useGrouping: 'always' }); // 1.800, not 1800 (es leaves 4 digits ungrouped)
22
+ // a word unit takes a space (USD 40), a symbol does not ($40)
23
+ const withUnit = (text, unit) => (!unit ? text : /^[A-Za-z]{2,}$/.test(unit) ? `${unit} ${text}` : `${unit}${text}`);
24
+ const fmt = (v, unit, locale) => withUnit(num(locale).format(v), unit);
25
+ const short = (v, unit, locale) => {
26
+ const a = Math.abs(v), r = (x) => num(locale).format(Math.round(x * 10) / 10);
27
+ const s = a >= 1e6 ? r(v / 1e6) + 'M' : a >= 1e3 ? r(v / 1e3) + 'K' : num(locale).format(v);
28
+ return v === 0 ? '0' : withUnit(s, unit);
29
+ };
30
+
31
+ const paint = () => {
32
+ const rows = list(state.rows), series = list(state.series), unit = state.unit || '', locale = state.locale || 'es';
33
+ const totals = rows.map((r) => series.reduce((sum, s) => sum + (Number(r[s.key]) || 0), 0));
34
+ const top = niceTop(Math.max(0, ...totals)), busy = !!state.busy, none = !busy && totals.every((t) => t === 0);
35
+ const legend = series.length > 1 ? `<ul class="${NS}-legend">${series.map((s) => `<li data-tone="${esc(s.tone || 'brand')}">${esc(s.label)}</li>`).join('')}</ul>` : '';
36
+ // nothing to measure yet: only the 0 stays on the axis
37
+ const ticks = [4, 3, 2, 1, 0].map((k) => `<span>${busy || (none && k) ? '' : esc(short((top / 4) * k, unit, locale))}</span>`).join('');
38
+ const bars = busy
39
+ ? SKELETON.slice(0, Math.max(rows.length, 7)).map((h) => `<span class="${NS}-bar"><span class="cn-skeleton ${NS}-sk" style="height:${h}%"></span></span>`).join('')
40
+ : rows.map((r, i) => {
41
+ const tip = `${r.label}: ${series.map((s) => `${s.label} ${fmt(Number(r[s.key]) || 0, unit, locale)}`).join(' · ')}`;
42
+ const segs = series.map((s) => { const v = Number(r[s.key]) || 0; return v > 0 ? `<span class="${NS}-seg" data-tone="${esc(s.tone || 'brand')}" style="flex-grow:${v}"></span>` : ''; }).join('');
43
+ return `<button type="button" class="${NS}-bar" data-id="${esc(r.id)}" aria-pressed="${String(r.id) === String(sel)}" aria-label="${esc(tip)}" data-name="${esc(tip)}"${totals[i] && !state.readonly ? '' : ' disabled'}><span class="${NS}-stack" style="height:${(totals[i] / top) * 100}%">${segs}</span></button>`;
44
+ }).join('');
45
+ const xs = (busy ? SKELETON.slice(0, Math.max(rows.length, 7)).map(() => ({ label: '' })) : rows).map((r) => `<span data-id="${esc(r.id ?? '')}"${String(r.id) === String(sel) ? ' data-on' : ''}>${esc(r.label)}</span>`).join('');
46
+ const n = busy ? Math.max(rows.length, 7) : rows.length;
47
+ el.innerHTML = `${legend}<div class="${NS}-body"><div class="${NS}-y" aria-hidden="true">${ticks}</div><div class="${NS}-plot"><div class="${NS}-grid" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></div><div class="${NS}-bars" role="group" aria-label="${esc(state.label || '')}" style="--n:${n}"${busy ? ' aria-busy="true"' : ''}>${bars}</div>${none && state.empty ? `<div class="cx-veil-note"><div class="cx-veil-box">${state.emptyTitle ? `<span class="cx-veil-t">${esc(state.emptyTitle)}</span>` : ''}<span class="cx-veil-s">${esc(state.empty)}</span></div></div>` : ''}</div><span></span><div class="${NS}-x" aria-hidden="true" style="--n:${n}">${xs}</div></div>`;
48
+ if (!drawn && !busy && rows.length && !matchMedia('(prefers-reduced-motion: reduce)').matches) {
49
+ el.querySelectorAll(`.${NS}-stack`).forEach((s, i) => s.animate([{ transform: 'scaleY(0)' }, { transform: 'scaleY(1)' }], { duration: 480, delay: i * 24, easing: 'cubic-bezier(.22,1,.36,1)', fill: 'backwards' }));
50
+ drawn = true;
51
+ }
52
+ };
53
+
54
+ // only the pressed state moves on a pick: the bars stay where they are
55
+ const mark = () => {
56
+ el.querySelectorAll(`.${NS}-bar[data-id]`).forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.id === String(sel))));
57
+ el.querySelectorAll(`.${NS}-x > span`).forEach((x) => x.toggleAttribute('data-on', x.dataset.id === String(sel)));
58
+ };
59
+ el.addEventListener('click', (e) => {
60
+ const bar = e.target.closest(`.${NS}-bar[data-id]`);
61
+ if (!bar || bar.disabled) return;
62
+ sel = bar.dataset.id; mark(); on?.pick?.(sel);
63
+ });
64
+
65
+ paint();
66
+ return (next) => {
67
+ const selChanged = (next.selected ?? '') !== (state.selected ?? '');
68
+ state = { ...next };
69
+ if (selChanged) sel = next.selected ?? '';
70
+ // same rows and series, only the pick moved: no repaint
71
+ const old = el.querySelectorAll(`.${NS}-bar[data-id]`).length;
72
+ paint();
73
+ if (old && !state.busy) mark();
74
+ };
75
+ }
@@ -0,0 +1,13 @@
1
+ # StackedBars - bars over time with one or more series stacked in each: the year by month, citas and pedidos together.
2
+ # The axis is in the page's unit (USD 8K), a bar can be picked (it is pressed, and onPick gets its id), while nothing
3
+ # is there yet a calm note sits over the plot (`empty`, with `emptyTitle` on top), and while it loads (`busy`) a skeleton keeps the shape. When the
4
+ # data changes the bars slide to their new height. Each bar says its values to a screen reader and on hover.
5
+ # StackedBars(rows: @months, series: @kinds, selected: monthId, unit: "USD", onPick: pickMonth, label: "Ventas por mes")
6
+ # rows {id, label, <key>: number…} · series {key, label, tone}: tone brand | coral | teal | amber | blue | pink, the
7
+ # series palette (the first series sits at the bottom). One series is a plain bar chart. A legend shows from two.
8
+ # readonly: true shows the pick but lets no bar be pressed (a plan that cannot change month).
9
+ # For a single quick chart with no picking, muten's own `Chart` primitive is enough.
10
+ # shadcn-for-muten · Custom · no deps · host JS stacked-bars.js · kit.css (.cx-stb).
11
+ part StackedBars(rows: list, series: list, selected: text = "", unit: text = "", locale: text = "es", empty: text = "", emptyTitle: text = "", busy: bool = false, readonly: bool = false, label: text = "", onPick: action) {
12
+ Custom StackedBars inputs(rows: $rows, series: $series, selected: $selected, unit: $unit, locale: $locale, empty: $empty, emptyTitle: $emptyTitle, busy: $busy, readonly: $readonly, label: $label) on(pick: $onPick) class("cx-stb")
13
+ }
@@ -1,6 +1,10 @@
1
1
  # StatBand - a row of big numbers split by hairlines (two per row on a phone). Each Stat holds its value in the slot
2
2
  # (a Span, or a CountUp that counts up when it comes into view) and its label under it.
3
3
  # StatBand { Stat(label: "citas al mes") { CountUp(to: "12,400") } Stat(label: "tiendas") { Span "850" } }
4
+ # look: "tiles" puts each number on its own soft tile, left-aligned, for a card inside an app (what the bot did this
5
+ # month: «0 reservas que cerró solo»); the default is the landing's band, centred between hairlines.
6
+ # StatBand(look: "tiles") { Stat(label: "reservas que cerró solo") { Span "12" } Stat(label: "pedidos que tomó solo") { Span "5" } }
7
+ # While the numbers load, put a Skeleton in each Stat's slot.
4
8
  # shadcn-for-muten · parts · no deps · kit.css (.cx-statband).
5
- part StatBand() { Stack class("cx-statband") { slot } }
9
+ part StatBand(look: text = "") { Stack class("cx-statband") data(look: $look) { slot } }
6
10
  part Stat(label: text) { Stack class("cx-statband-cell") { Stack class("cx-statband-value") { slot } Span "{$label}" class("cx-statband-label") } }
@@ -2,21 +2,33 @@
2
2
  # its line. The icon goes in the slot (or leave it empty). `tone` says if the change is good (ok) or bad (bad) -
3
3
  # for a cost or a wait, going down is the good one.
4
4
  # StatCard(label: "Ventas", value: "$1.284.000", delta: "▲ 12 %", tone: "ok", compare: "vs. semana pasada", series: "3,5,4,6,5,8,9") { Icon "lucide:credit-card" }
5
+ # A card that asks for something (what is owed, orders to confirm): `line` says what the number means and `to` + `cta`
6
+ # is the one thing to do about it, written at the foot of the card.
7
+ # StatCard(label: "Por cobrar", value: "USD 305", line: "4 citas sin marcar como pagadas", to: "/close-day", cta: "Cerrar el día") { Icon "lucide:clock" }
8
+ # busy: true keeps the card's shape with a skeleton while the number loads (the label stays).
5
9
  # Lay several in a StatGrid. Spark draws the series alone: Spark(series: "3,5,4", tone: "success").
6
10
  # shadcn-for-muten · part + Custom (Spark.js) · kit.css (.cx-stat).
7
- part StatCard(label: text, value: text, delta: text, tone: text = "ok", compare: text = "", series: text = "") {
8
- Section class("cn-card cx-stat") data(slot: "card", size: "sm") {
11
+ part StatCard(label: text, value: text = "", delta: text = "", tone: text = "ok", compare: text = "", series: text = "", line: text = "", to: text = "", cta: text = "", busy: bool = false) {
12
+ Section class("cn-card cx-stat") data(slot: "card", size: "sm", busy: $busy) {
9
13
  Stack class("cx-stat-body") {
10
14
  Stack class("cx-stat-row") {
11
15
  Span "{$label}" class("cx-text") data(slot: "text", variant: "muted")
12
16
  Stack class("cx-stat-ic") { slot }
13
17
  }
14
- Span "{$value}" class("cx-text") data(slot: "text", variant: "title")
15
- Stack class("cx-stat-row") {
16
- Span "{$delta}" class("cn-badge cn-badge-variant-ghost group/badge") data(slot: "badge", variant: "status", tone: $tone)
17
- Span "{$compare}" class("cx-text") data(slot: "text", variant: "caption")
18
+ when $busy {
19
+ Skeleton() class("cx-stat-sk-v")
20
+ Skeleton() class("cx-stat-sk-l")
21
+ }
22
+ when not $busy {
23
+ Span "{$value}" class("cx-text") data(slot: "text", variant: "title")
24
+ Span "{$line}" class("cx-text cx-stat-line") data(slot: "text", variant: "caption")
25
+ Stack class("cx-stat-row cx-stat-delta") {
26
+ Span "{$delta}" class("cn-badge cn-badge-variant-ghost group/badge") data(slot: "badge", variant: "status", tone: $tone)
27
+ Span "{$compare}" class("cx-text") data(slot: "text", variant: "caption")
28
+ }
29
+ Spark(series: $series, tone: $tone)
30
+ when $to != "" { Link "{$cta}" -> "{$to}" class("cx-stat-go") }
18
31
  }
19
- Spark(series: $series, tone: $tone)
20
32
  }
21
33
  }
22
34
  }
@@ -0,0 +1,18 @@
1
+ # Veil - a calm note over a card's content while it has nothing to show yet: the content stays behind, faded (ghost
2
+ # rows, an empty chart), and a title and a line say what will appear. With `on` false it is the content alone.
3
+ # Veil(on: noSales, title: "Nada vendido todavía", text: "Lo que más te reserven y te compren aparece aquí.") { … }
4
+ # StackedBars and Heatmap carry their own (empty / emptyTitle); use Veil for anything else.
5
+ # shadcn-for-muten · part · no deps · kit.css (.cx-veil).
6
+ part Veil(on: bool, title: text = "", text: text = "") {
7
+ Stack class("cx-veil") data(on: $on) {
8
+ Stack class("cx-veil-body") aria(hidden: $on) { slot }
9
+ when $on {
10
+ Stack class("cx-veil-note") {
11
+ Stack class("cx-veil-box") {
12
+ Span "{$title}" class("cx-veil-t")
13
+ Span "{$text}" class("cx-veil-s")
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
package/registry.json CHANGED
@@ -391,6 +391,13 @@
391
391
  "component": "GradientBlinds",
392
392
  "description": "Animated WebGL gradient + diagonal-blinds hero background that follows the cursor and fades into the page (needs ogl)."
393
393
  },
394
+ {
395
+ "name": "heatmap",
396
+ "deps": [],
397
+ "part": "Heatmap",
398
+ "file": "registry/heatmap.muten",
399
+ "description": "Rows × columns (weekday × hour), each cell darker the more it holds, a less…more scale, a note while empty."
400
+ },
394
401
  {
395
402
  "name": "hotkey",
396
403
  "deps": [],
@@ -428,6 +435,13 @@
428
435
  "file": "registry/indicator.muten",
429
436
  "description": "Indicator(tone): the corner dot that says something needs you."
430
437
  },
438
+ {
439
+ "name": "info-table",
440
+ "deps": [],
441
+ "part": "InfoTable",
442
+ "file": "registry/info-table.muten",
443
+ "description": "InfoTable - shadcn's Table for content (not a data grid: for rows from a list with filters, use TableView). A header row"
444
+ },
431
445
  {
432
446
  "name": "input-group",
433
447
  "deps": [
@@ -505,6 +519,13 @@
505
519
  "component": "KitWidget",
506
520
  "description": "Host of the system kit widgets (Custom, kit core). Use the named parts."
507
521
  },
522
+ {
523
+ "name": "legal-doc",
524
+ "deps": [],
525
+ "part": "DocHead",
526
+ "file": "registry/legal-doc.muten",
527
+ "description": "A legal document (terms, privacy): the title and its line, the contents that follow the reading, the sections at reading width."
528
+ },
508
529
  {
509
530
  "name": "link-btn",
510
531
  "deps": [],
@@ -527,6 +548,13 @@
527
548
  "file": "registry/logo-cloud.muten",
528
549
  "description": "BLOCK: a 'trusted by' strip of logos, muted + grayscale until hover. Parts: LogoCloud, LogoCloudItem."
529
550
  },
551
+ {
552
+ "name": "marketing",
553
+ "deps": [],
554
+ "part": "MkSection",
555
+ "file": "registry/marketing.muten",
556
+ "description": "Marketing - the pieces a site's pages are built from (the cx-mk-* system in kit.css): a section with its title, the"
557
+ },
530
558
  {
531
559
  "name": "member-list",
532
560
  "deps": [
@@ -613,20 +641,6 @@
613
641
  "file": "registry/navpill.muten",
614
642
  "description": "BLOCK: the floating glass navbar (sticky wrapper + glass pill + scroll animation baked in). Drop logo/links/CTA inside."
615
643
  },
616
- {
617
- "name": "legal-doc",
618
- "deps": [],
619
- "part": "DocHead",
620
- "file": "registry/legal-doc.muten",
621
- "description": "A legal document (terms, privacy): the title and its line, the contents that follow the reading, the sections at reading width."
622
- },
623
- {
624
- "name": "phone-bar",
625
- "deps": [],
626
- "part": "PhoneBar",
627
- "file": "registry/phone-bar.muten",
628
- "description": "The app's bar at the bottom of a phone: three fixed cells (menu · the screen's tools · its create). Screens hand it their toolbar buttons on a phone."
629
- },
630
644
  {
631
645
  "name": "new-appointment",
632
646
  "deps": [],
@@ -699,6 +713,13 @@
699
713
  "file": "registry/permission-matrix.muten",
700
714
  "description": "PermissionMatrix - any rows × any roles; one role can be locked (always allowed)."
701
715
  },
716
+ {
717
+ "name": "phone-bar",
718
+ "deps": [],
719
+ "part": "PhoneBar",
720
+ "file": "registry/phone-bar.muten",
721
+ "description": "The app's bar at the bottom of a phone: three fixed cells (menu · the screen's tools · its create). Screens hand it their toolbar buttons on a phone."
722
+ },
702
723
  {
703
724
  "name": "phone-field",
704
725
  "deps": [],
@@ -783,6 +804,15 @@
783
804
  "component": "RangeSlider",
784
805
  "description": "RangeSlider(lo, hi, min, max, step, onLo, onHi): two thumbs on the kit ScaleSlider."
785
806
  },
807
+ {
808
+ "name": "rank-item",
809
+ "deps": [
810
+ "progress"
811
+ ],
812
+ "part": "RankItem",
813
+ "file": "registry/rank-item.muten",
814
+ "description": "A ranking row or a thing to act on: a lead (rank or count), title, tag, a line, an optional share bar, the value, and an action in the slot."
815
+ },
786
816
  {
787
817
  "name": "resizable",
788
818
  "deps": [],
@@ -853,6 +883,13 @@
853
883
  "file": "registry/separator.muten",
854
884
  "description": "Separator(orientation): a hairline. horizontal | vertical."
855
885
  },
886
+ {
887
+ "name": "share-bar",
888
+ "deps": [],
889
+ "part": "ShareBar",
890
+ "file": "registry/share-bar.muten",
891
+ "description": "How one whole splits: a bar at 100 % cut into its parts, each in its tone, with each part's value and name under it."
892
+ },
856
893
  {
857
894
  "name": "share-button",
858
895
  "deps": [],
@@ -875,6 +912,13 @@
875
912
  "file": "registry/sidebar.muten",
876
913
  "description": "AppSidebar - a collapsible nav panel (SidebarHeader / SidebarGroup / SidebarItem). Named AppSidebar so it never shadows muten's core Sidebar <aside> primitive."
877
914
  },
915
+ {
916
+ "name": "site-footer",
917
+ "deps": [],
918
+ "part": "SiteFooter",
919
+ "file": "registry/site-footer.muten",
920
+ "description": "A site's footer: the brand and its two ways in over a hairline, every group of links on one row, then a bar with the company and contacts (FooterHead, FooterBrand, FooterActions, FooterLinks, FooterCol, FooterBar)."
921
+ },
878
922
  {
879
923
  "name": "skeleton",
880
924
  "deps": [],
@@ -937,6 +981,14 @@
937
981
  "file": "registry/split-button.muten",
938
982
  "description": "A main action + a caret dropdown; page owns the open bool."
939
983
  },
984
+ {
985
+ "name": "stacked-bars",
986
+ "deps": [],
987
+ "part": "StackedBars",
988
+ "file": "registry/stacked-bars.muten",
989
+ "component": "StackedBars",
990
+ "description": "Bars over time with series stacked, an axis in the page's unit, a bar you can pick, an empty note and a skeleton."
991
+ },
940
992
  {
941
993
  "name": "stamp-card",
942
994
  "deps": [
@@ -1107,6 +1159,13 @@
1107
1159
  "file": "registry/vector-field.muten",
1108
1160
  "description": "Paired NumberFields (X/Y) for position or size."
1109
1161
  },
1162
+ {
1163
+ "name": "veil",
1164
+ "deps": [],
1165
+ "part": "Veil",
1166
+ "file": "registry/veil.muten",
1167
+ "description": "A calm note (title and line) over a card's content while it has nothing to show yet; the content stays faded behind."
1168
+ },
1110
1169
  {
1111
1170
  "name": "virtual-list",
1112
1171
  "deps": [],
@@ -1137,13 +1196,6 @@
1137
1196
  "part": "ZoomControl",
1138
1197
  "file": "registry/zoom-control.muten",
1139
1198
  "description": "A - 100% + zoom widget; page owns the zoom number."
1140
- },
1141
- {
1142
- "name": "site-footer",
1143
- "deps": [],
1144
- "part": "SiteFooter",
1145
- "file": "registry/site-footer.muten",
1146
- "description": "A site's footer: the brand and its two ways in over a hairline, every group of links on one row, then a bar with the company and contacts (FooterHead, FooterBrand, FooterActions, FooterLinks, FooterCol, FooterBar)."
1147
1199
  }
1148
1200
  ],
1149
1201
  "classComponents": {