lilact 0.11.5 → 0.13.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.
- package/README.md +3 -2
- package/dist/lilact.development.js +369 -243
- package/dist/lilact.development.js.map +1 -1
- package/dist/lilact.development.min.js +1 -1
- package/dist/lilact.development.min.js.LICENSE.txt +1 -1
- package/dist/lilact.development.min.js.map +1 -1
- package/dist/lilact.production.min.js +1 -1
- package/dist/lilact.production.min.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/accessories.ErrorBoundary.html +11 -11
- package/docs/classes/accessories.Suspense.html +10 -10
- package/docs/classes/components.Component.html +11 -11
- package/docs/classes/components.HTMLComponent.html +11 -11
- package/docs/classes/components.RootComponent.html +12 -12
- package/docs/functions/accessories.DragHandle.html +6 -0
- package/docs/functions/accessories.Spinner.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +3 -2
- package/docs/modules/accessories.html +1 -1
- package/docs/modules.html +1 -1
- package/docs/static/demos/pane.jsx +3 -3
- package/docs/static/index.html +1 -1
- package/docs/static/lilact.development.js +369 -243
- package/docs/static/lilact.development.min.js +1 -1
- package/docs/static/lilact.production.min.js +1 -1
- package/docs/variables/{pane.ResizablePane.html → accessories.SplitPane.html} +3 -3
- package/package.json +1 -1
- package/root/demos/pane.jsx +3 -3
- package/root/index.html +1 -1
- package/root/lilact.development.js +369 -243
- package/root/lilact.development.min.js +1 -1
- package/root/lilact.production.min.js +1 -1
- package/src/accessories.jsx +391 -0
- package/src/components.jsx +24 -4
- package/src/lilact.jsx +1 -5
- package/typedoc.json +0 -1
- package/docs/modules/pane.html +0 -1
- package/src/pane.jsx +0 -270
package/src/accessories.jsx
CHANGED
|
@@ -28,9 +28,17 @@
|
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
|
|
32
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState, useImperativeHandle } from "./hooks.jsx";
|
|
33
|
+
import { Children, forwardRef } from "./misc.jsx";
|
|
34
|
+
|
|
35
|
+
|
|
31
36
|
import {isThenable} from "./misc.jsx"
|
|
32
37
|
import {setTimeout, clearTimeout} from "./timers.jsx"
|
|
33
38
|
import {Component} from "./components.jsx"
|
|
39
|
+
import {useCallback} from './hooks.jsx'
|
|
40
|
+
import {emotion} from "./lilact.jsx"
|
|
41
|
+
const {css,cx} = emotion;
|
|
34
42
|
|
|
35
43
|
/**
|
|
36
44
|
* A CSS-only loading spinner component.
|
|
@@ -284,3 +292,386 @@ export class Suspense extends Component
|
|
|
284
292
|
}
|
|
285
293
|
}
|
|
286
294
|
|
|
295
|
+
/**
|
|
296
|
+
* DragHandle - helper component to wire up drag interactions.
|
|
297
|
+
*
|
|
298
|
+
* This component does not implement dragging/movement itself. Instead, it listens
|
|
299
|
+
* for drag gesture updates and delegates them to the provided callbacks.
|
|
300
|
+
*
|
|
301
|
+
* @param onDelta - Called when the drag position changes. Receives the delta as
|
|
302
|
+
* `{ x, y, data }`.
|
|
303
|
+
* @param onStart - Called when the drag begins. Receives the provided `data`.
|
|
304
|
+
* @param onEnd - Called when the drag finishes or is cancelled.
|
|
305
|
+
* Receives `(event, data)` where `event` is either `"up"` (completed) or `"cancel"`.
|
|
306
|
+
* @param data - Arbitrary user data passed back to callbacks.
|
|
307
|
+
* @param style - Optional style applied to the rendered wrapper.
|
|
308
|
+
* @param className - Optional CSS class applied to the rendered wrapper.
|
|
309
|
+
* @param children - Content to render inside the drag handle.
|
|
310
|
+
*/
|
|
311
|
+
export function DragHandle({
|
|
312
|
+
onDelta,
|
|
313
|
+
onStart,
|
|
314
|
+
onEnd,
|
|
315
|
+
style,
|
|
316
|
+
className,
|
|
317
|
+
children,
|
|
318
|
+
data
|
|
319
|
+
}) {
|
|
320
|
+
const activePointerIdRef = useRef(null);
|
|
321
|
+
const startClientXRef = useRef(0);
|
|
322
|
+
const startClientYRef = useRef(0);
|
|
323
|
+
const lastClientXRef = useRef(0);
|
|
324
|
+
const lastClientYRef = useRef(0);
|
|
325
|
+
const draggingRef = useRef(false);
|
|
326
|
+
|
|
327
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
328
|
+
|
|
329
|
+
const resetDrag = useCallback(() => {
|
|
330
|
+
activePointerIdRef.current = null;
|
|
331
|
+
draggingRef.current = false;
|
|
332
|
+
startClientXRef.current = 0;
|
|
333
|
+
startClientYRef.current = 0;
|
|
334
|
+
lastClientXRef.current = 0;
|
|
335
|
+
lastClientYRef.current = 0;
|
|
336
|
+
setIsDragging(false);
|
|
337
|
+
}, []);
|
|
338
|
+
|
|
339
|
+
const computeDeltaFromStart = useCallback((clientX, clientY) => {
|
|
340
|
+
const dx = clientX - startClientXRef.current;
|
|
341
|
+
const dy = clientY - startClientYRef.current;
|
|
342
|
+
return { dx, dy };
|
|
343
|
+
}, []);
|
|
344
|
+
|
|
345
|
+
const endDrag = useCallback((reason = "up") => {
|
|
346
|
+
if (!draggingRef.current) return;
|
|
347
|
+
onEnd?.(reason);
|
|
348
|
+
resetDrag();
|
|
349
|
+
}, [onEnd, resetDrag]);
|
|
350
|
+
|
|
351
|
+
const onPointerDown = useCallback((e) => {
|
|
352
|
+
// todo: only left mouse / primary touch, should other buttons be supported too?
|
|
353
|
+
if (e.button != null && e.button !== 0) return;
|
|
354
|
+
|
|
355
|
+
draggingRef.current = true;
|
|
356
|
+
activePointerIdRef.current = e.pointerId;
|
|
357
|
+
|
|
358
|
+
startClientXRef.current = e.clientX;
|
|
359
|
+
startClientYRef.current = e.clientY;
|
|
360
|
+
lastClientXRef.current = e.clientX;
|
|
361
|
+
lastClientYRef.current = e.clientY;
|
|
362
|
+
|
|
363
|
+
setIsDragging(true);
|
|
364
|
+
onStart?.(data);
|
|
365
|
+
|
|
366
|
+
try {
|
|
367
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
368
|
+
} catch {
|
|
369
|
+
// ignore if unsupported
|
|
370
|
+
}
|
|
371
|
+
}, [onStart]);
|
|
372
|
+
|
|
373
|
+
const onPointerMove = useCallback((e) => {
|
|
374
|
+
if (!draggingRef.current) return;
|
|
375
|
+
if (activePointerIdRef.current !== e.pointerId) return;
|
|
376
|
+
|
|
377
|
+
const { dx, dy } = computeDeltaFromStart(e.clientX, e.clientY);
|
|
378
|
+
onDelta?.(dx, dy, data);
|
|
379
|
+
|
|
380
|
+
lastClientXRef.current = e.clientX;
|
|
381
|
+
lastClientYRef.current = e.clientY;
|
|
382
|
+
}, [computeDeltaFromStart, onDelta]);
|
|
383
|
+
|
|
384
|
+
const onPointerUp = useCallback((e) => {
|
|
385
|
+
if (activePointerIdRef.current !== e.pointerId) return;
|
|
386
|
+
endDrag("up", data);
|
|
387
|
+
}, [endDrag]);
|
|
388
|
+
|
|
389
|
+
const onPointerCancel = useCallback((e) => {
|
|
390
|
+
if (activePointerIdRef.current !== e.pointerId) return;
|
|
391
|
+
endDrag("cancel", data);
|
|
392
|
+
}, [endDrag]);
|
|
393
|
+
|
|
394
|
+
return (
|
|
395
|
+
<div
|
|
396
|
+
role="button"
|
|
397
|
+
tabIndex={0}
|
|
398
|
+
style={{ ...style, touchAction: "none" }}
|
|
399
|
+
className={cx(className, isDragging?"dragging":"")}
|
|
400
|
+
onPointerDown={onPointerDown}
|
|
401
|
+
onPointerMove={onPointerMove}
|
|
402
|
+
onPointerUp={onPointerUp}
|
|
403
|
+
onPointerCancel={onPointerCancel}
|
|
404
|
+
>
|
|
405
|
+
{children}
|
|
406
|
+
</div>
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
const clamp = (n, min, max) => {
|
|
413
|
+
if (!Number.isFinite(n)) return n;
|
|
414
|
+
return Math.min(max, Math.max(min, n));
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* A split-pane container with a draggable splitter, supporting both horizontal and vertical layouts.
|
|
419
|
+
*
|
|
420
|
+
* The pane can be either:
|
|
421
|
+
* - **Controlled** via the `position` prop (number between `min` and `max`), or
|
|
422
|
+
* - **Uncontrolled** via `defaultPosition` (used as the initial position).
|
|
423
|
+
*
|
|
424
|
+
* Layout behavior:
|
|
425
|
+
* - `mode="horizontal"`: the `position` controls the width of the **left** pane.
|
|
426
|
+
* - `mode="vertical"`: the `position` controls the height of the **top** pane.
|
|
427
|
+
*
|
|
428
|
+
* Ref API:
|
|
429
|
+
* - Exposes imperative methods on `ref.current`:
|
|
430
|
+
* - `getMode()` to get the current mode
|
|
431
|
+
* - `setMode(mode)` to switch between `"horizontal"` and `"vertical"`
|
|
432
|
+
* - `getPosition()` to get the current splitter position
|
|
433
|
+
* - `setPosition(position)` to update the splitter position
|
|
434
|
+
*
|
|
435
|
+
* Events:
|
|
436
|
+
* - Calls `onSizeChange(position)` whenever the pane size/position changes (e.g., via dragging).
|
|
437
|
+
*
|
|
438
|
+
* Rendering:
|
|
439
|
+
* - Renders `children` into two separate containers (no portals).
|
|
440
|
+
*
|
|
441
|
+
* @param mode - Split direction: `"horizontal"` or `"vertical"`. Defaults to `"horizontal"`.
|
|
442
|
+
* @param position - Controlled splitter position. Normalized value within `[min, max]`.
|
|
443
|
+
* If provided, the component uses this value instead of internal state.
|
|
444
|
+
* @param defaultPosition - Initial splitter position for uncontrolled usage. Defaults to `0.5`.
|
|
445
|
+
* @param min - Minimum allowed position. Defaults to `0.1`.
|
|
446
|
+
* @param max - Maximum allowed position. Defaults to `0.9`.
|
|
447
|
+
* @param splitterSize - Thickness of the draggable splitter in pixels. Defaults to `8`.
|
|
448
|
+
* @param onSizeChange - Callback invoked when the position changes. Receives the new normalized position.
|
|
449
|
+
* @param style - Optional root container styles.
|
|
450
|
+
* @param className - Optional root container CSS class.
|
|
451
|
+
* @param leftPaneStyle - Optional styles applied to the left pane (or top pane in vertical mode).
|
|
452
|
+
* @param rightPaneStyle - Optional styles applied to the right pane (or bottom pane in vertical mode).
|
|
453
|
+
* @param splitterStyle - Optional styles applied to the splitter element.
|
|
454
|
+
* @param children - React children to be rendered into the two pane containers.
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```tsx
|
|
458
|
+
* const ref = useRef<SplitPaneHandle>(null);
|
|
459
|
+
*
|
|
460
|
+
* <SplitPane
|
|
461
|
+
* ref={ref}
|
|
462
|
+
* mode="horizontal"
|
|
463
|
+
* defaultPosition={0.5}
|
|
464
|
+
* min={0.1}
|
|
465
|
+
* max={0.9}
|
|
466
|
+
* onSizeChange={(pos) => console.log(pos)}
|
|
467
|
+
* >
|
|
468
|
+
* <div /> <div />
|
|
469
|
+
* </SplitPane>
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
export const SplitPane = forwardRef(function SplitPane(
|
|
473
|
+
{
|
|
474
|
+
mode = "horizontal",
|
|
475
|
+
position, // controlled: number | undefined/null
|
|
476
|
+
defaultPosition = 0.5,
|
|
477
|
+
min = 0.1,
|
|
478
|
+
max = 0.9,
|
|
479
|
+
splitterSize = 8,
|
|
480
|
+
onSizeChange,
|
|
481
|
+
style,
|
|
482
|
+
className,
|
|
483
|
+
leftPaneStyle,
|
|
484
|
+
rightPaneStyle,
|
|
485
|
+
splitterStyle,
|
|
486
|
+
children,
|
|
487
|
+
},
|
|
488
|
+
ref
|
|
489
|
+
) {
|
|
490
|
+
const containerRef = useRef(null);
|
|
491
|
+
const panes = Children.toArray(children);
|
|
492
|
+
const leftChild = panes[0] ?? null;
|
|
493
|
+
const rightChild = panes[1] ?? null;
|
|
494
|
+
|
|
495
|
+
const isControlled = position != null;
|
|
496
|
+
|
|
497
|
+
const [internalMode, setInternalMode] = useState(mode);
|
|
498
|
+
|
|
499
|
+
const [posUncontrolled, setPosUncontrolled] = useState(() =>
|
|
500
|
+
clamp(
|
|
501
|
+
position ?? defaultPosition,
|
|
502
|
+
min,
|
|
503
|
+
max
|
|
504
|
+
)
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
if (mode != null) setInternalMode(mode);
|
|
509
|
+
}, [mode]);
|
|
510
|
+
|
|
511
|
+
// keep internal position clamped if min/max change (uncontrolled only)
|
|
512
|
+
useLayoutEffect(() => {
|
|
513
|
+
if (isControlled) return;
|
|
514
|
+
setPosUncontrolled((p) => clamp(p, min, max));
|
|
515
|
+
}, [min, max, isControlled]);
|
|
516
|
+
|
|
517
|
+
const posResolved = isControlled ? clamp(position, min, max) : posUncontrolled;
|
|
518
|
+
|
|
519
|
+
const setPosition = (next) => {
|
|
520
|
+
const clamped = clamp(next, min, max);
|
|
521
|
+
if (!isControlled) setPosUncontrolled(clamped);
|
|
522
|
+
onSizeChange?.(clamped);
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
const draggingRef = useRef(false);
|
|
526
|
+
const pointerIdRef = useRef(null);
|
|
527
|
+
|
|
528
|
+
const updateFromClient = (clientX, clientY) => {
|
|
529
|
+
const el = containerRef.current;
|
|
530
|
+
if (!el) return;
|
|
531
|
+
|
|
532
|
+
const rect = el.getBoundingClientRect();
|
|
533
|
+
|
|
534
|
+
if (internalMode === "horizontal") {
|
|
535
|
+
const usable = rect.width;
|
|
536
|
+
if (!Number.isFinite(usable) || usable <= 0) return; // no jump on init
|
|
537
|
+
const raw = (clientX - rect.left) / usable;
|
|
538
|
+
if (!Number.isFinite(raw)) return;
|
|
539
|
+
setPosition(raw);
|
|
540
|
+
} else {
|
|
541
|
+
const usable = rect.height;
|
|
542
|
+
if (!Number.isFinite(usable) || usable <= 0) return; // no jump on init
|
|
543
|
+
const raw = (clientY - rect.top) / usable;
|
|
544
|
+
if (!Number.isFinite(raw)) return;
|
|
545
|
+
setPosition(raw);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// stable global listeners: only act while draggingRef.current === true
|
|
550
|
+
useEffect(() => {
|
|
551
|
+
const onMove = (e) => {
|
|
552
|
+
if (!draggingRef.current) return;
|
|
553
|
+
if (pointerIdRef.current != null && e.pointerId !== pointerIdRef.current) return;
|
|
554
|
+
updateFromClient(e.clientX, e.clientY);
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const stop = (e) => {
|
|
558
|
+
if (!draggingRef.current) return;
|
|
559
|
+
if (pointerIdRef.current != null && e.pointerId !== pointerIdRef.current) return;
|
|
560
|
+
draggingRef.current = false;
|
|
561
|
+
pointerIdRef.current = null;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
window.addEventListener("pointermove", onMove, { passive: true });
|
|
565
|
+
window.addEventListener("pointerup", stop, { passive: true });
|
|
566
|
+
window.addEventListener("pointercancel", stop, { passive: true });
|
|
567
|
+
|
|
568
|
+
return () => {
|
|
569
|
+
window.removeEventListener("pointermove", onMove);
|
|
570
|
+
window.removeEventListener("pointerup", stop);
|
|
571
|
+
window.removeEventListener("pointercancel", stop);
|
|
572
|
+
};
|
|
573
|
+
}, [internalMode]); // updateFromClient uses internalMode
|
|
574
|
+
|
|
575
|
+
const onPointerDown = (e) => {
|
|
576
|
+
if (e.button != null && e.button !== 0) return;
|
|
577
|
+
e.preventDefault();
|
|
578
|
+
|
|
579
|
+
draggingRef.current = true;
|
|
580
|
+
pointerIdRef.current = e.pointerId;
|
|
581
|
+
|
|
582
|
+
try {
|
|
583
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
584
|
+
} catch {}
|
|
585
|
+
|
|
586
|
+
updateFromClient(e.clientX, e.clientY); // first update only if rect is sane
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
const onKeyDown = (e) => {
|
|
590
|
+
const step = 0.02;
|
|
591
|
+
let delta = 0;
|
|
592
|
+
|
|
593
|
+
if (internalMode === "horizontal") {
|
|
594
|
+
if (e.key === "ArrowLeft") delta = -step;
|
|
595
|
+
if (e.key === "ArrowRight") delta = step;
|
|
596
|
+
} else {
|
|
597
|
+
if (e.key === "ArrowUp") delta = -step;
|
|
598
|
+
if (e.key === "ArrowDown") delta = step;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
if (delta !== 0) {
|
|
602
|
+
e.preventDefault();
|
|
603
|
+
setPosition(posResolved + delta);
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const sizes = useMemo(() => {
|
|
608
|
+
const leftPct = `${posResolved * 100}%`;
|
|
609
|
+
const rightCalc = `calc(${100 - posResolved * 100}% - ${splitterSize}px)`;
|
|
610
|
+
return { leftPct, rightCalc };
|
|
611
|
+
}, [posResolved, splitterSize]);
|
|
612
|
+
|
|
613
|
+
const rootStyle = {
|
|
614
|
+
display: "flex",
|
|
615
|
+
width: "100%",
|
|
616
|
+
height: "100%",
|
|
617
|
+
overflow: "hidden",
|
|
618
|
+
touchAction: "none",
|
|
619
|
+
...(style || {}),
|
|
620
|
+
flexDirection: internalMode === "horizontal" ? "row" : "column",
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
const leftPaneComputed =
|
|
624
|
+
internalMode === "horizontal"
|
|
625
|
+
? { width: sizes.leftPct, flex: `0 0 ${sizes.leftPct}`, overflow: "auto", ...(leftPaneStyle || {}) }
|
|
626
|
+
: { height: sizes.leftPct, flex: `0 0 ${sizes.leftPct}`, overflow: "auto", ...(leftPaneStyle || {}) };
|
|
627
|
+
|
|
628
|
+
const rightPaneComputed =
|
|
629
|
+
internalMode === "horizontal"
|
|
630
|
+
? { width: sizes.rightCalc, flex: "1 1 auto", overflow: "auto", ...(rightPaneStyle || {}) }
|
|
631
|
+
: { height: sizes.rightCalc, flex: "1 1 auto", overflow: "auto", ...(rightPaneStyle || {}) };
|
|
632
|
+
|
|
633
|
+
const splitterComputed =
|
|
634
|
+
internalMode === "horizontal"
|
|
635
|
+
? { width: `${splitterSize}px`, transform: "translateX(-50%)", height: '100%', flex: `0 0 ${splitterSize}px`, background: "rgba(0,0,0,0.08)", cursor: "col-resize", ...(splitterStyle || {}) }
|
|
636
|
+
: { height: `${splitterSize}px`, transform: "translateY(-50%)", width: '100%', flex: `0 0 ${splitterSize}px`, background: "rgba(0,0,0,0.08)", cursor: "row-resize", ...(splitterStyle || {}) };
|
|
637
|
+
|
|
638
|
+
const dividerVisualStyle =
|
|
639
|
+
internalMode === "horizontal"
|
|
640
|
+
? { height: "100%", width: "100%" }
|
|
641
|
+
: { width: "100%", height: "100%" };
|
|
642
|
+
|
|
643
|
+
useImperativeHandle(ref, () => ({
|
|
644
|
+
setPosition,
|
|
645
|
+
setMode: (nextMode) => setInternalMode(nextMode === "vertical" ? "vertical" : "horizontal"),
|
|
646
|
+
getPosition: () => posResolved,
|
|
647
|
+
getMode: () => internalMode,
|
|
648
|
+
}));
|
|
649
|
+
|
|
650
|
+
return (
|
|
651
|
+
<div ref={containerRef} className={className} style={rootStyle}>
|
|
652
|
+
<div style={leftPaneComputed}>{leftChild}</div>
|
|
653
|
+
|
|
654
|
+
<div
|
|
655
|
+
role="separator"
|
|
656
|
+
aria-orientation={internalMode === "horizontal" ? "vertical" : "horizontal"}
|
|
657
|
+
aria-valuemin={min}
|
|
658
|
+
aria-valuemax={max}
|
|
659
|
+
aria-valuenow={posResolved}
|
|
660
|
+
tabIndex={0}
|
|
661
|
+
onPointerDown={onPointerDown}
|
|
662
|
+
onPointerCancel={() => {
|
|
663
|
+
draggingRef.current = false;
|
|
664
|
+
pointerIdRef.current = null;
|
|
665
|
+
}}
|
|
666
|
+
onKeyDown={onKeyDown}
|
|
667
|
+
style={splitterComputed}
|
|
668
|
+
>
|
|
669
|
+
<div style={dividerVisualStyle} />
|
|
670
|
+
</div>
|
|
671
|
+
|
|
672
|
+
<div style={rightPaneComputed}>{rightChild}</div>
|
|
673
|
+
</div>
|
|
674
|
+
);
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
|
package/src/components.jsx
CHANGED
|
@@ -195,11 +195,22 @@ class ComponentCore
|
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
if(next_props.ref) {
|
|
198
|
-
if(
|
|
199
|
-
|
|
198
|
+
if(typeof(next_props.ref)==='function') {
|
|
199
|
+
if(this.element) {
|
|
200
|
+
next_props.ref(this.element);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
next_props.ref(this.component);
|
|
204
|
+
}
|
|
205
|
+
|
|
200
206
|
}
|
|
201
207
|
else {
|
|
202
|
-
|
|
208
|
+
if(this.element) {
|
|
209
|
+
next_props.ref.current = this.element;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
next_props.ref.current = this.component;
|
|
213
|
+
}
|
|
203
214
|
}
|
|
204
215
|
}
|
|
205
216
|
|
|
@@ -311,7 +322,16 @@ class ComponentCore
|
|
|
311
322
|
{
|
|
312
323
|
try {
|
|
313
324
|
const promises = [];
|
|
314
|
-
|
|
325
|
+
|
|
326
|
+
if(this.props?.ref) {
|
|
327
|
+
if(typeof(this.props.ref)==='function') {
|
|
328
|
+
this.props.ref(null);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.props.current = null;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
315
335
|
if(this.component.componentWillUnmount) {
|
|
316
336
|
this.component.componentWillUnmount();
|
|
317
337
|
}
|
package/src/lilact.jsx
CHANGED
|
@@ -63,7 +63,6 @@ import * as misc from './misc.jsx';
|
|
|
63
63
|
import * as errors from './errors.jsx';
|
|
64
64
|
import * as router from './router.jsx';
|
|
65
65
|
import * as accessories from './accessories.jsx';
|
|
66
|
-
import {ResizablePane} from './pane.jsx';
|
|
67
66
|
import {transpileJSX, transpilerConfig} from "./jsx";
|
|
68
67
|
|
|
69
68
|
|
|
@@ -80,7 +79,6 @@ export * from './misc.jsx';
|
|
|
80
79
|
export * from './errors.jsx';
|
|
81
80
|
export * from './router.jsx';
|
|
82
81
|
export * from './accessories.jsx';
|
|
83
|
-
export {ResizablePane} from './pane.jsx';
|
|
84
82
|
export {transpileJSX, transpilerConfig} from "./jsx";
|
|
85
83
|
|
|
86
84
|
|
|
@@ -94,7 +92,7 @@ export {transpileJSX, transpilerConfig} from "./jsx";
|
|
|
94
92
|
export const Lilact =
|
|
95
93
|
{
|
|
96
94
|
|
|
97
|
-
VERSION: "beta.
|
|
95
|
+
VERSION: "beta.13",
|
|
98
96
|
|
|
99
97
|
// Configuration
|
|
100
98
|
|
|
@@ -117,8 +115,6 @@ export const Lilact =
|
|
|
117
115
|
...router,
|
|
118
116
|
...accessories,
|
|
119
117
|
|
|
120
|
-
ResizablePane,
|
|
121
|
-
|
|
122
118
|
transpileJSX,
|
|
123
119
|
transpilerConfig,
|
|
124
120
|
|
package/typedoc.json
CHANGED
package/docs/modules/pane.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>pane | Lilact</title><meta name="description" content="Documentation for Lilact"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Lilact</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">pane</a></li></ul><h1>Module pane</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Variables"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Variables</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary" id="resizablepane"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Variable"><use href="../assets/icons.svg#icon-32"></use></svg><a href="../variables/pane.ResizablePane.html">ResizablePane</a><a href="#resizablepane" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Variables"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Variables</summary><div><a href="#resizablepane"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Variable"><use href="../assets/icons.svg#icon-32"></use></svg><span>Resizable<wbr/>Pane</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Lilact</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|