@adecore/ui 0.17.0-beta.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +97 -8
- package/README.md +1 -1
- package/dist/Select.js +2 -1
- package/dist/file-tree/shift.js +0 -1
- package/dist/file-tree/style.js +0 -1
- package/dist/file-tree/use-file-tree-shift.js +0 -1
- package/dist/menu/parts.js +2 -1
- package/dist/popover/parts.js +2 -1
- package/dist/popup-layer.d.ts +6 -0
- package/dist/popup-layer.js +30 -0
- package/dist/theme.css +1 -1
- package/package.json +2 -2
- package/src/Select.tsx +9 -1
- package/src/file-tree/helpers.ts +0 -1
- package/src/file-tree/shift.ts +0 -1
- package/src/file-tree/style.ts +0 -1
- package/src/file-tree/use-file-tree-shift.tsx +0 -1
- package/src/menu/parts.tsx +2 -0
- package/src/popover/parts.tsx +2 -0
- package/src/popup-layer.ts +34 -0
- package/src/theme.css +1 -1
- package/src/file-tree/LICENSE +0 -110
package/LICENSE
CHANGED
|
@@ -1,13 +1,102 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Abbreviation
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 - present Bas Milius
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
11
100
|
|
|
12
101
|
The above copyright notice and this permission notice shall be included in all
|
|
13
102
|
copies or substantial portions of the Software.
|
package/README.md
CHANGED
package/dist/Select.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ChevronDown } from 'lucide-react';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Icon } from './Icon.js';
|
|
7
7
|
import { MENU_LABEL, MenuCheck } from './menu/parts.js';
|
|
8
|
+
import { renderPositioner } from './popup-layer.js';
|
|
8
9
|
const isGroup = (entry) => Array.isArray(entry.items);
|
|
9
10
|
const TRIGGER_SIZE = {
|
|
10
11
|
sm: 'h-7 gap-1 px-2',
|
|
@@ -28,7 +29,7 @@ export function Select({ value, onValueChange, items, label, placeholder, size =
|
|
|
28
29
|
const groups = items.length > 0 && isGroup(items[0]) ? items : null;
|
|
29
30
|
const flat = groups ? groups.flatMap((group) => group.items) : items;
|
|
30
31
|
const selected = flat.find((item) => item.value === value) ?? null;
|
|
31
|
-
return (_jsxs(BaseSelect.Root, { items: flat.map((item) => ({ value: item.value, label: item.label })), value: value, disabled: disabled, onValueChange: (next) => onValueChange(next), children: [_jsxs(BaseSelect.Trigger, { ref: ref, "aria-label": label, className: clsx('flex shrink-0 items-center whitespace-nowrap text-xs', TRIGGER_SIZE[size], TRIGGER_VARIANT[variant], TRIGGER_DISABLED, className), children: [selected?.icon, _jsx(BaseSelect.Value, { className: clsx(truncateValue && 'truncate'), children: () => selected?.label ?? placeholder ?? t('action.select') }), _jsx(BaseSelect.Icon, { className: "ml-auto flex shrink-0 pl-1", children: _jsx(Icon, { icon: ChevronDown, size: 14 }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { className: "popup-positioner", side: "bottom", align: align, sideOffset: 6, alignItemWithTrigger: false, children: _jsx(BaseSelect.Popup, { className: "menu-popup", children: _jsx(BaseSelect.List, { className: "max-h-80 overflow-auto", children: groups
|
|
32
|
+
return (_jsxs(BaseSelect.Root, { items: flat.map((item) => ({ value: item.value, label: item.label })), value: value, disabled: disabled, onValueChange: (next) => onValueChange(next), children: [_jsxs(BaseSelect.Trigger, { ref: ref, "aria-label": label, className: clsx('flex shrink-0 items-center whitespace-nowrap text-xs', TRIGGER_SIZE[size], TRIGGER_VARIANT[variant], TRIGGER_DISABLED, className), children: [selected?.icon, _jsx(BaseSelect.Value, { className: clsx(truncateValue && 'truncate'), children: () => selected?.label ?? placeholder ?? t('action.select') }), _jsx(BaseSelect.Icon, { className: "ml-auto flex shrink-0 pl-1", children: _jsx(Icon, { icon: ChevronDown, size: 14 }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { className: "popup-positioner", render: renderPositioner, side: "bottom", align: align, sideOffset: 6, alignItemWithTrigger: false, children: _jsx(BaseSelect.Popup, { className: "menu-popup", children: _jsx(BaseSelect.List, { className: "max-h-80 overflow-auto", children: groups
|
|
32
33
|
? groups.map((group) => (_jsxs(BaseSelect.Group, { children: [_jsx(BaseSelect.GroupLabel, { className: MENU_LABEL, children: group.label }), group.items.map((item) => (_jsx(Row, { item: item, picked: item.value === value }, item.value)))] }, group.label)))
|
|
33
34
|
: flat.map((item) => _jsx(Row, { item: item, picked: item.value === value }, item.value)) }) }) }) })] }));
|
|
34
35
|
}
|
package/dist/file-tree/shift.js
CHANGED
package/dist/file-tree/style.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// SPDX-License-Identifier: FSL-1.1-MIT
|
|
3
2
|
import { useEffect, useState } from 'react';
|
|
4
3
|
import { clampShift, maxShift, SHIFT_PROPERTY, shiftNeed, shiftThumb, sidewaysDelta } from './shift.js';
|
|
5
4
|
const ROWS = '[data-type="item"]:not([data-item-parked="true"])';
|
package/dist/menu/parts.js
CHANGED
|
@@ -9,6 +9,7 @@ import { useRender } from '@base-ui-components/react/use-render';
|
|
|
9
9
|
import { withClass } from '../class-name.js';
|
|
10
10
|
import { Icon } from '../Icon.js';
|
|
11
11
|
import { Tooltip } from '../Tooltip.js';
|
|
12
|
+
import { renderPositioner } from '../popup-layer.js';
|
|
12
13
|
const MenuKindContext = createContext('menu');
|
|
13
14
|
/*
|
|
14
15
|
* A menu hangs under its trigger, lined up with its start, unless there is no room. A context menu
|
|
@@ -45,7 +46,7 @@ export const ContextMenuTrigger = BaseContextMenu.Trigger;
|
|
|
45
46
|
*/
|
|
46
47
|
export function MenuPopup({ side, align, sideOffset, alignOffset, collisionPadding, collisionBoundary, collisionAvoidance, anchor, sticky, positionMethod, className, ...props }) {
|
|
47
48
|
const defaults = PLACEMENT[useContext(MenuKindContext)];
|
|
48
|
-
return (_jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { className: "popup-positioner", side: side ?? defaults.side, align: align ?? defaults.align, sideOffset: sideOffset ?? defaults.sideOffset, alignOffset: alignOffset ?? defaults.alignOffset, collisionPadding: collisionPadding, collisionBoundary: collisionBoundary, collisionAvoidance: collisionAvoidance, anchor: anchor, sticky: sticky, positionMethod: positionMethod, children: _jsx(BaseMenu.Popup, { className: withClass('menu-popup', className), ...props }) }) }));
|
|
49
|
+
return (_jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { className: "popup-positioner", render: renderPositioner, side: side ?? defaults.side, align: align ?? defaults.align, sideOffset: sideOffset ?? defaults.sideOffset, alignOffset: alignOffset ?? defaults.alignOffset, collisionPadding: collisionPadding, collisionBoundary: collisionBoundary, collisionAvoidance: collisionAvoidance, anchor: anchor, sticky: sticky, positionMethod: positionMethod, children: _jsx(BaseMenu.Popup, { className: withClass('menu-popup', className), ...props }) }) }));
|
|
49
50
|
}
|
|
50
51
|
export function MenuItem({ unstyled = false, className, ...props }) {
|
|
51
52
|
return _jsx(BaseMenu.Item, { className: unstyled ? className : withClass('menu-item', className), ...props });
|
package/dist/popover/parts.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Popover as BasePopover } from '@base-ui-components/react/popover';
|
|
3
3
|
import { PreviewCard as BasePreviewCard } from '@base-ui-components/react/preview-card';
|
|
4
4
|
import { withClass } from '../class-name.js';
|
|
5
|
+
import { renderPositioner } from '../popup-layer.js';
|
|
5
6
|
/*
|
|
6
7
|
* The surface a popup is drawn on. `menu` is the padded card menus use, `picker` a card whose
|
|
7
8
|
* content runs to its edges (a search field on top of a list), and `plain` leaves the surface to the caller.
|
|
@@ -18,7 +19,7 @@ export const PopoverTitle = BasePopover.Title;
|
|
|
18
19
|
export const PopoverDescription = BasePopover.Description;
|
|
19
20
|
/* The portal, the positioner and the popup of a popover: under its trigger and lined up with its start unless it says otherwise. */
|
|
20
21
|
export function PopoverPopup({ variant = 'menu', side = 'bottom', align = 'start', sideOffset = 8, alignOffset, collisionPadding, collisionBoundary, collisionAvoidance, anchor, sticky, positionMethod, className, ...props }) {
|
|
21
|
-
return (_jsx(BasePopover.Portal, { children: _jsx(BasePopover.Positioner, { className: "popup-positioner", side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, collisionPadding: collisionPadding, collisionBoundary: collisionBoundary, collisionAvoidance: collisionAvoidance, anchor: anchor, sticky: sticky, positionMethod: positionMethod, children: _jsx(BasePopover.Popup, { className: withClass(POPUP_VARIANT[variant], className), ...props }) }) }));
|
|
22
|
+
return (_jsx(BasePopover.Portal, { children: _jsx(BasePopover.Positioner, { className: "popup-positioner", render: renderPositioner, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, collisionPadding: collisionPadding, collisionBoundary: collisionBoundary, collisionAvoidance: collisionAvoidance, anchor: anchor, sticky: sticky, positionMethod: positionMethod, children: _jsx(BasePopover.Popup, { className: withClass(POPUP_VARIANT[variant], className), ...props }) }) }));
|
|
22
23
|
}
|
|
23
24
|
export const PreviewCardRoot = BasePreviewCard.Root;
|
|
24
25
|
export const PreviewCardTrigger = BasePreviewCard.Trigger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
export declare const renderPositioner: (props: ComponentProps<'div'>, state: {
|
|
3
|
+
open: boolean;
|
|
4
|
+
}) => import("react").FunctionComponentElement<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
readonly open: boolean;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createElement, useLayoutEffect } from 'react';
|
|
2
|
+
// One attribute serves every open popup, so it stays until the last one closes.
|
|
3
|
+
const open = new Set();
|
|
4
|
+
/*
|
|
5
|
+
* Marks the root with `data-popup-open` while a popup is open, which the theme reads to turn the
|
|
6
|
+
* window's drag regions off. An attribute on the root instead of `:root:has(...)`, which made the
|
|
7
|
+
* browser restyle the whole page on every DOM insertion.
|
|
8
|
+
*/
|
|
9
|
+
function usePopupLayer(isOpen) {
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
if (!isOpen) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const self = Symbol('popup');
|
|
15
|
+
open.add(self);
|
|
16
|
+
document.documentElement.setAttribute('data-popup-open', '');
|
|
17
|
+
return () => {
|
|
18
|
+
open.delete(self);
|
|
19
|
+
if (open.size === 0) {
|
|
20
|
+
document.documentElement.removeAttribute('data-popup-open');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, [isOpen]);
|
|
24
|
+
}
|
|
25
|
+
function LayerPositioner({ open: isOpen, ...props }) {
|
|
26
|
+
usePopupLayer(isOpen);
|
|
27
|
+
return createElement('div', props);
|
|
28
|
+
}
|
|
29
|
+
/* The `render` of a popup's positioner, which knows whether the popup is open and so marks the root for as long as it is. */
|
|
30
|
+
export const renderPositioner = (props, state) => createElement(LayerPositioner, { ...props, open: state.open });
|
package/dist/theme.css
CHANGED
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
/* A press on a window's drag region goes to the system and never reaches the page, so a popup
|
|
425
425
|
that closes on a press outside it would stay open over a custom title bar. While one is open
|
|
426
426
|
nothing drags, the way a native title bar takes that first press to close a menu. */
|
|
427
|
-
:root
|
|
427
|
+
:root[data-popup-open] * { -webkit-app-region: no-drag; }
|
|
428
428
|
.dialog-backdrop { position: fixed; inset: 0; z-index: var(--z-dialog-backdrop); background: color-mix(in srgb, var(--bg) 55%, transparent); }
|
|
429
429
|
.dialog-backdrop[data-starting-style], .dialog-backdrop[data-ending-style] { opacity: 0; }
|
|
430
430
|
.dialog-popup {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/ui",
|
|
3
|
-
"version": "0.17.0
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "React components, a theme, formatters and a settings dialog for desktop-grade apps on React 19, Base UI and Tailwind 4.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "FSL-1.1-MIT",
|
|
6
6
|
"author": "Bas Milius",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/src/Select.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { ChevronDown } from 'lucide-react';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Icon } from './Icon.tsx';
|
|
7
7
|
import { MENU_LABEL, MenuCheck } from './menu/parts.tsx';
|
|
8
|
+
import { renderPositioner } from './popup-layer.ts';
|
|
8
9
|
|
|
9
10
|
export interface SelectItem<T extends string> {
|
|
10
11
|
value: T;
|
|
@@ -113,7 +114,14 @@ export function Select<T extends string>({
|
|
|
113
114
|
</BaseSelect.Icon>
|
|
114
115
|
</BaseSelect.Trigger>
|
|
115
116
|
<BaseSelect.Portal>
|
|
116
|
-
<BaseSelect.Positioner
|
|
117
|
+
<BaseSelect.Positioner
|
|
118
|
+
className="popup-positioner"
|
|
119
|
+
render={renderPositioner}
|
|
120
|
+
side="bottom"
|
|
121
|
+
align={align}
|
|
122
|
+
sideOffset={6}
|
|
123
|
+
alignItemWithTrigger={false}
|
|
124
|
+
>
|
|
117
125
|
<BaseSelect.Popup className="menu-popup">
|
|
118
126
|
<BaseSelect.List className="max-h-80 overflow-auto">
|
|
119
127
|
{groups
|
package/src/file-tree/helpers.ts
CHANGED
package/src/file-tree/shift.ts
CHANGED
package/src/file-tree/style.ts
CHANGED
package/src/menu/parts.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { useRender } from '@base-ui-components/react/use-render';
|
|
|
8
8
|
import { withClass } from '../class-name.ts';
|
|
9
9
|
import { Icon } from '../Icon.tsx';
|
|
10
10
|
import { Tooltip } from '../Tooltip.tsx';
|
|
11
|
+
import { renderPositioner } from '../popup-layer.ts';
|
|
11
12
|
|
|
12
13
|
/* Where a popup opens from decides where it goes when a call site says nothing. */
|
|
13
14
|
type MenuKind = 'menu' | 'context' | 'submenu';
|
|
@@ -96,6 +97,7 @@ export function MenuPopup({
|
|
|
96
97
|
<BaseMenu.Portal>
|
|
97
98
|
<BaseMenu.Positioner
|
|
98
99
|
className="popup-positioner"
|
|
100
|
+
render={renderPositioner}
|
|
99
101
|
side={side ?? defaults.side}
|
|
100
102
|
align={align ?? defaults.align}
|
|
101
103
|
sideOffset={sideOffset ?? defaults.sideOffset}
|
package/src/popover/parts.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import type { ComponentProps } from 'react';
|
|
|
2
2
|
import { Popover as BasePopover } from '@base-ui-components/react/popover';
|
|
3
3
|
import { PreviewCard as BasePreviewCard } from '@base-ui-components/react/preview-card';
|
|
4
4
|
import { withClass } from '../class-name.ts';
|
|
5
|
+
import { renderPositioner } from '../popup-layer.ts';
|
|
5
6
|
|
|
6
7
|
/*
|
|
7
8
|
* The surface a popup is drawn on. `menu` is the padded card menus use, `picker` a card whose
|
|
@@ -55,6 +56,7 @@ export function PopoverPopup({
|
|
|
55
56
|
<BasePopover.Portal>
|
|
56
57
|
<BasePopover.Positioner
|
|
57
58
|
className="popup-positioner"
|
|
59
|
+
render={renderPositioner}
|
|
58
60
|
side={side}
|
|
59
61
|
align={align}
|
|
60
62
|
sideOffset={sideOffset}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createElement, useLayoutEffect, type ComponentProps } from 'react';
|
|
2
|
+
|
|
3
|
+
// One attribute serves every open popup, so it stays until the last one closes.
|
|
4
|
+
const open = new Set<symbol>();
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Marks the root with `data-popup-open` while a popup is open, which the theme reads to turn the
|
|
8
|
+
* window's drag regions off. An attribute on the root instead of `:root:has(...)`, which made the
|
|
9
|
+
* browser restyle the whole page on every DOM insertion.
|
|
10
|
+
*/
|
|
11
|
+
function usePopupLayer(isOpen: boolean): void {
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
if (!isOpen) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const self = Symbol('popup');
|
|
17
|
+
open.add(self);
|
|
18
|
+
document.documentElement.setAttribute('data-popup-open', '');
|
|
19
|
+
return () => {
|
|
20
|
+
open.delete(self);
|
|
21
|
+
if (open.size === 0) {
|
|
22
|
+
document.documentElement.removeAttribute('data-popup-open');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}, [isOpen]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function LayerPositioner({ open: isOpen, ...props }: ComponentProps<'div'> & { readonly open: boolean }) {
|
|
29
|
+
usePopupLayer(isOpen);
|
|
30
|
+
return createElement('div', props);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* The `render` of a popup's positioner, which knows whether the popup is open and so marks the root for as long as it is. */
|
|
34
|
+
export const renderPositioner = (props: ComponentProps<'div'>, state: { open: boolean }) => createElement(LayerPositioner, { ...props, open: state.open });
|
package/src/theme.css
CHANGED
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
/* A press on a window's drag region goes to the system and never reaches the page, so a popup
|
|
425
425
|
that closes on a press outside it would stay open over a custom title bar. While one is open
|
|
426
426
|
nothing drags, the way a native title bar takes that first press to close a menu. */
|
|
427
|
-
:root
|
|
427
|
+
:root[data-popup-open] * { -webkit-app-region: no-drag; }
|
|
428
428
|
.dialog-backdrop { position: fixed; inset: 0; z-index: var(--z-dialog-backdrop); background: color-mix(in srgb, var(--bg) 55%, transparent); }
|
|
429
429
|
.dialog-backdrop[data-starting-style], .dialog-backdrop[data-ending-style] { opacity: 0; }
|
|
430
430
|
.dialog-popup {
|
package/src/file-tree/LICENSE
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
-
|
|
3
|
-
## Abbreviation
|
|
4
|
-
|
|
5
|
-
FSL-1.1-MIT
|
|
6
|
-
|
|
7
|
-
## Notice
|
|
8
|
-
|
|
9
|
-
Copyright 2026 Bas Milius
|
|
10
|
-
|
|
11
|
-
## Terms and Conditions
|
|
12
|
-
|
|
13
|
-
### Licensor ("We")
|
|
14
|
-
|
|
15
|
-
The party offering the Software under these Terms and Conditions.
|
|
16
|
-
|
|
17
|
-
### The Software
|
|
18
|
-
|
|
19
|
-
The "Software" is each version of the software that we make available under
|
|
20
|
-
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
-
Conditions with the Software.
|
|
22
|
-
|
|
23
|
-
### License Grant
|
|
24
|
-
|
|
25
|
-
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
-
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
-
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
-
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
-
|
|
30
|
-
### Permitted Purpose
|
|
31
|
-
|
|
32
|
-
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
-
means making the Software available to others in a commercial product or
|
|
34
|
-
service that:
|
|
35
|
-
|
|
36
|
-
1. substitutes for the Software;
|
|
37
|
-
|
|
38
|
-
2. substitutes for any other product or service we offer using the Software
|
|
39
|
-
that exists as of the date we make the Software available; or
|
|
40
|
-
|
|
41
|
-
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
-
|
|
43
|
-
Permitted Purposes specifically include using the Software:
|
|
44
|
-
|
|
45
|
-
1. for your internal use and access;
|
|
46
|
-
|
|
47
|
-
2. for non-commercial education;
|
|
48
|
-
|
|
49
|
-
3. for non-commercial research; and
|
|
50
|
-
|
|
51
|
-
4. in connection with professional services that you provide to a licensee
|
|
52
|
-
using the Software in accordance with these Terms and Conditions.
|
|
53
|
-
|
|
54
|
-
### Patents
|
|
55
|
-
|
|
56
|
-
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
-
patents, the license grant above includes a license under our patents. If you
|
|
58
|
-
make a claim against any party that the Software infringes or contributes to
|
|
59
|
-
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
-
immediately.
|
|
61
|
-
|
|
62
|
-
### Redistribution
|
|
63
|
-
|
|
64
|
-
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
-
the Software.
|
|
66
|
-
|
|
67
|
-
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
-
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
-
remove any copyright notices provided in or with the Software.
|
|
70
|
-
|
|
71
|
-
### Disclaimer
|
|
72
|
-
|
|
73
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
-
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
-
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
-
|
|
77
|
-
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
-
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
-
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
-
|
|
81
|
-
### Trademarks
|
|
82
|
-
|
|
83
|
-
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
-
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
-
trademarks, trade names, service marks or product names.
|
|
86
|
-
|
|
87
|
-
## Grant of Future License
|
|
88
|
-
|
|
89
|
-
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
-
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
-
the Software available. On or after that date, you may use the Software under
|
|
92
|
-
the MIT license, in which case the following will apply:
|
|
93
|
-
|
|
94
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
-
the Software without restriction, including without limitation the rights to
|
|
97
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
-
so, subject to the following conditions:
|
|
100
|
-
|
|
101
|
-
The above copyright notice and this permission notice shall be included in all
|
|
102
|
-
copies or substantial portions of the Software.
|
|
103
|
-
|
|
104
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
-
SOFTWARE.
|