sinwan-ui-core 1.0.0 → 1.1.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/CHANGELOG.md +12 -0
- package/dist/chunks/{chunk-te52bwb8.js → chunk-2sw6berz.js} +20 -23
- package/dist/chunks/{chunk-xaegn57w.js → chunk-33f19xws.js} +5 -5
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +1 -1
- package/dist/index.js +2 -2
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.1.1]
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `ToggleGroupRoot` (`controls`) forwards `aria-*` attributes to its `role="group"` element. Before, an `aria-label` such as "Billing period" was dropped, so screen readers announced an unnamed group. Values stay live when driven by a signal or getter.
|
|
10
|
+
|
|
11
|
+
## [1.1.0]
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `cazview` palette: `Palette` now accepts `"cazview"` and `ThemeProvider`'s default `palettes` list is `["credit-blue", "jomlaty", "cazview"]`. Pair it with the registry stylesheet, which defines the `html[data-palette="cazview"]` tokens (midnight `#111E2E` text, `#1A73E8` → `#3B52D9` → `#7B2CBF` brand gradient, `#FAFAFA` surface).
|
|
16
|
+
|
|
5
17
|
## [1.0.0]
|
|
6
18
|
|
|
7
19
|
Initial release: the headless primitives extracted from `sinwan-ui` 0.1.0, published separately so registry components copied into apps can depend on them.
|
|
@@ -5,7 +5,12 @@ import {
|
|
|
5
5
|
// src/controls.tsx
|
|
6
6
|
import { _$createTemplate } from "sinwan/renderer/web";
|
|
7
7
|
import { unwrap as _$unwrap } from "sinwan/reactivity";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
cc,
|
|
10
|
+
getRawProps,
|
|
11
|
+
inject,
|
|
12
|
+
provide
|
|
13
|
+
} from "sinwan/component";
|
|
9
14
|
import { For as For2, Show as Show2 } from "sinwan/control-flow";
|
|
10
15
|
import { computed, signal } from "sinwan/reactivity";
|
|
11
16
|
import { jsx } from "sinwan/jsx-runtime";
|
|
@@ -121,18 +126,6 @@ var _$tmpl_10 = {
|
|
|
121
126
|
]
|
|
122
127
|
};
|
|
123
128
|
var _$tmpl_11 = {
|
|
124
|
-
html: '<div data-slot="toggle-group" role="group" style="" data-variant="" data-size="" data-spacing="" data-orientation=""></div>',
|
|
125
|
-
slots: [
|
|
126
|
-
{ path: [], type: "attr", name: "class" },
|
|
127
|
-
{ path: [], type: "attr", name: "style" },
|
|
128
|
-
{ path: [], type: "attr", name: "data-variant" },
|
|
129
|
-
{ path: [], type: "attr", name: "data-size" },
|
|
130
|
-
{ path: [], type: "attr", name: "data-spacing" },
|
|
131
|
-
{ path: [], type: "attr", name: "data-orientation" },
|
|
132
|
-
{ path: [], type: "child" }
|
|
133
|
-
]
|
|
134
|
-
};
|
|
135
|
-
var _$tmpl_12 = {
|
|
136
129
|
html: '<button type="button" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
|
|
137
130
|
slots: [
|
|
138
131
|
{ path: [], type: "attr", name: "data-variant" },
|
|
@@ -399,6 +392,7 @@ var ToggleRoot2 = cc((props) => {
|
|
|
399
392
|
var ToggleGroupKey2 = Symbol("sinwan-ui.toggle-group");
|
|
400
393
|
var ToggleGroupRoot2 = cc((props) => {
|
|
401
394
|
const type = () => props.type ?? "single";
|
|
395
|
+
const ariaProps = Object.fromEntries(Object.entries(getRawProps(props)).filter(([key]) => key.startsWith("aria-")));
|
|
402
396
|
const valueLocal = signal(toValueList(props.defaultValue));
|
|
403
397
|
const value = "value" in props ? computed(() => toValueList(props.value)) : valueLocal;
|
|
404
398
|
const set = (next) => {
|
|
@@ -419,19 +413,22 @@ var ToggleGroupRoot2 = cc((props) => {
|
|
|
419
413
|
props.onValueChange?.(type() === "single" ? next[0] ?? "" : next);
|
|
420
414
|
}
|
|
421
415
|
});
|
|
422
|
-
return
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
() => props
|
|
426
|
-
() => props
|
|
427
|
-
() => props["data-
|
|
428
|
-
() => props["data-
|
|
429
|
-
() =>
|
|
430
|
-
|
|
416
|
+
return /* @__PURE__ */ jsx("div", {
|
|
417
|
+
"data-slot": "toggle-group",
|
|
418
|
+
role: "group",
|
|
419
|
+
class: () => _$unwrap(props).class,
|
|
420
|
+
style: () => _$unwrap(props).style,
|
|
421
|
+
"data-variant": () => props["data-variant"],
|
|
422
|
+
"data-size": () => props["data-size"],
|
|
423
|
+
"data-spacing": () => props["data-spacing"],
|
|
424
|
+
"data-orientation": () => props["data-orientation"],
|
|
425
|
+
...ariaProps,
|
|
426
|
+
children: () => _$unwrap(props).children
|
|
427
|
+
});
|
|
431
428
|
});
|
|
432
429
|
var ToggleGroupItem2 = cc((props) => {
|
|
433
430
|
const api = inject(ToggleGroupKey2);
|
|
434
|
-
return _$createTemplate(_$
|
|
431
|
+
return _$createTemplate(_$tmpl_11, [
|
|
435
432
|
() => props["data-variant"],
|
|
436
433
|
() => props["data-size"],
|
|
437
434
|
() => props["data-spacing"],
|
|
@@ -18,7 +18,7 @@ var _$tmpl_0 = {
|
|
|
18
18
|
{ path: [], type: "child" }
|
|
19
19
|
]
|
|
20
20
|
};
|
|
21
|
-
var DEFAULT_PALETTES = ["credit-blue", "jomlaty"];
|
|
21
|
+
var DEFAULT_PALETTES = ["credit-blue", "jomlaty", "cazview"];
|
|
22
22
|
var ThemeKey2 = Symbol("sinwan-ui.theme");
|
|
23
23
|
function isTheme(value) {
|
|
24
24
|
return value === "light" || value === "dark" || value === "system";
|
|
@@ -80,9 +80,9 @@ function writeDomPalette(next) {
|
|
|
80
80
|
document.documentElement.setAttribute("data-palette", next);
|
|
81
81
|
}
|
|
82
82
|
var ThemeProvider2 = cc((props) => {
|
|
83
|
-
const allowedPalettes = (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
|
|
83
|
+
const allowedPalettes = () => (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
|
|
84
84
|
const initialTheme = props.forcedTheme ?? readStoredTheme(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, props.defaultTheme === undefined ? "system" : props.defaultTheme);
|
|
85
|
-
const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "credit-blue" : props.defaultPalette, allowedPalettes);
|
|
85
|
+
const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "credit-blue" : props.defaultPalette, allowedPalettes());
|
|
86
86
|
const theme = signal(initialTheme);
|
|
87
87
|
const palette = signal(initialPalette);
|
|
88
88
|
const resolved = signal(initialTheme === "system" ? getSystemTheme() : initialTheme);
|
|
@@ -131,7 +131,7 @@ var ThemeProvider2 = cc((props) => {
|
|
|
131
131
|
const setPalette = (value) => {
|
|
132
132
|
if (props.forcedPalette)
|
|
133
133
|
return;
|
|
134
|
-
if (!allowedPalettes.includes(value))
|
|
134
|
+
if (!allowedPalettes().includes(value))
|
|
135
135
|
return;
|
|
136
136
|
try {
|
|
137
137
|
localStorage.setItem(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, value);
|
|
@@ -159,7 +159,7 @@ var ThemeProvider2 = cc((props) => {
|
|
|
159
159
|
themes: (props.enableSystem === undefined ? true : props.enableSystem) ? ["light", "dark", "system"] : ["light", "dark"],
|
|
160
160
|
palette,
|
|
161
161
|
setPalette,
|
|
162
|
-
palettes: allowedPalettes
|
|
162
|
+
palettes: allowedPalettes()
|
|
163
163
|
});
|
|
164
164
|
computed(() => resolved.value);
|
|
165
165
|
computed(() => palette.value);
|
package/dist/controls.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare const ToggleGroupKey: InjectionKey<{
|
|
|
117
117
|
toggle: (v: string) => void;
|
|
118
118
|
}>;
|
|
119
119
|
export declare const ToggleGroupRoot: import("sinwan/component").SinwanComponent<{
|
|
120
|
+
[key: `aria-${string}`]: string | boolean | undefined;
|
|
120
121
|
children?: SinwanNode;
|
|
121
122
|
type?: "single" | "multiple";
|
|
122
123
|
value?: string | string[];
|
package/dist/controls.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
ToggleGroupKey2,
|
|
49
49
|
ToggleGroupRoot2,
|
|
50
50
|
ToggleGroupItem2
|
|
51
|
-
} from "./chunks/chunk-
|
|
51
|
+
} from "./chunks/chunk-2sw6berz.js";
|
|
52
52
|
import {
|
|
53
53
|
DirectionKey2,
|
|
54
54
|
DirectionProvider2,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
ThemeProvider2,
|
|
90
90
|
useTheme2,
|
|
91
91
|
ThemeToggle2
|
|
92
|
-
} from "./chunks/chunk-
|
|
92
|
+
} from "./chunks/chunk-33f19xws.js";
|
|
93
93
|
export {
|
|
94
94
|
AccordionContent2 as AccordionContent,
|
|
95
95
|
AccordionItem2 as AccordionItem,
|
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 = "credit-blue" | "jomlaty";
|
|
5
|
+
export type Palette = "credit-blue" | "jomlaty" | "cazview";
|
|
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.1.1",
|
|
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",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@types/bun": "latest",
|
|
110
|
-
"bun-plugin-sinwan": "1.0.
|
|
110
|
+
"bun-plugin-sinwan": "^1.0.1",
|
|
111
111
|
"happy-dom": "^20.14.5",
|
|
112
112
|
"sinwan": "^2.0.3",
|
|
113
113
|
"typescript": "^5.9.3"
|
|
@@ -115,4 +115,4 @@
|
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"sinwan": ">=2.0.3 <3.0.0"
|
|
117
117
|
}
|
|
118
|
-
}
|
|
118
|
+
}
|