sinwan-ui-core 1.3.0 → 1.4.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/CHANGELOG.md +16 -0
- package/dist/chunks/{chunk-rrvtbvbh.js → chunk-16d43dkc.js} +2 -2
- package/dist/chunks/{chunk-4a2neay9.js → chunk-648ssfj3.js} +14 -3
- package/dist/index.js +2 -2
- package/dist/overlay.js +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [1.4.0]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `voltzig` palette (Voltzig AI): `Palette` now accepts `"voltzig"` and `ThemeProvider`'s default `palettes` list is `["carzow", "jomlaty", "cazview", "voltzig"]`. Pair it with the registry stylesheet, which defines the `html[data-palette="voltzig"]` tokens: `#08090D` black and `#FFFFFF` white surfaces with a monochrome primary, `#A3A3A3` silver for secondary text in dark mode, and `#6C5CE7` electric violet for focus rings, accent tints, the first chart color and the brand gradient. Apps that pass their own `palettes` list are unaffected.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **Breaking:** the default palette `"credit-blue"` is renamed `"carzow"`. `Palette` no longer accepts `"credit-blue"`, and `ThemeProvider`'s `defaultPalette` is now `"carzow"`, so `<html>` gets `data-palette="carzow"`. Replace `"credit-blue"` with `"carzow"` in `defaultPalette`, `forcedPalette`, `palettes` and `setPalette` calls. A saved `sinwan-ui-palette=credit-blue` value is ignored and falls back to `carzow`, which is the same set of colors. No alias is kept because sinwan-ui has no consumers yet.
|
|
14
|
+
|
|
15
|
+
## [1.3.1]
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- A closing `DialogContent` (dialogs, sheets, drawers, alert dialogs) gives focus back to what opened it only when focus is still inside the dialog or was lost. Before, it always refocused the trigger once the exit animation ended, about 200 ms after closing. That undid focus the app had moved on purpose: after scanning a label, the quantity field lost focus to the "Scan" button.
|
|
20
|
+
|
|
5
21
|
## [1.3.0]
|
|
6
22
|
|
|
7
23
|
### Added
|
|
@@ -18,7 +18,7 @@ var _$tmpl_0 = {
|
|
|
18
18
|
{ path: [], type: "child" }
|
|
19
19
|
]
|
|
20
20
|
};
|
|
21
|
-
var DEFAULT_PALETTES = ["
|
|
21
|
+
var DEFAULT_PALETTES = ["carzow", "jomlaty", "cazview", "voltzig"];
|
|
22
22
|
var ThemeKey2 = Symbol("sinwan-ui.theme");
|
|
23
23
|
function isTheme(value) {
|
|
24
24
|
return value === "light" || value === "dark" || value === "system";
|
|
@@ -80,7 +80,7 @@ function writeDomPalette(next) {
|
|
|
80
80
|
var ThemeProvider2 = cc((props) => {
|
|
81
81
|
const allowedPalettes = () => (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
|
|
82
82
|
const initialTheme = props.forcedTheme ?? readStoredTheme(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, props.defaultTheme === undefined ? "system" : props.defaultTheme);
|
|
83
|
-
const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "
|
|
83
|
+
const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "carzow" : props.defaultPalette, allowedPalettes());
|
|
84
84
|
const theme = signal(initialTheme);
|
|
85
85
|
const palette = signal(initialPalette);
|
|
86
86
|
const resolved = signal(initialTheme === "system" ? getSystemTheme() : initialTheme);
|
|
@@ -238,6 +238,12 @@ var DialogOverlay2 = cc((props) => {
|
|
|
238
238
|
})
|
|
239
239
|
});
|
|
240
240
|
});
|
|
241
|
+
function focusIsInsideOrLost(content) {
|
|
242
|
+
const active = document.activeElement;
|
|
243
|
+
if (!active || active === document.body || !active.isConnected)
|
|
244
|
+
return true;
|
|
245
|
+
return content?.contains(active) ?? false;
|
|
246
|
+
}
|
|
241
247
|
var DialogContent2 = cc((props) => {
|
|
242
248
|
const dataAttrs = _$createLiveRest(props, [
|
|
243
249
|
"children",
|
|
@@ -294,13 +300,18 @@ var DialogContent2 = cc((props) => {
|
|
|
294
300
|
"data-vaul-drawer-direction": () => props["data-vaul-drawer-direction"],
|
|
295
301
|
class: () => _$unwrap(props).class,
|
|
296
302
|
ref: function contentRef(el) {
|
|
297
|
-
contentEl = el;
|
|
298
303
|
if (el) {
|
|
304
|
+
contentEl = el;
|
|
299
305
|
previousFocus = document.activeElement;
|
|
300
306
|
el.focus?.();
|
|
301
|
-
|
|
302
|
-
previousFocus.focus?.();
|
|
307
|
+
return;
|
|
303
308
|
}
|
|
309
|
+
const closing = contentEl;
|
|
310
|
+
const restore = previousFocus;
|
|
311
|
+
contentEl = null;
|
|
312
|
+
previousFocus = null;
|
|
313
|
+
if (restore && focusIsInsideOrLost(closing))
|
|
314
|
+
restore.focus?.();
|
|
304
315
|
},
|
|
305
316
|
tabIndex: -1,
|
|
306
317
|
onclick: function stopBubble(e) {
|
package/dist/index.js
CHANGED
|
@@ -86,13 +86,13 @@ import {
|
|
|
86
86
|
TooltipRoot2,
|
|
87
87
|
TooltipTrigger2,
|
|
88
88
|
TooltipContent2
|
|
89
|
-
} from "./chunks/chunk-
|
|
89
|
+
} from "./chunks/chunk-648ssfj3.js";
|
|
90
90
|
import {
|
|
91
91
|
ThemeKey2,
|
|
92
92
|
ThemeProvider2,
|
|
93
93
|
useTheme2,
|
|
94
94
|
ThemeToggle2
|
|
95
|
-
} from "./chunks/chunk-
|
|
95
|
+
} from "./chunks/chunk-16d43dkc.js";
|
|
96
96
|
export {
|
|
97
97
|
AccordionContent2 as AccordionContent,
|
|
98
98
|
AccordionItem2 as AccordionItem,
|
package/dist/overlay.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
TooltipRoot2,
|
|
22
22
|
TooltipTrigger2,
|
|
23
23
|
TooltipContent2
|
|
24
|
-
} from "./chunks/chunk-
|
|
24
|
+
} from "./chunks/chunk-648ssfj3.js";
|
|
25
25
|
import"./chunks/chunk-bw9vp0y9.js";
|
|
26
26
|
import"./chunks/chunk-7r6fwdyt.js";
|
|
27
27
|
import"./chunks/chunk-9whagkb6.js";
|
package/dist/theme.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type InjectionKey, type SinwanNode } from "sinwan/component";
|
|
|
2
2
|
import { type Signal } from "sinwan/reactivity";
|
|
3
3
|
export type Theme = "light" | "dark" | "system";
|
|
4
4
|
export type ResolvedTheme = "light" | "dark";
|
|
5
|
-
export type Palette = "
|
|
5
|
+
export type Palette = "carzow" | "jomlaty" | "cazview" | "voltzig";
|
|
6
6
|
export type ThemeApi = {
|
|
7
7
|
theme: Signal<Theme>;
|
|
8
8
|
resolved: Signal<ResolvedTheme>;
|
package/dist/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sinwan-ui-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Headless behaviour primitives for Sinwan UI components: overlays, floating positioning, dismiss layers, controls, slots, theme and direction.",
|
|
5
5
|
"author": "Mohammed Ben Cheikh",
|
|
6
6
|
"license": "MIT",
|