@rimelight/ui 0.0.45 → 0.0.47
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 +21 -0
- package/dist/icons-DPnFQCts.d.mts +72 -0
- package/dist/icons.d.mts +2 -0
- package/dist/icons.mjs +32 -0
- package/dist/icons.raw-CjAuL2Sc.mjs +67 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +26 -0
- package/dist/preset.d.mts +2 -0
- package/dist/preset.mjs +215 -0
- package/dist/resolver.d.mts +6 -0
- package/dist/resolver.mjs +116 -0
- package/dist/shortcuts.d.mts +29 -0
- package/dist/shortcuts.mjs +119 -0
- package/dist/stores.d.mts +9 -0
- package/dist/stores.mjs +19 -0
- package/dist/types-DWmKMcYC.d.mts +86 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +40 -12
- package/src/components/banner/RLABanner.astro +1 -1
- package/src/components/button/RLSButton.tsx +14 -8
- package/src/components/dashboard-sidebar/RLADashboardSidebar.astro +4 -4
- package/src/components/dropdown-menu/RLADropdownMenu.astro +1 -1
- package/src/components/file-upload/RLAFileUpload.astro +1 -1
- package/src/components/header/HeaderLayer.astro +1 -1
- package/src/components/input-menu/RLAInputMenu.astro +3 -3
- package/src/components/input-rating/RLAInputRating.astro +8 -8
- package/src/components/layout-grid/RLALayoutGrid.astro +29 -29
- package/src/components/link/RLALink.astro +5 -5
- package/src/components/link/RLSLink.tsx +4 -4
- package/src/components/locale-selector/RLALocaleSelector.astro +109 -102
- package/src/components/locale-selector/locale-selector.ts +2 -7
- package/src/components/logo/RLALogo.astro +88 -102
- package/src/components/navigation-menu/RLANavigationMenu.astro +6 -6
- package/src/components/popover/RLAPopover.astro +2 -2
- package/src/components/scroll-area/RLAScrollArea.astro +1 -1
- package/src/components/scroll-to-top/RLAScrollToTop.astro +4 -4
- package/src/components/search/RLASearch.astro +6 -6
- package/src/components/shortcuts/RLAShortcuts.astro +2 -2
- package/src/components/sidebar/RLASidebar.astro +1 -1
- package/src/components/splitter/RLASplitter.astro +1 -1
- package/src/components/stepper/RLAStepper.astro +9 -9
- package/src/components/table/RLATable.astro +1 -1
- package/src/components/tabs/RLATabs.astro +8 -8
- package/src/components/toast/RLAToast.astro +2 -2
- package/src/index.ts +13 -3
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { atom } from "./stores.mjs";
|
|
2
|
+
//#region src/shortcuts.ts
|
|
3
|
+
const isMac = typeof navigator !== "undefined" && /Mac|iP/.test(navigator.userAgent);
|
|
4
|
+
const KEYS = {
|
|
5
|
+
ctrl: "Ctrl",
|
|
6
|
+
meta: isMac ? "⌘" : "Ctrl",
|
|
7
|
+
alt: isMac ? "⌥" : "Alt",
|
|
8
|
+
shift: isMac ? "⇧" : "Shift",
|
|
9
|
+
enter: "↵",
|
|
10
|
+
delete: "⌦",
|
|
11
|
+
backspace: "⌫",
|
|
12
|
+
escape: "Esc",
|
|
13
|
+
tab: "⇥",
|
|
14
|
+
space: "Space",
|
|
15
|
+
arrowup: "↑",
|
|
16
|
+
arrowdown: "↓",
|
|
17
|
+
arrowleft: "←",
|
|
18
|
+
arrowright: "→"
|
|
19
|
+
};
|
|
20
|
+
const MODS = {
|
|
21
|
+
cmd: "meta",
|
|
22
|
+
command: "meta",
|
|
23
|
+
control: "ctrl",
|
|
24
|
+
opt: "alt",
|
|
25
|
+
option: "alt"
|
|
26
|
+
};
|
|
27
|
+
const normalizeModifier = (m) => MODS[m.toLowerCase()] || m.toLowerCase();
|
|
28
|
+
const formatShortcutKeys = (k) => k.split(/[_-]/).map((p) => {
|
|
29
|
+
const norm = normalizeModifier(p);
|
|
30
|
+
return KEYS[norm] ?? (p ? p[0].toUpperCase() + p.slice(1) : "");
|
|
31
|
+
});
|
|
32
|
+
const activeShortcutsStore = atom([]);
|
|
33
|
+
const isUsingInput = (el) => {
|
|
34
|
+
const target = el?.shadowRoot?.activeElement || el;
|
|
35
|
+
return target && (/INPUT|TEXTAREA|SELECT/.test(target.tagName) || target.isContentEditable) ? target.getAttribute("name") || true : false;
|
|
36
|
+
};
|
|
37
|
+
const isEnabled = (s, input) => s.usingInput === true || (s.usingInput ? input === s.usingInput : !input);
|
|
38
|
+
const normalizeCombo = (combo) => {
|
|
39
|
+
const parts = combo.toLowerCase().split("_");
|
|
40
|
+
let meta = "";
|
|
41
|
+
let ctrl = "";
|
|
42
|
+
let alt = "";
|
|
43
|
+
let shift = "";
|
|
44
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
45
|
+
const m = MODS[parts[i]] || parts[i];
|
|
46
|
+
if (m === "meta") meta = "meta_";
|
|
47
|
+
else if (m === "ctrl") ctrl = "ctrl_";
|
|
48
|
+
else if (m === "alt") alt = "alt_";
|
|
49
|
+
else if (m === "shift") shift = "shift_";
|
|
50
|
+
}
|
|
51
|
+
return `${meta}${ctrl}${alt}${shift}${parts[parts.length - 1] || ""}`;
|
|
52
|
+
};
|
|
53
|
+
function defineShortcuts(config, options = {}) {
|
|
54
|
+
if (typeof window === "undefined") return () => {};
|
|
55
|
+
const map = /* @__PURE__ */ new Map();
|
|
56
|
+
const reg = [];
|
|
57
|
+
for (const [k, cfg] of Object.entries(config)) {
|
|
58
|
+
if (!cfg) continue;
|
|
59
|
+
const obj = typeof cfg === "object" ? cfg : null;
|
|
60
|
+
const handler = obj ? obj.handler : cfg;
|
|
61
|
+
if (typeof handler !== "function") continue;
|
|
62
|
+
const key = k.includes("-") && k !== "-" && !k.includes("_") ? k.toLowerCase() : normalizeCombo(k);
|
|
63
|
+
map.set(key, {
|
|
64
|
+
handler,
|
|
65
|
+
usingInput: obj?.usingInput
|
|
66
|
+
});
|
|
67
|
+
if (obj?.label || obj?.description) reg.push({
|
|
68
|
+
id: `${obj.category || "system"}-${k}`,
|
|
69
|
+
keys: formatShortcutKeys(k),
|
|
70
|
+
category: obj.category || "system",
|
|
71
|
+
label: obj.label,
|
|
72
|
+
description: obj.description,
|
|
73
|
+
order: obj.order
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const ids = new Set(reg.map((i) => i.id));
|
|
77
|
+
if (ids.size) activeShortcutsStore.set(activeShortcutsStore.get().filter((i) => !ids.has(i.id)).concat(reg));
|
|
78
|
+
const buffer = [];
|
|
79
|
+
let timer;
|
|
80
|
+
const onKeyDown = (e) => {
|
|
81
|
+
if (!e.key || e.isComposing) return;
|
|
82
|
+
const key = e.key === " " ? "space" : e.key.toLowerCase();
|
|
83
|
+
const codeKey = e.code ? e.code.replace(/^Key/, "").replace(/^Digit/, "").toLowerCase() : "";
|
|
84
|
+
const input = isUsingInput(typeof document !== "undefined" ? document.activeElement : null);
|
|
85
|
+
buffer.push(key);
|
|
86
|
+
if (buffer.length > 2) buffer.shift();
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
if (buffer.length === 2) {
|
|
89
|
+
const chainedMatch = map.get(buffer.join("-"));
|
|
90
|
+
if (chainedMatch && isEnabled(chainedMatch, input)) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
chainedMatch.handler(e);
|
|
93
|
+
buffer.length = 0;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const keysToCheck = Array.from(new Set([key, codeKey].filter(Boolean)));
|
|
98
|
+
for (const k of keysToCheck) {
|
|
99
|
+
const sig = `${e.metaKey ? "meta_" : ""}${e.ctrlKey ? "ctrl_" : ""}${e.altKey ? "alt_" : ""}${e.shiftKey ? "shift_" : ""}${k}`;
|
|
100
|
+
const primarySig = !isMac && e.ctrlKey && !e.metaKey ? `meta_${e.altKey ? "alt_" : ""}${e.shiftKey ? "shift_" : ""}${k}` : sig;
|
|
101
|
+
const match = map.get(sig) || map.get(primarySig) || map.get(k);
|
|
102
|
+
if (match && isEnabled(match, input)) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
match.handler(e);
|
|
105
|
+
buffer.length = 0;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
timer = setTimeout(() => void (buffer.length = 0), options.chainDelay ?? 800);
|
|
110
|
+
};
|
|
111
|
+
window.addEventListener("keydown", onKeyDown);
|
|
112
|
+
return () => {
|
|
113
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
if (ids.size) activeShortcutsStore.set(activeShortcutsStore.get().filter((i) => !ids.has(i.id)));
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { activeShortcutsStore, defineShortcuts, formatShortcutKeys, normalizeModifier };
|
package/dist/stores.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/stores.ts
|
|
2
|
+
function atom(initial) {
|
|
3
|
+
let val = initial;
|
|
4
|
+
const subs = /* @__PURE__ */ new Set();
|
|
5
|
+
return {
|
|
6
|
+
get: () => val,
|
|
7
|
+
set: (next) => {
|
|
8
|
+
val = next;
|
|
9
|
+
subs.forEach((fn) => fn(val));
|
|
10
|
+
},
|
|
11
|
+
subscribe: (fn) => {
|
|
12
|
+
subs.add(fn);
|
|
13
|
+
fn(val);
|
|
14
|
+
return () => subs.delete(fn);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { atom };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { n as RimelightIcons } from "./icons-DPnFQCts.mjs";
|
|
2
|
+
import { Preset, UserConfig } from "unocss";
|
|
3
|
+
//#region src/preset.d.ts
|
|
4
|
+
declare const PALETTES: {
|
|
5
|
+
readonly neutral: readonly [0, 0];
|
|
6
|
+
readonly primary: readonly [0.21, 260];
|
|
7
|
+
readonly secondary: readonly [0.18, 70];
|
|
8
|
+
readonly info: readonly [0.24, 260];
|
|
9
|
+
readonly success: readonly [0.2, 150];
|
|
10
|
+
readonly warning: readonly [0.17, 86];
|
|
11
|
+
readonly error: readonly [0.24, 25];
|
|
12
|
+
readonly commentary: readonly [0.29, 322];
|
|
13
|
+
readonly ideation: readonly [0.28, 293];
|
|
14
|
+
readonly source: readonly [0.13, 215];
|
|
15
|
+
};
|
|
16
|
+
declare function rimelightUiPreset({ colors, icons, presets }?: UIConfig): Preset;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/types.d.ts
|
|
19
|
+
type Theme = "light" | "dark";
|
|
20
|
+
type BuiltinThemeColor = keyof typeof PALETTES;
|
|
21
|
+
type ThemeColor = BuiltinThemeColor | (string & {});
|
|
22
|
+
type ClassValue = string | number | boolean | undefined | null | {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
} | ClassValue[];
|
|
25
|
+
interface ThemeConfig<S extends string = string> {
|
|
26
|
+
slots?: readonly S[] | S[];
|
|
27
|
+
base?: Partial<Record<S, ClassValue>>;
|
|
28
|
+
variants?: Record<string, any>;
|
|
29
|
+
compoundVariants?: Array<Record<string, any> & {
|
|
30
|
+
classNames?: Partial<Record<S, ClassValue>>;
|
|
31
|
+
class?: Partial<Record<S, ClassValue>>;
|
|
32
|
+
}>;
|
|
33
|
+
defaultVariants?: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
type ColorModeInput = [chroma: number, hue: number] | readonly [chroma: number, hue: number] | Record<string, string> | {
|
|
36
|
+
light?: Record<string, string>;
|
|
37
|
+
dark?: Record<string, string>;
|
|
38
|
+
};
|
|
39
|
+
interface PresetOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Custom colors.
|
|
42
|
+
*/
|
|
43
|
+
colors?: Record<string, ColorModeInput>;
|
|
44
|
+
/**
|
|
45
|
+
* Global icon overrides mapping icon names to class names (e.g. `i-lucide-x`) or raw SVG strings.
|
|
46
|
+
*/
|
|
47
|
+
icons?: RimelightIcons;
|
|
48
|
+
/**
|
|
49
|
+
* Configure which built-in UnoCSS presets are enabled/disabled.
|
|
50
|
+
*/
|
|
51
|
+
presets?: {
|
|
52
|
+
wind?: boolean;
|
|
53
|
+
typography?: boolean;
|
|
54
|
+
icons?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface UIConfig extends PresetOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Whether to strip default theme classes from all components.
|
|
60
|
+
*/
|
|
61
|
+
unstyled?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Configuration for keyboard shortcuts.
|
|
64
|
+
*/
|
|
65
|
+
shortcuts?: {
|
|
66
|
+
categories?: Record<string, {
|
|
67
|
+
label: string;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Configuration for the Logo component variants.
|
|
72
|
+
*/
|
|
73
|
+
logos?: Record<string, string | Record<string, string | undefined>>;
|
|
74
|
+
/**
|
|
75
|
+
* Global component configuration overrides.
|
|
76
|
+
*/
|
|
77
|
+
components?: {
|
|
78
|
+
themes?: Record<string, ThemeConfig<string>>;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Custom UnoCSS configuration overrides.
|
|
82
|
+
*/
|
|
83
|
+
unocss?: UserConfig;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Theme as a, UIConfig as c, PresetOptions as i, PALETTES as l, ClassValue as n, ThemeColor as o, ColorModeInput as r, ThemeConfig as s, BuiltinThemeColor as t, rimelightUiPreset as u };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as Theme, c as UIConfig, i as PresetOptions, n as ClassValue, o as ThemeColor, r as ColorModeInput, s as ThemeConfig, t as BuiltinThemeColor } from "./types-DWmKMcYC.mjs";
|
|
2
|
+
export { BuiltinThemeColor, ClassValue, ColorModeInput, PresetOptions, Theme, ThemeColor, ThemeConfig, UIConfig };
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimelight/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Rimelight Entertainment's UI Package",
|
|
6
6
|
"homepage": "https://rimelight.com/docs",
|
|
@@ -16,31 +16,55 @@
|
|
|
16
16
|
"url": "git+https://github.com/Rimelight-Entertainment/rimelight.git"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
+
"dist",
|
|
19
20
|
"src"
|
|
20
21
|
],
|
|
21
22
|
"type": "module",
|
|
22
23
|
"exports": {
|
|
23
|
-
".":
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"import": "./dist/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./preset": {
|
|
29
|
+
"types": "./dist/preset.d.mts",
|
|
30
|
+
"import": "./dist/preset.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./resolver": {
|
|
33
|
+
"types": "./dist/resolver.d.mts",
|
|
34
|
+
"import": "./dist/resolver.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./shortcuts": {
|
|
37
|
+
"types": "./dist/shortcuts.d.mts",
|
|
38
|
+
"import": "./dist/shortcuts.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./stores": {
|
|
41
|
+
"types": "./dist/stores.d.mts",
|
|
42
|
+
"import": "./dist/stores.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./types": {
|
|
45
|
+
"types": "./dist/types.d.mts",
|
|
46
|
+
"import": "./dist/types.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./icons": {
|
|
49
|
+
"types": "./dist/icons.d.mts",
|
|
50
|
+
"import": "./dist/icons.mjs"
|
|
51
|
+
},
|
|
24
52
|
"./*": "./src/*"
|
|
25
53
|
},
|
|
26
54
|
"publishConfig": {
|
|
27
55
|
"access": "public"
|
|
28
56
|
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"astro": "astro",
|
|
31
|
-
"check": "vp check --fix && astro check"
|
|
32
|
-
},
|
|
33
57
|
"dependencies": {
|
|
34
|
-
"@unocss/vite": "66.
|
|
35
|
-
"unocss": "66.
|
|
58
|
+
"@unocss/vite": "66.10.0",
|
|
59
|
+
"unocss": "66.10.0"
|
|
36
60
|
},
|
|
37
61
|
"devDependencies": {
|
|
38
62
|
"@astrojs/check": "0.9.10",
|
|
39
63
|
"@astrojs/solid-js": "7.0.2",
|
|
40
64
|
"@astrojs/ts-plugin": "1.10.11",
|
|
41
65
|
"@astrojs/vue": "7.0.2",
|
|
42
|
-
"@rimelight/config": "
|
|
43
|
-
"astro": "7.
|
|
66
|
+
"@rimelight/config": "0.0.5",
|
|
67
|
+
"astro": "7.3.1",
|
|
44
68
|
"solid-js": "1.9.15",
|
|
45
69
|
"typescript": "6.0.3",
|
|
46
70
|
"vue": "3.5.42"
|
|
@@ -69,5 +93,9 @@
|
|
|
69
93
|
"engines": {
|
|
70
94
|
"node": ">=26.7.0"
|
|
71
95
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
96
|
+
"scripts": {
|
|
97
|
+
"build": "vp pack",
|
|
98
|
+
"astro": "astro",
|
|
99
|
+
"check": "vp check --fix && astro check"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -21,7 +21,7 @@ const classes = bannerTheme({
|
|
|
21
21
|
sticky: fixed ? false : sticky
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
const bannerId = (rest
|
|
24
|
+
const bannerId = (rest["id"] as string) || `rla-banner-${Math.random().toString(36).slice(2, 8)}`
|
|
25
25
|
const storageKey = dismissId || bannerId
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -92,7 +92,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
92
92
|
href={props.href}
|
|
93
93
|
target={props.target}
|
|
94
94
|
rel={props.rel || undefined}
|
|
95
|
-
class={classes()
|
|
95
|
+
class={classes()["root"]}
|
|
96
96
|
data-slot="root"
|
|
97
97
|
aria-label={props.ariaLabel}
|
|
98
98
|
aria-disabled={props.disabled ? "true" : undefined}
|
|
@@ -102,7 +102,10 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
102
102
|
{props.leading ? (
|
|
103
103
|
props.leading
|
|
104
104
|
) : isLeading() && showLeadingIcon() ? (
|
|
105
|
-
<span
|
|
105
|
+
<span
|
|
106
|
+
class={`${classes()["leadingIcon"]} ${leadingIconClass()}`}
|
|
107
|
+
data-slot="leading-icon"
|
|
108
|
+
>
|
|
106
109
|
<RLSIcon name={showLeadingIcon()!} size={props.size ?? "md"} aria-hidden="true" />
|
|
107
110
|
</span>
|
|
108
111
|
) : null}
|
|
@@ -110,7 +113,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
110
113
|
{props.children !== undefined && props.children !== null ? (
|
|
111
114
|
props.children
|
|
112
115
|
) : props.label !== undefined && props.label !== null ? (
|
|
113
|
-
<span class={classes()
|
|
116
|
+
<span class={classes()["label"]} data-slot="label">
|
|
114
117
|
{props.label}
|
|
115
118
|
</span>
|
|
116
119
|
) : null}
|
|
@@ -119,7 +122,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
119
122
|
props.trailing
|
|
120
123
|
) : isTrailing() && showTrailingIcon() ? (
|
|
121
124
|
<span
|
|
122
|
-
class={`${classes()
|
|
125
|
+
class={`${classes()["trailingIcon"]} ${trailingIconClass()}`}
|
|
123
126
|
data-slot="trailing-icon"
|
|
124
127
|
>
|
|
125
128
|
<RLSIcon name={showTrailingIcon()!} size={props.size ?? "md"} aria-hidden="true" />
|
|
@@ -133,7 +136,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
133
136
|
<button
|
|
134
137
|
type={props.type || "button"}
|
|
135
138
|
disabled={props.disabled}
|
|
136
|
-
class={classes()
|
|
139
|
+
class={classes()["root"]}
|
|
137
140
|
data-slot="root"
|
|
138
141
|
aria-label={props.ariaLabel}
|
|
139
142
|
onClick={props.onClick}
|
|
@@ -142,7 +145,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
142
145
|
{props.leading ? (
|
|
143
146
|
props.leading
|
|
144
147
|
) : isLeading() && showLeadingIcon() ? (
|
|
145
|
-
<span class={`${classes()
|
|
148
|
+
<span class={`${classes()["leadingIcon"]} ${leadingIconClass()}`} data-slot="leading-icon">
|
|
146
149
|
<RLSIcon name={showLeadingIcon()!} size={props.size ?? "md"} aria-hidden="true" />
|
|
147
150
|
</span>
|
|
148
151
|
) : null}
|
|
@@ -150,7 +153,7 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
150
153
|
{props.children !== undefined && props.children !== null ? (
|
|
151
154
|
props.children
|
|
152
155
|
) : props.label !== undefined && props.label !== null ? (
|
|
153
|
-
<span class={classes()
|
|
156
|
+
<span class={classes()["label"]} data-slot="label">
|
|
154
157
|
{props.label}
|
|
155
158
|
</span>
|
|
156
159
|
) : null}
|
|
@@ -158,7 +161,10 @@ const RLSButton: Component<RLSButtonProps> = (allProps) => {
|
|
|
158
161
|
{props.trailing ? (
|
|
159
162
|
props.trailing
|
|
160
163
|
) : isTrailing() && showTrailingIcon() ? (
|
|
161
|
-
<span
|
|
164
|
+
<span
|
|
165
|
+
class={`${classes()["trailingIcon"]} ${trailingIconClass()}`}
|
|
166
|
+
data-slot="trailing-icon"
|
|
167
|
+
>
|
|
162
168
|
<RLSIcon name={showTrailingIcon()!} size={props.size ?? "md"} aria-hidden="true" />
|
|
163
169
|
</span>
|
|
164
170
|
) : null}
|
|
@@ -62,7 +62,7 @@ const classes = dashboardSidebarTheme({
|
|
|
62
62
|
const sidebar = document.querySelector<HTMLElement>('[data-dashboard-sidebar]');
|
|
63
63
|
if (!sidebar) return;
|
|
64
64
|
|
|
65
|
-
const collapsible = sidebar.dataset
|
|
65
|
+
const collapsible = sidebar.dataset["collapsible"] === 'true';
|
|
66
66
|
const mobilePanel = document.querySelector<HTMLElement>('[data-dashboard-sidebar-mobile]');
|
|
67
67
|
const overlay = document.querySelector<HTMLElement>('[data-dashboard-sidebar-overlay]');
|
|
68
68
|
|
|
@@ -91,8 +91,8 @@ const classes = dashboardSidebarTheme({
|
|
|
91
91
|
|
|
92
92
|
const collapseSidebar = (val?: boolean) => {
|
|
93
93
|
if (!collapsible) return;
|
|
94
|
-
const isCollapsed = val !== undefined ? val : sidebar.dataset
|
|
95
|
-
sidebar.dataset
|
|
94
|
+
const isCollapsed = val !== undefined ? val : sidebar.dataset["collapsed"] !== 'true';
|
|
95
|
+
sidebar.dataset["collapsed"] = isCollapsed ? 'true' : 'false';
|
|
96
96
|
sidebar.setAttribute('data-collapsed', isCollapsed ? 'true' : 'false');
|
|
97
97
|
|
|
98
98
|
document.querySelectorAll('[data-dashboard-toggle="collapse"]').forEach(btn => {
|
|
@@ -109,7 +109,7 @@ const classes = dashboardSidebarTheme({
|
|
|
109
109
|
// Toggle buttons (mobile drawer + collapse)
|
|
110
110
|
const toggle = target.closest<HTMLElement>('[data-dashboard-toggle]');
|
|
111
111
|
if (toggle) {
|
|
112
|
-
const side = toggle.dataset
|
|
112
|
+
const side = toggle.dataset["dashboardToggle"];
|
|
113
113
|
if (side === 'mobile') toggleMobile();
|
|
114
114
|
if (side === 'collapse') collapseSidebar();
|
|
115
115
|
return;
|
|
@@ -80,7 +80,7 @@ const itemGroups: DropdownMenuItem[][] = Array.isArray(items) && items.length >
|
|
|
80
80
|
data-slot="item"
|
|
81
81
|
data-dropdown-item
|
|
82
82
|
data-item-type={item.type}
|
|
83
|
-
data-item-id={item
|
|
83
|
+
data-item-id={item["id"] || item["label"]}
|
|
84
84
|
data-item-action={item.label}
|
|
85
85
|
disabled={item.disabled}
|
|
86
86
|
>
|
|
@@ -79,7 +79,7 @@ const inputId = `fileUpload-${Math.random().toString(36).slice(2, 9)}`
|
|
|
79
79
|
const fileList = zone.querySelector("[data-fileUpload-filelist]") as HTMLElement | null;
|
|
80
80
|
if (!input) return;
|
|
81
81
|
|
|
82
|
-
const isDisabled = zone.dataset
|
|
82
|
+
const isDisabled = zone.dataset["disabled"] === "true";
|
|
83
83
|
if (isDisabled) return;
|
|
84
84
|
|
|
85
85
|
const showFiles = (files: FileList | null) => {
|
|
@@ -39,7 +39,7 @@ const classes = theme({
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
const isBanner = layerType === "banner"
|
|
42
|
-
const layerId = rest
|
|
42
|
+
const layerId = rest["id"] || `rla-${componentName}-${Math.random().toString(36).slice(2, 8)}`
|
|
43
43
|
---
|
|
44
44
|
|
|
45
45
|
<Tag
|
|
@@ -100,7 +100,7 @@ const initialLabel = selectedItem ? selectedItem.label : ""
|
|
|
100
100
|
const onSearchInput = (e: Event) => {
|
|
101
101
|
const q = (e.target as HTMLInputElement).value.toLowerCase();
|
|
102
102
|
items.forEach(item => {
|
|
103
|
-
const label = (item as HTMLElement).dataset
|
|
103
|
+
const label = (item as HTMLElement).dataset["label"]?.toLowerCase() || "";
|
|
104
104
|
if (label.includes(q)) {
|
|
105
105
|
(item as HTMLElement).classList.remove("hidden");
|
|
106
106
|
} else {
|
|
@@ -114,8 +114,8 @@ const initialLabel = selectedItem ? selectedItem.label : ""
|
|
|
114
114
|
items.forEach(item => {
|
|
115
115
|
const onItemClick = (e: MouseEvent) => {
|
|
116
116
|
e.stopPropagation();
|
|
117
|
-
const val = (item as HTMLElement).dataset
|
|
118
|
-
const label = (item as HTMLElement).dataset
|
|
117
|
+
const val = (item as HTMLElement).dataset["value"] || "";
|
|
118
|
+
const label = (item as HTMLElement).dataset["label"] || "";
|
|
119
119
|
|
|
120
120
|
if (hiddenInput) hiddenInput.value = val;
|
|
121
121
|
if (valueSpan) valueSpan.textContent = label;
|
|
@@ -117,12 +117,12 @@ const ratingItems = Array.from({ length }, (_, idx) => {
|
|
|
117
117
|
const input = this.querySelector('.rating-hidden-input') as HTMLInputElement | null
|
|
118
118
|
const items = this.querySelectorAll('.input-rating-item') as NodeListOf<HTMLElement>
|
|
119
119
|
|
|
120
|
-
const step = parseFloat(this.dataset
|
|
121
|
-
const length = parseInt(this.dataset
|
|
122
|
-
const clearable = this.dataset
|
|
123
|
-
const hoverable = this.dataset
|
|
124
|
-
const disabled = this.dataset
|
|
125
|
-
const readonly = this.dataset
|
|
120
|
+
const step = parseFloat(this.dataset["step"] || '1')
|
|
121
|
+
const length = parseInt(this.dataset["length"] || '5')
|
|
122
|
+
const clearable = this.dataset["clearable"] === 'true'
|
|
123
|
+
const hoverable = this.dataset["hoverable"] === 'true'
|
|
124
|
+
const disabled = this.dataset["disabled"] === 'true'
|
|
125
|
+
const readonly = this.dataset["readonly"] === 'true'
|
|
126
126
|
|
|
127
127
|
if (disabled || readonly) return
|
|
128
128
|
|
|
@@ -130,7 +130,7 @@ const ratingItems = Array.from({ length }, (_, idx) => {
|
|
|
130
130
|
|
|
131
131
|
function updateVisuals(val: number) {
|
|
132
132
|
items.forEach((item) => {
|
|
133
|
-
const idx = parseInt(item.dataset
|
|
133
|
+
const idx = parseInt(item.dataset["index"] || '0')
|
|
134
134
|
const indicator = item.querySelector('.rating-item-indicator') as HTMLElement | null
|
|
135
135
|
if (indicator) {
|
|
136
136
|
indicator.style.width = getWidthForVal(val, idx)
|
|
@@ -153,7 +153,7 @@ const ratingItems = Array.from({ length }, (_, idx) => {
|
|
|
153
153
|
const clickListeners = new Map<HTMLElement, (e: MouseEvent) => void>()
|
|
154
154
|
|
|
155
155
|
items.forEach((item) => {
|
|
156
|
-
const idx = parseInt(item.dataset
|
|
156
|
+
const idx = parseInt(item.dataset["index"] || '0')
|
|
157
157
|
|
|
158
158
|
const onMouseMove = (event: MouseEvent) => {
|
|
159
159
|
const val = getValueFromEvent(event, item, idx)
|
|
@@ -136,7 +136,7 @@ const classes = layoutGridTheme(Astro.props)
|
|
|
136
136
|
this.updateGrid()
|
|
137
137
|
|
|
138
138
|
// Set up shortcuts using the library system
|
|
139
|
-
const shortcutKey = this.dataset
|
|
139
|
+
const shortcutKey = this.dataset["shortcut"] || 'meta_shift_g'
|
|
140
140
|
this.shortcutsCleanup = defineShortcuts({
|
|
141
141
|
[shortcutKey]: {
|
|
142
142
|
handler: (e) => {
|
|
@@ -160,10 +160,10 @@ const classes = layoutGridTheme(Astro.props)
|
|
|
160
160
|
|
|
161
161
|
private handleResize() {
|
|
162
162
|
const width = document.documentElement.clientWidth
|
|
163
|
-
const smBreakpoint = parseInt(this.dataset
|
|
164
|
-
const mdBreakpoint = parseInt(this.dataset
|
|
165
|
-
const lgBreakpoint = parseInt(this.dataset
|
|
166
|
-
const xlBreakpoint = parseInt(this.dataset
|
|
163
|
+
const smBreakpoint = parseInt(this.dataset["smBreakpoint"] || '640')
|
|
164
|
+
const mdBreakpoint = parseInt(this.dataset["mdBreakpoint"] || '768')
|
|
165
|
+
const lgBreakpoint = parseInt(this.dataset["lgBreakpoint"] || '1024')
|
|
166
|
+
const xlBreakpoint = parseInt(this.dataset["xlBreakpoint"] || '1280')
|
|
167
167
|
|
|
168
168
|
let newBreakpoint: 'base' | 'sm' | 'md' | 'lg' | 'xl' = 'base'
|
|
169
169
|
|
|
@@ -185,57 +185,57 @@ const classes = layoutGridTheme(Astro.props)
|
|
|
185
185
|
if (!this.columnsContainer) return
|
|
186
186
|
|
|
187
187
|
const width = document.documentElement.clientWidth
|
|
188
|
-
const smBreakpoint = parseInt(this.dataset
|
|
189
|
-
const mdBreakpoint = parseInt(this.dataset
|
|
190
|
-
const lgBreakpoint = parseInt(this.dataset
|
|
191
|
-
const xlBreakpoint = parseInt(this.dataset
|
|
188
|
+
const smBreakpoint = parseInt(this.dataset["smBreakpoint"] || '640')
|
|
189
|
+
const mdBreakpoint = parseInt(this.dataset["mdBreakpoint"] || '768')
|
|
190
|
+
const lgBreakpoint = parseInt(this.dataset["lgBreakpoint"] || '1024')
|
|
191
|
+
const xlBreakpoint = parseInt(this.dataset["xlBreakpoint"] || '1280')
|
|
192
192
|
|
|
193
193
|
let breakpointIndex = 0
|
|
194
|
-
let colCount = parseInt(this.dataset
|
|
194
|
+
let colCount = parseInt(this.dataset["cols"] || '4')
|
|
195
195
|
let breakpointThreshold = 0
|
|
196
196
|
|
|
197
197
|
switch (this.currentBreakpoint) {
|
|
198
198
|
case 'xl':
|
|
199
199
|
breakpointIndex = 4
|
|
200
|
-
colCount = parseInt(this.dataset
|
|
200
|
+
colCount = parseInt(this.dataset["xlCols"] || '12')
|
|
201
201
|
breakpointThreshold = xlBreakpoint
|
|
202
202
|
break
|
|
203
203
|
case 'lg':
|
|
204
204
|
breakpointIndex = 3
|
|
205
|
-
colCount = parseInt(this.dataset
|
|
205
|
+
colCount = parseInt(this.dataset["lgCols"] || '12')
|
|
206
206
|
breakpointThreshold = lgBreakpoint
|
|
207
207
|
break
|
|
208
208
|
case 'md':
|
|
209
209
|
breakpointIndex = 2
|
|
210
|
-
colCount = parseInt(this.dataset
|
|
210
|
+
colCount = parseInt(this.dataset["mdCols"] || '8')
|
|
211
211
|
breakpointThreshold = mdBreakpoint
|
|
212
212
|
break
|
|
213
213
|
case 'sm':
|
|
214
214
|
breakpointIndex = 1
|
|
215
|
-
colCount = parseInt(this.dataset
|
|
215
|
+
colCount = parseInt(this.dataset["smCols"] || '4')
|
|
216
216
|
breakpointThreshold = smBreakpoint
|
|
217
217
|
break
|
|
218
218
|
default:
|
|
219
219
|
breakpointIndex = 0
|
|
220
|
-
colCount = parseInt(this.dataset
|
|
220
|
+
colCount = parseInt(this.dataset["cols"] || '4')
|
|
221
221
|
breakpointThreshold = 0
|
|
222
222
|
break
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
const gutterArray = JSON.parse(this.dataset
|
|
226
|
-
const marginArray = JSON.parse(this.dataset
|
|
225
|
+
const gutterArray = JSON.parse(this.dataset["gutter"] || '[1,1,1,1,1]')
|
|
226
|
+
const marginArray = JSON.parse(this.dataset["margin"] || '[1,1,1,1,1]')
|
|
227
227
|
|
|
228
228
|
const gutterValue = gutterArray[breakpointIndex] ?? gutterArray[gutterArray.length - 1]
|
|
229
229
|
const marginValue = marginArray[breakpointIndex] ?? marginArray[marginArray.length - 1]
|
|
230
230
|
|
|
231
|
-
const gridColor = this.dataset
|
|
232
|
-
const gridOpacity = parseFloat(this.dataset
|
|
233
|
-
const showBackground = this.dataset
|
|
231
|
+
const gridColor = this.dataset["gridColor"] || '#ff0000'
|
|
232
|
+
const gridOpacity = parseFloat(this.dataset["gridOpacity"] || '0.1')
|
|
233
|
+
const showBackground = this.dataset["showBackground"] === 'true'
|
|
234
234
|
|
|
235
|
-
const showFullWidth = this.dataset
|
|
236
|
-
const fullWidthColor = this.dataset
|
|
237
|
-
const fullWidthOpacity = parseFloat(this.dataset
|
|
238
|
-
const showFullWidthBackground = this.dataset
|
|
235
|
+
const showFullWidth = this.dataset["showFullWidth"] !== 'false'
|
|
236
|
+
const fullWidthColor = this.dataset["fullWidthColor"] || '#3b82f6'
|
|
237
|
+
const fullWidthOpacity = parseFloat(this.dataset["fullWidthOpacity"] || '0.05')
|
|
238
|
+
const showFullWidthBackground = this.dataset["showFullWidthBackground"] === 'true'
|
|
239
239
|
|
|
240
240
|
// Convert rem spacings to pixels dynamically based on root font size
|
|
241
241
|
const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16
|
|
@@ -243,20 +243,20 @@ const classes = layoutGridTheme(Astro.props)
|
|
|
243
243
|
const gutterPx = gutterValue * rootFontSize
|
|
244
244
|
|
|
245
245
|
// Calculate max width boundaries
|
|
246
|
-
const maxWidthVal = this.dataset
|
|
246
|
+
const maxWidthVal = this.dataset["maxWidth"] || '1440px'
|
|
247
247
|
let maxWidthPx = width
|
|
248
248
|
if (!maxWidthVal.includes('vw')) {
|
|
249
249
|
maxWidthPx = parseInt(maxWidthVal)
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
const innerMaxWidthVal = this.dataset
|
|
252
|
+
const innerMaxWidthVal = this.dataset["innerMaxWidth"] || '768px'
|
|
253
253
|
let innerMaxWidthPx = width
|
|
254
254
|
if (!innerMaxWidthVal.includes('vw')) {
|
|
255
255
|
innerMaxWidthPx = parseInt(innerMaxWidthVal)
|
|
256
256
|
}
|
|
257
|
-
const innerGridColor = this.dataset
|
|
258
|
-
const innerGridOpacity = parseFloat(this.dataset
|
|
259
|
-
const showInnerBackground = this.dataset
|
|
257
|
+
const innerGridColor = this.dataset["innerColor"] || '#10b981'
|
|
258
|
+
const innerGridOpacity = parseFloat(this.dataset["innerOpacity"] || '0.1')
|
|
259
|
+
const showInnerBackground = this.dataset["showInnerBackground"] === 'true'
|
|
260
260
|
|
|
261
261
|
// Calculate grid properties based on container width or screen width
|
|
262
262
|
const activeWidth = width > maxWidthPx ? maxWidthPx : width
|