@deepfuture/dui-components 0.0.11 → 0.0.13
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 +191 -0
- package/_deprecated/center/center.js +2 -2
- package/_deprecated/center/index.d.ts +3 -1
- package/_deprecated/center/index.js +3 -1
- package/_deprecated/hstack/hstack.js +79 -33
- package/_deprecated/hstack/index.d.ts +3 -1
- package/_deprecated/hstack/index.js +3 -1
- package/_deprecated/page-inset/index.d.ts +3 -1
- package/_deprecated/page-inset/index.js +3 -1
- package/_deprecated/page-inset/page-inset.js +104 -56
- package/_deprecated/vstack/index.d.ts +3 -1
- package/_deprecated/vstack/index.js +3 -1
- package/_deprecated/vstack/vstack.js +61 -19
- package/accordion/accordion-item.js +217 -147
- package/accordion/accordion.js +214 -149
- package/accordion/index.d.ts +5 -2
- package/accordion/index.js +5 -2
- package/alert-dialog/alert-dialog-close.js +2 -2
- package/alert-dialog/alert-dialog-popup.js +230 -166
- package/alert-dialog/alert-dialog-trigger.js +2 -2
- package/alert-dialog/alert-dialog.js +128 -73
- package/alert-dialog/index.d.ts +9 -4
- package/alert-dialog/index.js +9 -4
- package/avatar/avatar.js +175 -115
- package/avatar/index.d.ts +3 -1
- package/avatar/index.js +3 -1
- package/badge/badge.js +2 -2
- package/badge/index.d.ts +3 -1
- package/badge/index.js +3 -1
- package/breadcrumb/breadcrumb-ellipsis.js +2 -2
- package/breadcrumb/breadcrumb-item.js +2 -2
- package/breadcrumb/breadcrumb-link.js +2 -2
- package/breadcrumb/breadcrumb-page.js +2 -2
- package/breadcrumb/breadcrumb-separator.js +2 -2
- package/breadcrumb/breadcrumb.js +2 -2
- package/breadcrumb/index.d.ts +13 -6
- package/breadcrumb/index.js +13 -6
- package/button/button.js +109 -65
- package/button/index.d.ts +3 -1
- package/button/index.js +3 -1
- package/calendar/calendar.js +368 -290
- package/calendar/index.d.ts +3 -1
- package/calendar/index.js +3 -1
- package/checkbox/checkbox-group.js +146 -87
- package/checkbox/checkbox.js +232 -167
- package/checkbox/index.d.ts +5 -2
- package/checkbox/index.js +5 -2
- package/collapsible/collapsible.js +210 -132
- package/collapsible/index.d.ts +3 -1
- package/collapsible/index.js +3 -1
- package/combobox/combobox.js +318 -252
- package/combobox/index.d.ts +3 -1
- package/combobox/index.js +3 -1
- package/command/command-empty.js +67 -25
- package/command/command-group.js +87 -47
- package/command/command-input.js +84 -44
- package/command/command-item.js +168 -124
- package/command/command-list.js +60 -18
- package/command/command-separator.js +2 -2
- package/command/command-shortcut.js +2 -2
- package/command/command.js +297 -232
- package/command/index.d.ts +17 -8
- package/command/index.js +17 -8
- package/data-table/data-table.js +225 -153
- package/data-table/index.d.ts +3 -1
- package/data-table/index.js +3 -1
- package/dialog/dialog-close.js +2 -2
- package/dialog/dialog-popup.js +247 -181
- package/dialog/dialog-trigger.js +2 -2
- package/dialog/dialog.js +128 -73
- package/dialog/index.d.ts +9 -4
- package/dialog/index.js +9 -4
- package/dropzone/dropzone.js +310 -249
- package/dropzone/index.d.ts +3 -1
- package/dropzone/index.js +3 -1
- package/icon/icon.js +2 -2
- package/icon/index.d.ts +3 -1
- package/icon/index.js +3 -1
- package/input/index.d.ts +3 -1
- package/input/index.js +3 -1
- package/input/input.js +204 -143
- package/link/index.d.ts +3 -1
- package/link/index.js +3 -1
- package/link/link.js +62 -24
- package/menu/index.d.ts +5 -2
- package/menu/index.js +5 -2
- package/menu/menu-item.js +66 -24
- package/menu/menu.js +189 -136
- package/menubar/index.d.ts +3 -1
- package/menubar/index.js +3 -1
- package/menubar/menubar.js +142 -91
- package/number-field/index.d.ts +3 -1
- package/number-field/index.js +3 -1
- package/number-field/number-field.js +277 -204
- package/package.json +5 -4
- package/popover/index.d.ts +9 -4
- package/popover/index.js +9 -4
- package/popover/popover-close.js +2 -2
- package/popover/popover-popup.js +126 -76
- package/popover/popover-trigger.js +2 -2
- package/popover/popover.js +181 -120
- package/portal/index.d.ts +3 -1
- package/portal/index.js +3 -1
- package/portal/portal.js +128 -86
- package/preview-card/index.d.ts +7 -3
- package/preview-card/index.js +7 -3
- package/preview-card/preview-card-popup.js +114 -66
- package/preview-card/preview-card-trigger.js +2 -2
- package/preview-card/preview-card.js +211 -142
- package/progress/index.d.ts +3 -1
- package/progress/index.js +3 -1
- package/progress/progress.js +91 -45
- package/radio/index.d.ts +5 -2
- package/radio/index.js +5 -2
- package/radio/radio-group.js +153 -90
- package/radio/radio.js +137 -94
- package/scroll-area/index.d.ts +3 -1
- package/scroll-area/index.js +3 -1
- package/scroll-area/scroll-area.js +382 -276
- package/select/index.d.ts +3 -1
- package/select/index.js +3 -1
- package/select/select.js +260 -203
- package/separator/index.d.ts +3 -1
- package/separator/index.js +3 -1
- package/separator/separator.js +60 -18
- package/sidebar/index.d.ts +27 -13
- package/sidebar/index.js +32 -13
- package/sidebar/sidebar-content.js +2 -2
- package/sidebar/sidebar-footer.js +2 -2
- package/sidebar/sidebar-group-label.js +2 -2
- package/sidebar/sidebar-group.js +2 -2
- package/sidebar/sidebar-header.js +2 -2
- package/sidebar/sidebar-inset.js +2 -2
- package/sidebar/sidebar-menu-button.js +118 -74
- package/sidebar/sidebar-menu-item.js +2 -2
- package/sidebar/sidebar-menu.js +2 -2
- package/sidebar/sidebar-provider.js +202 -129
- package/sidebar/sidebar-separator.js +2 -2
- package/sidebar/sidebar-trigger.js +2 -2
- package/sidebar/sidebar.js +150 -85
- package/slider/index.d.ts +3 -1
- package/slider/index.js +3 -1
- package/slider/slider.js +217 -159
- package/spinner/index.d.ts +3 -1
- package/spinner/index.js +3 -1
- package/spinner/spinner.js +70 -28
- package/switch/index.d.ts +3 -1
- package/switch/index.js +3 -1
- package/switch/switch.js +174 -111
- package/tabs/index.d.ts +11 -5
- package/tabs/index.js +11 -5
- package/tabs/tab.js +89 -47
- package/tabs/tabs-indicator.js +2 -2
- package/tabs/tabs-list.js +92 -54
- package/tabs/tabs-panel.js +90 -44
- package/tabs/tabs.js +130 -71
- package/textarea/index.d.ts +3 -1
- package/textarea/index.js +3 -1
- package/textarea/textarea.js +153 -95
- package/toggle/index.d.ts +5 -2
- package/toggle/index.js +5 -2
- package/toggle/toggle-group.js +184 -125
- package/toggle/toggle.js +131 -76
- package/toolbar/index.d.ts +3 -1
- package/toolbar/index.js +3 -1
- package/toolbar/toolbar.js +79 -33
- package/tooltip/index.d.ts +7 -3
- package/tooltip/index.js +7 -3
- package/tooltip/tooltip-popup.js +108 -60
- package/tooltip/tooltip-trigger.js +93 -55
- package/tooltip/tooltip.js +225 -154
- package/trunc/index.d.ts +3 -1
- package/trunc/index.js +3 -1
- package/trunc/trunc.js +78 -34
- package/accordion/register.d.ts +0 -1
- package/accordion/register.js +0 -8
- package/alert-dialog/register.d.ts +0 -1
- package/alert-dialog/register.js +0 -16
- package/avatar/register.d.ts +0 -1
- package/avatar/register.js +0 -4
- package/badge/register.d.ts +0 -1
- package/badge/register.js +0 -4
- package/breadcrumb/register.d.ts +0 -1
- package/breadcrumb/register.js +0 -14
- package/button/register.d.ts +0 -1
- package/button/register.js +0 -4
- package/calendar/register.d.ts +0 -1
- package/calendar/register.js +0 -4
- package/checkbox/register.d.ts +0 -1
- package/checkbox/register.js +0 -8
- package/collapsible/register.d.ts +0 -1
- package/collapsible/register.js +0 -4
- package/combobox/register.d.ts +0 -1
- package/combobox/register.js +0 -4
- package/command/register.d.ts +0 -1
- package/command/register.js +0 -22
- package/data-table/register.d.ts +0 -1
- package/data-table/register.js +0 -4
- package/dialog/register.d.ts +0 -1
- package/dialog/register.js +0 -16
- package/dropzone/register.d.ts +0 -1
- package/dropzone/register.js +0 -4
- package/icon/register.d.ts +0 -1
- package/icon/register.js +0 -4
- package/input/register.d.ts +0 -1
- package/input/register.js +0 -4
- package/link/register.d.ts +0 -1
- package/link/register.js +0 -4
- package/menu/register.d.ts +0 -1
- package/menu/register.js +0 -8
- package/menubar/register.d.ts +0 -1
- package/menubar/register.js +0 -4
- package/number-field/register.d.ts +0 -1
- package/number-field/register.js +0 -4
- package/popover/register.d.ts +0 -1
- package/popover/register.js +0 -16
- package/portal/register.d.ts +0 -1
- package/portal/register.js +0 -4
- package/preview-card/register.d.ts +0 -1
- package/preview-card/register.js +0 -12
- package/progress/register.d.ts +0 -1
- package/progress/register.js +0 -4
- package/radio/register.d.ts +0 -1
- package/radio/register.js +0 -8
- package/scroll-area/register.d.ts +0 -1
- package/scroll-area/register.js +0 -4
- package/select/register.d.ts +0 -1
- package/select/register.js +0 -4
- package/separator/register.d.ts +0 -1
- package/separator/register.js +0 -4
- package/sidebar/register.d.ts +0 -1
- package/sidebar/register.js +0 -52
- package/slider/register.d.ts +0 -1
- package/slider/register.js +0 -4
- package/spinner/register.d.ts +0 -1
- package/spinner/register.js +0 -4
- package/switch/register.d.ts +0 -1
- package/switch/register.js +0 -4
- package/tabs/register.d.ts +0 -1
- package/tabs/register.js +0 -10
- package/textarea/register.d.ts +0 -1
- package/textarea/register.js +0 -4
- package/toggle/register.d.ts +0 -1
- package/toggle/register.js +0 -8
- package/toolbar/register.d.ts +0 -1
- package/toolbar/register.js +0 -4
- package/tooltip/register.d.ts +0 -1
- package/tooltip/register.js +0 -12
- package/trunc/register.d.ts +0 -1
- package/trunc/register.js +0 -4
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# DUI
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@deepfuture/dui-core)
|
|
5
|
+
|
|
6
|
+
Unstyled [Lit](https://lit.dev) web component library with composable themes.
|
|
7
|
+
|
|
8
|
+
Components provide structure and behavior with zero visual opinions. Themes provide all aesthetics — colors, spacing, typography, borders. Swap the theme to completely change the look without touching component code.
|
|
9
|
+
|
|
10
|
+
**[Live Docs & Demos →](https://deepfuturenow.github.io/dui/)**
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
**npm / pnpm / yarn:**
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @deepfuture/dui-core @deepfuture/dui-components @deepfuture/dui-theme-default
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Deno:**
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { applyTheme } from "npm:@deepfuture/dui-core/apply-theme";
|
|
24
|
+
import { defaultTheme } from "npm:@deepfuture/dui-theme-default";
|
|
25
|
+
import { allComponents } from "npm:@deepfuture/dui-components/all";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**CDN (zero setup):**
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@deepfuture/dui-cdn/dui.min.js"></script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { applyTheme } from "@deepfuture/dui-core/apply-theme";
|
|
38
|
+
import { defaultTheme } from "@deepfuture/dui-theme-default";
|
|
39
|
+
import { DuiButton } from "@deepfuture/dui-components/button";
|
|
40
|
+
import { DuiDialog, DuiDialogTrigger, DuiDialogPopup, DuiDialogClose } from "@deepfuture/dui-components/dialog";
|
|
41
|
+
|
|
42
|
+
// Register components with a theme — this is the only setup needed
|
|
43
|
+
applyTheme({
|
|
44
|
+
theme: defaultTheme,
|
|
45
|
+
components: [DuiButton, DuiDialog, DuiDialogTrigger, DuiDialogPopup, DuiDialogClose],
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<dui-dialog>
|
|
51
|
+
<dui-dialog-trigger>
|
|
52
|
+
<dui-button>Open Dialog</dui-button>
|
|
53
|
+
</dui-dialog-trigger>
|
|
54
|
+
<dui-dialog-popup>
|
|
55
|
+
<h2>Hello</h2>
|
|
56
|
+
<p>This is a dialog.</p>
|
|
57
|
+
<dui-dialog-close>
|
|
58
|
+
<dui-button variant="outline">Close</dui-button>
|
|
59
|
+
</dui-dialog-close>
|
|
60
|
+
</dui-dialog-popup>
|
|
61
|
+
</dui-dialog>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or register everything at once:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { applyTheme } from "@deepfuture/dui-core/apply-theme";
|
|
68
|
+
import { defaultTheme } from "@deepfuture/dui-theme-default";
|
|
69
|
+
import { allComponents } from "@deepfuture/dui-components/all";
|
|
70
|
+
|
|
71
|
+
applyTheme({ theme: defaultTheme, components: allComponents });
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## How It Works
|
|
75
|
+
|
|
76
|
+
`applyTheme()` takes unstyled component classes and a theme, creates themed subclasses with composed styles, and registers them as custom elements.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Component structural CSS → Theme base styles → Theme component styles
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
No build step, no decorators, no code generation — just a function call. Components are standard web components that work in any framework or plain HTML.
|
|
83
|
+
|
|
84
|
+
## Components
|
|
85
|
+
|
|
86
|
+
43 component families, 85+ elements total.
|
|
87
|
+
|
|
88
|
+
| Category | Components |
|
|
89
|
+
|----------|-----------|
|
|
90
|
+
| **Actions** | Button, Link, Toggle, Toggle Group, Toolbar |
|
|
91
|
+
| **Forms** | Input, Textarea, Select, Combobox, Checkbox, Checkbox Group, Radio, Radio Group, Switch, Slider, Number Field, Dropzone |
|
|
92
|
+
| **Data Display** | Badge, Avatar, Calendar, Data Table, Progress, Spinner, Separator, Trunc |
|
|
93
|
+
| **Overlays** | Dialog, Alert Dialog, Popover, Tooltip, Menu, Menubar, Preview Card, Command |
|
|
94
|
+
| **Disclosure** | Accordion, Collapsible, Tabs |
|
|
95
|
+
| **Navigation** | Breadcrumb, Sidebar (with 12 sub-components) |
|
|
96
|
+
| **Layout** | HStack, VStack, Center, Page Inset, Scroll Area, Portal |
|
|
97
|
+
| **Utility** | Icon |
|
|
98
|
+
|
|
99
|
+
## Styling
|
|
100
|
+
|
|
101
|
+
DUI uses a two-layer styling approach:
|
|
102
|
+
|
|
103
|
+
### CSS Variables — for the variant system
|
|
104
|
+
|
|
105
|
+
Variables control values that variants, sizes, and states toggle:
|
|
106
|
+
|
|
107
|
+
```css
|
|
108
|
+
/* Override variant colors */
|
|
109
|
+
dui-button {
|
|
110
|
+
--button-bg: linear-gradient(135deg, pink, purple);
|
|
111
|
+
--button-radius: var(--radius-full);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `::part(root)` — for everything else
|
|
116
|
+
|
|
117
|
+
Every component exposes a `root` CSS part for full CSS expressiveness:
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
/* Frosted glass effect */
|
|
121
|
+
dui-dialog-popup::part(root) {
|
|
122
|
+
backdrop-filter: blur(12px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Custom hover animation */
|
|
126
|
+
dui-button::part(root):hover {
|
|
127
|
+
filter: brightness(1.25);
|
|
128
|
+
transform: translateY(-1px);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Glow shadow */
|
|
132
|
+
dui-badge::part(root) {
|
|
133
|
+
box-shadow: 0 0 16px oklch(0.7 0.2 280 / 0.4);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
No need for the library to anticipate every CSS property — `::part()` gives you direct access.
|
|
138
|
+
|
|
139
|
+
## Dark Mode
|
|
140
|
+
|
|
141
|
+
DUI uses CSS custom properties for theming. Toggle dark mode by adding `class="dark"` to a parent element:
|
|
142
|
+
|
|
143
|
+
```html
|
|
144
|
+
<body class="dark">
|
|
145
|
+
<!-- All DUI components render in dark mode -->
|
|
146
|
+
</body>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Packages
|
|
150
|
+
|
|
151
|
+
| Package | Purpose |
|
|
152
|
+
|---------|---------|
|
|
153
|
+
| [`@deepfuture/dui-core`](https://www.npmjs.com/package/@deepfuture/dui-core) | `applyTheme()`, event factory, base styles |
|
|
154
|
+
| [`@deepfuture/dui-components`](https://www.npmjs.com/package/@deepfuture/dui-components) | Unstyled component classes |
|
|
155
|
+
| [`@deepfuture/dui-theme-default`](https://www.npmjs.com/package/@deepfuture/dui-theme-default) | Design tokens + aesthetic styles |
|
|
156
|
+
| [`@deepfuture/dui-cdn`](https://www.npmjs.com/package/@deepfuture/dui-cdn) | Pre-bundled CDN build (all deps inlined) |
|
|
157
|
+
|
|
158
|
+
## Dev Tools
|
|
159
|
+
|
|
160
|
+
### Theme Editor
|
|
161
|
+
|
|
162
|
+
A visual editor for design tokens. Edit colors with OKLCH sliders, tweak spacing and typography, and export your customized `tokens.css`.
|
|
163
|
+
|
|
164
|
+
### Inspector
|
|
165
|
+
|
|
166
|
+
A runtime inspector and mutation API for DUI components. Two interfaces:
|
|
167
|
+
|
|
168
|
+
- **Visual UI** (Ctrl+Shift+I) — hover-highlight components, inspect properties/tokens/styles, edit theme CSS and design tokens live
|
|
169
|
+
- **Console API** — `window.__dui_inspect()`, `window.__dui_mutate.*`, `window.__dui_export()` for programmatic access by agents or scripts
|
|
170
|
+
|
|
171
|
+
Both share a changelog, so agent and human edits are visible to each other. Changes can be exported as structured source file diffs.
|
|
172
|
+
|
|
173
|
+
See **[Inspector docs](docs/inspector.md)** for the full API reference and usage guide.
|
|
174
|
+
|
|
175
|
+
## Documentation
|
|
176
|
+
|
|
177
|
+
- **[Live Docs](https://deepfuturenow.github.io/dui/)** — interactive demos for every component
|
|
178
|
+
- [Architecture](docs/architecture.md) — mental model, package responsibilities, design decisions
|
|
179
|
+
- [Creating Components](docs/creating-components.md) — guide for adding new components
|
|
180
|
+
- [Theming](docs/theming.md) — theme system, design tokens, writing component styles
|
|
181
|
+
- [Consuming](docs/consuming.md) — integrating DUI into an app
|
|
182
|
+
- [Inspector](docs/inspector.md) — runtime inspection, mutation API, and visual editor
|
|
183
|
+
- [Accessibility](docs/accessibility.md) — accessibility patterns and guidelines
|
|
184
|
+
|
|
185
|
+
## Contributing
|
|
186
|
+
|
|
187
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for dev setup, code conventions, and PR guidelines.
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[MIT](LICENSE)
|
|
@@ -25,8 +25,8 @@ const styles = css `
|
|
|
25
25
|
* @csspart root - The centering container element.
|
|
26
26
|
*/
|
|
27
27
|
export class DuiCenter extends LitElement {
|
|
28
|
-
static
|
|
29
|
-
static
|
|
28
|
+
static tagName = "dui-center";
|
|
29
|
+
static styles = [base, styles];
|
|
30
30
|
render() {
|
|
31
31
|
return html `
|
|
32
32
|
<div part="root">
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/hstack */
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
7
35
|
};
|
|
8
36
|
import { css, html, LitElement } from "lit";
|
|
9
37
|
import { property } from "lit/decorators.js";
|
|
@@ -107,35 +135,53 @@ const styles = css `
|
|
|
107
135
|
* @cssprop --hstack-align - Override align-items.
|
|
108
136
|
* @cssprop --hstack-justify - Override justify-content.
|
|
109
137
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
let DuiHstack = (() => {
|
|
139
|
+
let _classSuper = LitElement;
|
|
140
|
+
let _gap_decorators;
|
|
141
|
+
let _gap_initializers = [];
|
|
142
|
+
let _gap_extraInitializers = [];
|
|
143
|
+
let _align_decorators;
|
|
144
|
+
let _align_initializers = [];
|
|
145
|
+
let _align_extraInitializers = [];
|
|
146
|
+
let _justify_decorators;
|
|
147
|
+
let _justify_initializers = [];
|
|
148
|
+
let _justify_extraInitializers = [];
|
|
149
|
+
return class DuiHstack extends _classSuper {
|
|
150
|
+
static {
|
|
151
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
152
|
+
_gap_decorators = [property({ reflect: true })];
|
|
153
|
+
_align_decorators = [property({ reflect: true })];
|
|
154
|
+
_justify_decorators = [property({ reflect: true })];
|
|
155
|
+
__esDecorate(this, null, _gap_decorators, { kind: "accessor", name: "gap", static: false, private: false, access: { has: obj => "gap" in obj, get: obj => obj.gap, set: (obj, value) => { obj.gap = value; } }, metadata: _metadata }, _gap_initializers, _gap_extraInitializers);
|
|
156
|
+
__esDecorate(this, null, _align_decorators, { kind: "accessor", name: "align", static: false, private: false, access: { has: obj => "align" in obj, get: obj => obj.align, set: (obj, value) => { obj.align = value; } }, metadata: _metadata }, _align_initializers, _align_extraInitializers);
|
|
157
|
+
__esDecorate(this, null, _justify_decorators, { kind: "accessor", name: "justify", static: false, private: false, access: { has: obj => "justify" in obj, get: obj => obj.justify, set: (obj, value) => { obj.justify = value; } }, metadata: _metadata }, _justify_initializers, _justify_extraInitializers);
|
|
158
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
159
|
+
}
|
|
160
|
+
static tagName = "dui-hstack";
|
|
161
|
+
static styles = [base, styles];
|
|
162
|
+
#gap_accessor_storage = __runInitializers(this, _gap_initializers, "4");
|
|
163
|
+
/** Gap between stack items. Maps to space tokens. */
|
|
164
|
+
get gap() { return this.#gap_accessor_storage; }
|
|
165
|
+
set gap(value) { this.#gap_accessor_storage = value; }
|
|
166
|
+
#align_accessor_storage = (__runInitializers(this, _gap_extraInitializers), __runInitializers(this, _align_initializers, "center"));
|
|
167
|
+
/** Alignment of items on the cross axis. */
|
|
168
|
+
get align() { return this.#align_accessor_storage; }
|
|
169
|
+
set align(value) { this.#align_accessor_storage = value; }
|
|
170
|
+
#justify_accessor_storage = (__runInitializers(this, _align_extraInitializers), __runInitializers(this, _justify_initializers, "stretch"));
|
|
171
|
+
/** Justification of items on the main axis. */
|
|
172
|
+
get justify() { return this.#justify_accessor_storage; }
|
|
173
|
+
set justify(value) { this.#justify_accessor_storage = value; }
|
|
174
|
+
render() {
|
|
175
|
+
return html `
|
|
127
176
|
<div part="root">
|
|
128
177
|
<slot></slot>
|
|
129
178
|
</div>
|
|
130
179
|
`;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
__decorate([
|
|
140
|
-
property({ reflect: true })
|
|
141
|
-
], DuiHstack.prototype, "justify", null);
|
|
180
|
+
}
|
|
181
|
+
constructor() {
|
|
182
|
+
super(...arguments);
|
|
183
|
+
__runInitializers(this, _justify_extraInitializers);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
})();
|
|
187
|
+
export { DuiHstack };
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/page-inset */
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
7
35
|
};
|
|
8
36
|
import { css, html, LitElement } from "lit";
|
|
9
37
|
import { property } from "lit/decorators.js";
|
|
@@ -44,60 +72,80 @@ const styles = css `
|
|
|
44
72
|
* @cssprop --page-inset-max-width - Max width of inner content (default: 48rem).
|
|
45
73
|
* @cssprop --page-inset-min-width - Min width of inner content (default: auto).
|
|
46
74
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
let DuiPageInset = (() => {
|
|
76
|
+
let _classSuper = LitElement;
|
|
77
|
+
let _maxWidth_decorators;
|
|
78
|
+
let _maxWidth_initializers = [];
|
|
79
|
+
let _maxWidth_extraInitializers = [];
|
|
80
|
+
let _minWidth_decorators;
|
|
81
|
+
let _minWidth_initializers = [];
|
|
82
|
+
let _minWidth_extraInitializers = [];
|
|
83
|
+
let _padX_decorators;
|
|
84
|
+
let _padX_initializers = [];
|
|
85
|
+
let _padX_extraInitializers = [];
|
|
86
|
+
let _padY_decorators;
|
|
87
|
+
let _padY_initializers = [];
|
|
88
|
+
let _padY_extraInitializers = [];
|
|
89
|
+
return class DuiPageInset extends _classSuper {
|
|
90
|
+
static {
|
|
91
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
92
|
+
_maxWidth_decorators = [property({ attribute: "max-width" })];
|
|
93
|
+
_minWidth_decorators = [property({ attribute: "min-width" })];
|
|
94
|
+
_padX_decorators = [property({ attribute: "pad-x" })];
|
|
95
|
+
_padY_decorators = [property({ attribute: "pad-y" })];
|
|
96
|
+
__esDecorate(this, null, _maxWidth_decorators, { kind: "accessor", name: "maxWidth", static: false, private: false, access: { has: obj => "maxWidth" in obj, get: obj => obj.maxWidth, set: (obj, value) => { obj.maxWidth = value; } }, metadata: _metadata }, _maxWidth_initializers, _maxWidth_extraInitializers);
|
|
97
|
+
__esDecorate(this, null, _minWidth_decorators, { kind: "accessor", name: "minWidth", static: false, private: false, access: { has: obj => "minWidth" in obj, get: obj => obj.minWidth, set: (obj, value) => { obj.minWidth = value; } }, metadata: _metadata }, _minWidth_initializers, _minWidth_extraInitializers);
|
|
98
|
+
__esDecorate(this, null, _padX_decorators, { kind: "accessor", name: "padX", static: false, private: false, access: { has: obj => "padX" in obj, get: obj => obj.padX, set: (obj, value) => { obj.padX = value; } }, metadata: _metadata }, _padX_initializers, _padX_extraInitializers);
|
|
99
|
+
__esDecorate(this, null, _padY_decorators, { kind: "accessor", name: "padY", static: false, private: false, access: { has: obj => "padY" in obj, get: obj => obj.padY, set: (obj, value) => { obj.padY = value; } }, metadata: _metadata }, _padY_initializers, _padY_extraInitializers);
|
|
100
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
101
|
+
}
|
|
102
|
+
static tagName = "dui-page-inset";
|
|
103
|
+
static styles = [base, styles];
|
|
104
|
+
#maxWidth_accessor_storage = __runInitializers(this, _maxWidth_initializers, void 0);
|
|
105
|
+
/** Maximum width of the inner content area. Overrides --page-inset-max-width. */
|
|
106
|
+
get maxWidth() { return this.#maxWidth_accessor_storage; }
|
|
107
|
+
set maxWidth(value) { this.#maxWidth_accessor_storage = value; }
|
|
108
|
+
#minWidth_accessor_storage = (__runInitializers(this, _maxWidth_extraInitializers), __runInitializers(this, _minWidth_initializers, void 0));
|
|
109
|
+
/** Minimum width of the inner content area. Overrides --page-inset-min-width. */
|
|
110
|
+
get minWidth() { return this.#minWidth_accessor_storage; }
|
|
111
|
+
set minWidth(value) { this.#minWidth_accessor_storage = value; }
|
|
112
|
+
#padX_accessor_storage = (__runInitializers(this, _minWidth_extraInitializers), __runInitializers(this, _padX_initializers, void 0));
|
|
113
|
+
/** Horizontal padding. Overrides --page-inset-pad-x. */
|
|
114
|
+
get padX() { return this.#padX_accessor_storage; }
|
|
115
|
+
set padX(value) { this.#padX_accessor_storage = value; }
|
|
116
|
+
#padY_accessor_storage = (__runInitializers(this, _padX_extraInitializers), __runInitializers(this, _padY_initializers, void 0));
|
|
117
|
+
/** Vertical padding. Overrides --page-inset-pad-y. */
|
|
118
|
+
get padY() { return this.#padY_accessor_storage; }
|
|
119
|
+
set padY(value) { this.#padY_accessor_storage = value; }
|
|
120
|
+
#setOrRemove(prop, value) {
|
|
121
|
+
if (value)
|
|
122
|
+
this.style.setProperty(prop, value);
|
|
123
|
+
else
|
|
124
|
+
this.style.removeProperty(prop);
|
|
125
|
+
}
|
|
126
|
+
willUpdate(changed) {
|
|
127
|
+
if (changed.has("maxWidth"))
|
|
128
|
+
this.#setOrRemove("--page-inset-max-width", this.maxWidth);
|
|
129
|
+
if (changed.has("minWidth"))
|
|
130
|
+
this.#setOrRemove("--page-inset-min-width", this.minWidth);
|
|
131
|
+
if (changed.has("padX"))
|
|
132
|
+
this.#setOrRemove("--page-inset-pad-x", this.padX);
|
|
133
|
+
if (changed.has("padY"))
|
|
134
|
+
this.#setOrRemove("--page-inset-pad-y", this.padY);
|
|
135
|
+
}
|
|
136
|
+
render() {
|
|
137
|
+
return html `
|
|
84
138
|
<div part="root">
|
|
85
139
|
<div part="inner">
|
|
86
140
|
<slot></slot>
|
|
87
141
|
</div>
|
|
88
142
|
</div>
|
|
89
143
|
`;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
__decorate([
|
|
99
|
-
property({ attribute: "pad-x" })
|
|
100
|
-
], DuiPageInset.prototype, "padX", null);
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ attribute: "pad-y" })
|
|
103
|
-
], DuiPageInset.prototype, "padY", null);
|
|
144
|
+
}
|
|
145
|
+
constructor() {
|
|
146
|
+
super(...arguments);
|
|
147
|
+
__runInitializers(this, _padY_extraInitializers);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
})();
|
|
151
|
+
export { DuiPageInset };
|