@joewinke/jatui 0.2.9 → 0.2.11

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/CLAUDE.md CHANGED
@@ -65,6 +65,8 @@ Then import:
65
65
  | `Sparkline` | Inline mini chart | `data: number[]`, `width`, `height`, `color` |
66
66
  | `LazyImage` | Image with lazy loading + placeholder | `src`, `alt`, `placeholder` |
67
67
  | `HunkDiffView` | Side-by-side diff with line numbers, red/green backgrounds, strikethrough on removed lines, inline word-level highlights via the `diff` lib. Used for reviewing YAML/text changes per hunk. | `oldText: string \| null`, `newText: string \| null`, `unified?: boolean` |
68
+ | `ContextMenu` | Floating right-click (or programmatic) action menu, positioned via `use:floating` at a cursor point. Real `<button>`s, per-item `icon`/`variant`/`disabled`, dividers, click-outside + Escape dismiss, arrow-key/Home/End roving nav (focus starts on the first item). | `open` (bindable), `x`, `y`, `items: ContextMenuItem[]`, `header?`, `zIndex?`, `onClose?` |
69
+ | `ContextMenuTrigger` | Wraps content with the standard right-click + "⋯" touch affordance, backed by `ContextMenu`. Use instead of hand-rolling `oncontextmenu` + a kebab button per row/card. | `items: ContextMenuItem[]`, `children` (snippet), `header?`, `triggerLabel?`, `hideButton?`, `zIndex?`, `class?` |
68
70
 
69
71
  ### Media
70
72
 
@@ -2,9 +2,11 @@
2
2
  /**
3
3
  * Collapse — batteries-included tall-content collapser.
4
4
  *
5
- * Animates via grid-template-rows 0fr↔1fr with var(--motion-glide) — no
6
- * overshoot, no layout-property animation. The toggle self-hides when content
7
- * is shorter than the threshold (ResizeObserver-backed measurement).
5
+ * Caps tall content at `threshold` px with a fade-out mask so it shows a
6
+ * preview instead of overflowing; the toggle clamp is instant (no
7
+ * layout-property animation, matching the `use:collapse` action). The toggle
8
+ * self-hides when content is shorter than the threshold
9
+ * (ResizeObserver-backed measurement).
8
10
  *
9
11
  * <Collapse>
10
12
  * {@html renderedMarkdown}
@@ -86,27 +88,26 @@
86
88
 
87
89
  <style>
88
90
  /*
89
- * Grid-template-rows trick: outer wraps inner with overflow:hidden.
90
- * Closed → 0fr (inner pinned to 0 height). Open → 1fr (natural height).
91
- * grid-template-rows is a discrete property in older engines but modern
92
- * browsers interpolate it as a length when rows go 0fr↔1fr.
93
- * No layout-property width change; height is the only transition.
91
+ * Preview collapse: closed caps the visible area at the threshold with a
92
+ * fade-out mask; open removes the cap. This is a PREVIEW collapser — closed
93
+ * must show the first `threshold` px, NOT zero. The original implementation
94
+ * animated grid-template-rows 0fr↔1fr, but 0fr (with the inner's
95
+ * min-height:0) clamps the row to ZERO height — max-height never got a say,
96
+ * so every collapsed body rendered empty with only the "Show more" toggle
97
+ * visible (mos-7i3ni). The toggle is now an instant clamp, matching the
98
+ * `use:collapse` action's behavior (no layout-property animation).
94
99
  */
95
100
  .jatui-collapse-outer {
96
- display: grid;
97
- grid-template-rows: 1fr;
98
- transition: grid-template-rows var(--motion-enter) var(--motion-glide);
99
101
  overflow: hidden;
100
102
  position: relative;
101
103
  }
102
104
 
103
105
  .jatui-collapse-outer-closed {
104
- grid-template-rows: 0fr;
106
+ /* Cap visible area at threshold */
107
+ max-height: var(--collapse-threshold);
105
108
  /* Fade gradient masks the bottom edge when collapsed */
106
109
  -webkit-mask-image: var(--collapse-gradient);
107
110
  mask-image: var(--collapse-gradient);
108
- /* Cap visible area at threshold */
109
- max-height: var(--collapse-threshold);
110
111
  }
111
112
 
112
113
  /* When open, remove the mask and height cap */
@@ -116,12 +117,6 @@
116
117
  mask-image: none;
117
118
  }
118
119
 
119
- .jatui-collapse-inner {
120
- /* Required for grid 0fr to clamp to zero */
121
- min-height: 0;
122
- overflow: hidden;
123
- }
124
-
125
120
  .jatui-collapse-toggle {
126
121
  display: block;
127
122
  margin-top: 4px;
@@ -138,10 +133,4 @@
138
133
  opacity: 1;
139
134
  text-decoration: underline;
140
135
  }
141
-
142
- @media (prefers-reduced-motion: reduce) {
143
- .jatui-collapse-outer {
144
- transition: none;
145
- }
146
- }
147
136
  </style>
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Collapse — batteries-included tall-content collapser.
3
3
  *
4
- * Animates via grid-template-rows 0fr↔1fr with var(--motion-glide) — no
5
- * overshoot, no layout-property animation. The toggle self-hides when content
6
- * is shorter than the threshold (ResizeObserver-backed measurement).
4
+ * Caps tall content at `threshold` px with a fade-out mask so it shows a
5
+ * preview instead of overflowing; the toggle clamp is instant (no
6
+ * layout-property animation, matching the `use:collapse` action). The toggle
7
+ * self-hides when content is shorter than the threshold
8
+ * (ResizeObserver-backed measurement).
7
9
  *
8
10
  * <Collapse>
9
11
  * {@html renderedMarkdown}
@@ -45,17 +45,29 @@ export function createDndBoard(opts) {
45
45
  }
46
46
  }
47
47
 
48
- $.user_effect(function () {
49
- opts.items();
50
-
51
- if ($.safe_get(dragging) || inFlight > 0) {
52
- seedQueued = true;
53
-
54
- return;
55
- }
48
+ // Seed synchronously at creation so the render mirror is populated for the very
49
+ // first render — SSR (where effects never run) and a client mount where items
50
+ // are already present. Without this the grid renders empty until an effect
51
+ // fires.
52
+ seed();
53
+
54
+ // Reactive re-seed on items() change — CLIENT ONLY. createDndBoard ships as a
55
+ // client build (svelte/internal/client); creating this effect during SSR calls
56
+ // user_effect with no active reaction → effect_orphan (a 500 on any page that
57
+ // server-renders a board). The synchronous seed above covers the SSR render.
58
+ if (typeof window !== 'undefined') {
59
+ $.user_effect(function () {
60
+ opts.items();
61
+
62
+ if ($.safe_get(dragging) || inFlight > 0) {
63
+ seedQueued = true;
64
+
65
+ return;
66
+ }
56
67
 
57
- seed();
58
- });
68
+ seed();
69
+ });
70
+ }
59
71
 
60
72
  function placementFrom(dropTargets) {
61
73
  var _a;
@@ -219,7 +231,9 @@ export function createDndBoard(opts) {
219
231
  });
220
232
  }
221
233
 
222
- $.user_effect(function () {
234
+ // Drag monitor — CLIENT ONLY (same effect_orphan reason as the seed effect;
235
+ // monitorForElements also needs the DOM, which does not exist during SSR).
236
+ if (typeof window !== 'undefined') $.user_effect(function () {
223
237
  return monitorForElements({
224
238
  canMonitor(_a) {
225
239
  var source = _a.source;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",