@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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/dist/icons-DPnFQCts.d.mts +72 -0
  3. package/dist/icons.d.mts +2 -0
  4. package/dist/icons.mjs +32 -0
  5. package/dist/icons.raw-CjAuL2Sc.mjs +67 -0
  6. package/dist/index.d.mts +13 -0
  7. package/dist/index.mjs +26 -0
  8. package/dist/preset.d.mts +2 -0
  9. package/dist/preset.mjs +215 -0
  10. package/dist/resolver.d.mts +6 -0
  11. package/dist/resolver.mjs +116 -0
  12. package/dist/shortcuts.d.mts +29 -0
  13. package/dist/shortcuts.mjs +119 -0
  14. package/dist/stores.d.mts +9 -0
  15. package/dist/stores.mjs +19 -0
  16. package/dist/types-DWmKMcYC.d.mts +86 -0
  17. package/dist/types.d.mts +2 -0
  18. package/dist/types.mjs +1 -0
  19. package/package.json +40 -12
  20. package/src/components/banner/RLABanner.astro +1 -1
  21. package/src/components/button/RLSButton.tsx +14 -8
  22. package/src/components/dashboard-sidebar/RLADashboardSidebar.astro +4 -4
  23. package/src/components/dropdown-menu/RLADropdownMenu.astro +1 -1
  24. package/src/components/file-upload/RLAFileUpload.astro +1 -1
  25. package/src/components/header/HeaderLayer.astro +1 -1
  26. package/src/components/input-menu/RLAInputMenu.astro +3 -3
  27. package/src/components/input-rating/RLAInputRating.astro +8 -8
  28. package/src/components/layout-grid/RLALayoutGrid.astro +29 -29
  29. package/src/components/link/RLALink.astro +5 -5
  30. package/src/components/link/RLSLink.tsx +4 -4
  31. package/src/components/locale-selector/RLALocaleSelector.astro +109 -102
  32. package/src/components/locale-selector/locale-selector.ts +2 -7
  33. package/src/components/logo/RLALogo.astro +88 -102
  34. package/src/components/navigation-menu/RLANavigationMenu.astro +6 -6
  35. package/src/components/popover/RLAPopover.astro +2 -2
  36. package/src/components/scroll-area/RLAScrollArea.astro +1 -1
  37. package/src/components/scroll-to-top/RLAScrollToTop.astro +4 -4
  38. package/src/components/search/RLASearch.astro +6 -6
  39. package/src/components/shortcuts/RLAShortcuts.astro +2 -2
  40. package/src/components/sidebar/RLASidebar.astro +1 -1
  41. package/src/components/splitter/RLASplitter.astro +1 -1
  42. package/src/components/stepper/RLAStepper.astro +9 -9
  43. package/src/components/table/RLATable.astro +1 -1
  44. package/src/components/tabs/RLATabs.astro +8 -8
  45. package/src/components/toast/RLAToast.astro +2 -2
  46. package/src/index.ts +13 -3
@@ -158,9 +158,9 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
158
158
  private isDisabled: boolean = false
159
159
 
