@joewinke/jatui 0.2.10 → 0.2.12
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.
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Collapse — batteries-included tall-content collapser.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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}
|
|
@@ -36,7 +36,16 @@ export function createDndBoard(opts) {
|
|
|
36
36
|
mirror.clear();
|
|
37
37
|
|
|
38
38
|
var src = opts.items();
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
// Iterate a real ARRAY, never a Map/iterator directly. This module is
|
|
41
|
+
// downlevelled by the package build (svelte-package emits ES5-ish output:
|
|
42
|
+
// `for…of` becomes a `.length`-indexed loop and `[...iterable]` becomes
|
|
43
|
+
// `Array.prototype.slice.call`). Those transforms are correct for arrays
|
|
44
|
+
// but SILENTLY WRONG for Maps/iterators (`Map.length` is undefined → the
|
|
45
|
+
// loop never runs; slice on an iterator returns []). Iterating a Map here
|
|
46
|
+
// left the render mirror permanently empty → every board rendered blank.
|
|
47
|
+
// `Array.from(map)` is a runtime call, so it survives the downlevel intact.
|
|
48
|
+
var entries = src instanceof Map ? Array.from(src) : Object.entries(src);
|
|
40
49
|
|
|
41
50
|
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
42
51
|
var _a = entries_1[_i], id = _a[0], list = _a[1];
|
|
@@ -93,8 +102,9 @@ export function createDndBoard(opts) {
|
|
|
93
102
|
var _a;
|
|
94
103
|
var _b;
|
|
95
104
|
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
// Array.from — never iterate the SvelteMap directly (downlevel breaks it; see seed()).
|
|
106
|
+
for (var _i = 0, _c = Array.from(mirror); _i < _c.length; _i++) {
|
|
107
|
+
var _d = _c[_i], cid = _d[0], list_1 = _d[1];
|
|
98
108
|
|
|
99
109
|
var idx = list_1.findIndex(function (item) {
|
|
100
110
|
return item[SHADOW_KEY];
|
|
@@ -164,8 +174,9 @@ export function createDndBoard(opts) {
|
|
|
164
174
|
function rollback(move) {
|
|
165
175
|
var _a;
|
|
166
176
|
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
// Array.from — never iterate the SvelteMap directly (downlevel breaks it; see seed()).
|
|
178
|
+
for (var _i = 0, _b = Array.from(mirror); _i < _b.length; _i++) {
|
|
179
|
+
var _c = _b[_i], cid = _c[0], list = _c[1];
|
|
169
180
|
|
|
170
181
|
var idx = list.findIndex(function (it) {
|
|
171
182
|
return opts.key(it) === opts.key(move.item);
|
|
@@ -284,7 +295,7 @@ export function createDndBoard(opts) {
|
|
|
284
295
|
},
|
|
285
296
|
|
|
286
297
|
containers() {
|
|
287
|
-
return
|
|
298
|
+
return Array.from(mirror.keys());
|
|
288
299
|
},
|
|
289
300
|
|
|
290
301
|
get dragging() {
|