160
160
  connectedCallback() {
161
- this.currentIndex = Number(this.dataset.currentIndex || 0)
162
- this.isLinear = this.dataset.linear === "true"
163
- this.isDisabled = this.dataset.disabled === "true"
161
+ this.currentIndex = Number(this.dataset["currentIndex"] || 0)
162
+ this.isLinear = this.dataset["linear"] === "true"
163
+ this.isDisabled = this.dataset["disabled"] === "true"
164
164
 
165
165
  const items = this.querySelectorAll('[data-slot="item"]')
166
166
  this.itemsCount = items.length
@@ -168,7 +168,7 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
168
168
  const triggers = this.querySelectorAll('[data-step-trigger]')
169
169
  triggers.forEach(trig => {
170
170
  trig.addEventListener('click', () => {
171
- const index = Number((trig as HTMLElement).dataset.stepTrigger)
171
+ const index = Number((trig as HTMLElement).dataset["stepTrigger"])
172
172
  if (!isNaN(index)) {
173
173
  this.goTo(index)
174
174
  }
@@ -205,11 +205,11 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
205
205
 
206
206
  const oldIndex = this.currentIndex
207
207
  this.currentIndex = index
208
- this.dataset.currentIndex = String(index)
208
+ this.dataset["currentIndex"] = String(index)
209
209
  this.updateState()
210
210
 
211
211
  const itemEl = this.querySelector(`[data-slot="item"][data-index="${index}"]`) as HTMLElement | null
212
- const itemVal = itemEl?.dataset.value ?? index
212
+ const itemVal = itemEl?.dataset["value"] ?? index
213
213
 
214
214
  if (index > oldIndex) {
215
215
  this.dispatchEvent(new CustomEvent('next', { detail: { index, value: itemVal } }))
@@ -223,7 +223,7 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
223
223
  const items = this.querySelectorAll('[data-slot="item"]')
224
224
  items.forEach((itemNode) => {
225
225
  const item = itemNode as HTMLElement
226
- const idx = Number(item.dataset.index)
226
+ const idx = Number(item.dataset["index"])
227
227
  const isCompleted = idx < this.currentIndex
228
228
  const isActive = idx === this.currentIndex
229
229
  const isDisabled = this.isDisabled || (this.isLinear && idx > this.currentIndex)
@@ -261,7 +261,7 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
261
261
  const separators = this.querySelectorAll('[data-slot="separator"]')
262
262
  separators.forEach((sepNode) => {
263
263
  const sep = sepNode as HTMLElement
264
- const sepIdx = Number(sep.dataset.separatorIndex)
264
+ const sepIdx = Number(sep.dataset["separatorIndex"])
265
265
  if (sepIdx < this.currentIndex) {
266
266
  sep.classList.add('!bg-primary-600')
267
267
  sep.classList.remove('bg-neutral-200')
@@ -275,7 +275,7 @@ const currentIndex = activeIndex >= 0 ? activeIndex : 0
275
275
  const panels = this.querySelectorAll('[data-stepper-panel]')
276
276
  panels.forEach((panelNode) => {
277
277
  const panel = panelNode as HTMLElement
278
- const idx = Number(panel.dataset.stepperPanel)
278
+ const idx = Number(panel.dataset["stepperPanel"])
279
279
  if (idx === this.currentIndex) {
280
280
  panel.removeAttribute('hidden')
281
281
  } else {
@@ -37,7 +37,7 @@ const {
37
37
  const classes = tableTheme({
38
38
  ...Astro.props,
39
39
  sticky: typeof sticky === "boolean" ? sticky : sticky,
40
- externalScroll: Boolean(typeof virtualize === "object" && virtualize?.getScrollElement)
40
+ externalScroll: Boolean(typeof virtualize === "object" && virtualize?.["getScrollElement"])
41
41
  })
42
42
 
43
43
  // Normalize columns from props.columns or props.headers or infer from data keys
@@ -225,7 +225,7 @@ if (needsOverflow && renderedListItems.length > 1) {
225
225
 
226
226
  const list = container.querySelector("[data-slot=list]") as HTMLElement | null;
227
227
  const indicator = container.querySelector("[data-slot=indicator]") as HTMLElement | null;
228
- const orientation = this.dataset.orientation || "horizontal";
228
+ const orientation = this.dataset["orientation"] || "horizontal";
229
229
  const isVertical = orientation === "vertical";
230
230
 
231
231
  const updateIndicator = (activeTrigger: HTMLElement | null) => {
@@ -263,7 +263,7 @@ if (needsOverflow && renderedListItems.length > 1) {
263
263
  }
264
264
  };
265
265
 
266
- const containerValue = container.dataset.value;
266
+ const containerValue = container.dataset["value"];
267
267
  const triggers = container.querySelectorAll("[role=tab]");
268
268
  const panels = container.querySelectorAll("[role=tabpanel]");
269
269
  const popoverItems = container.querySelectorAll("[data-popover-item]");
@@ -273,7 +273,7 @@ if (needsOverflow && renderedListItems.length > 1) {
273
273
  const syncState = (targetValue: string | undefined) => {
274
274
  triggers.forEach(trigger => {
275
275
  const el = trigger as HTMLElement;
276
- const val = el.dataset.value;
276
+ const val = el.dataset["value"];
277
277
  const isActive = val === targetValue;
278
278
  el.setAttribute("data-state", isActive ? "active" : "inactive");
279
279
  if (isActive) activeTrigger = el;
@@ -281,7 +281,7 @@ if (needsOverflow && renderedListItems.length > 1) {
281
281
 
282
282
  popoverItems.forEach(item => {
283
283
  const el = item as HTMLElement;
284
- const val = el.dataset.tabOverflowValue;
284
+ const val = el.dataset["tabOverflowValue"];
285
285
  if (val === targetValue) {
286
286
  el.setAttribute("data-active", "true");
287
287
  el.classList.add("bg-muted/80", "font-medium");
@@ -292,7 +292,7 @@ if (needsOverflow && renderedListItems.length > 1) {
292
292
  });
293
293
 
294
294
  panels.forEach(panel => {
295
- const val = (panel as HTMLElement).dataset.value;
295
+ const val = (panel as HTMLElement).dataset["value"];
296
296
  if (val === targetValue) {
297
297
  panel.removeAttribute("hidden");
298
298
  } else {
@@ -319,7 +319,7 @@ if (needsOverflow && renderedListItems.length > 1) {
319
319
  // Watch for browser Find-in-Page auto-expands
320
320
  panels.forEach(panel => {
321
321
  const onBeforeMatch = () => {
322
- const targetValue = (panel as HTMLElement).dataset.value;
322
+ const targetValue = (panel as HTMLElement).dataset["value"];
323
323
  const trigger = container.querySelector(`[role=tab][data-value="${targetValue}"]`) as HTMLButtonElement | null;
324
324
  if (trigger) {
325
325
  trigger.click();
@@ -335,7 +335,7 @@ if (needsOverflow && renderedListItems.length > 1) {
335
335
  const trigger = triggerNode as HTMLButtonElement;
336
336
  const onClick = () => {
337
337
  if (trigger.disabled) return;
338
- const targetValue = trigger.dataset.value;
338
+ const targetValue = trigger.dataset["value"];
339
339
  syncState(targetValue);
340
340
  updateIndicator(trigger);
341
341
  };
@@ -346,7 +346,7 @@ if (needsOverflow && renderedListItems.length > 1) {
346
346
  popoverItems.forEach(itemNode => {
347
347
  const item = itemNode as HTMLButtonElement;
348
348
  const onClick = () => {
349
- const targetValue = item.dataset.tabOverflowValue;
349
+ const targetValue = item.dataset["tabOverflowValue"];
350
350
  syncState(targetValue);
351
351
  const activeTrig = container.querySelector(`[role=tab][data-value="${targetValue}"]`) as HTMLElement | null;
352
352
  updateIndicator(activeTrig);
@@ -31,7 +31,7 @@ const variantIcons: Record<string, string> = {
31
31
  info: "i-rl-info",
32
32
  }
33
33
 
34
- const icon = variantIcons[variant] ?? variantIcons.default!
34
+ const icon = variantIcons[variant] ?? variantIcons["default"]!
35
35
  const isError = variant === "error"
36
36
  ---
37
37
 
@@ -102,7 +102,7 @@ const isError = variant === "error"
102
102
  if (!dismissable) return;
103
103
 
104
104
  const close = toast.querySelector("[data-toast-close]");
105
- const duration = parseInt(toast.dataset.duration ?? "6000", 10);
105
+ const duration = parseInt(toast.dataset["duration"] ?? "6000", 10);
106
106
  let timerId: ReturnType<typeof setTimeout> | null = null;
107
107
  let startTime = Date.now();
108
108
  let remaining = duration;
package/src/index.ts CHANGED
@@ -4,8 +4,18 @@ import type { UIConfig } from "./types"
4
4
 
5
5
  const ID = "virtual:rimelight/ui"
6
6
 
7
- export const ui = ({ unocss = {}, ...cfg }: UIConfig = {}) => [
8
- UnoCSS({
7
+ export interface RimelightUIPlugin {
8
+ name: string
9
+ enforce?: "pre" | "post"
10
+ resolveId?: (id: string) => string | null | undefined
11
+ load?: (id: string) => string | null | undefined
12
+ [key: string]: any
13
+ }
14
+
15
+ export type RimelightUIPlugins = (RimelightUIPlugin | RimelightUIPlugin[])[]
16
+
17
+ export const ui = ({ unocss = {}, ...cfg }: UIConfig = {}): RimelightUIPlugins => [
18
+ ...(UnoCSS({
9
19
  ...unocss,
10
20
  presets: [rimelightUiPreset(cfg), ...(unocss.presets || [])],
11
21
  content: {
@@ -21,7 +31,7 @@ export const ui = ({ unocss = {}, ...cfg }: UIConfig = {}) => [
21
31
  ]
22
32
  }
23
33
  }
24
- }),
34
+ }) as RimelightUIPlugin[]),
25
35
  {
26
36
  name: "rimelight/ui",
27
37
  enforce: "pre",