@close-by/clay 0.2.3 → 0.2.5

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/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@close-by/clay",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "NiceGUI-like ui.* facade for Clay apps",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "src/index.ts",
8
8
  "exports": {
9
- ".": "./src/index.ts"
9
+ ".": "./src/index.ts",
10
+ "./page-tsconfig": "./page-tsconfig.json"
10
11
  },
11
12
  "files": [
12
13
  "src",
14
+ "page-tsconfig.json",
13
15
  "README.md",
14
16
  "LICENSE",
15
17
  "!src/**/*.test.ts",
@@ -25,9 +27,10 @@
25
27
  "access": "public"
26
28
  },
27
29
  "dependencies": {
28
- "@close-by/clay-core": "0.2.3",
29
- "@close-by/clay-components": "0.2.3",
30
- "@close-by/clay-server": "0.2.3",
30
+ "@close-by/clay-compiler": "0.2.5",
31
+ "@close-by/clay-core": "0.2.5",
32
+ "@close-by/clay-components": "0.2.5",
33
+ "@close-by/clay-server": "0.2.5",
31
34
  "@tailwindcss/cli": "^4.3.3",
32
35
  "tailwindcss": "^4.3.3"
33
36
  }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "lib": ["ESNext"],
5
+ "types": ["bun-types"],
6
+ "target": "ESNext",
7
+ "module": "Preserve",
8
+ "moduleResolution": "bundler",
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "noEmit": true,
12
+ "verbatimModuleSyntax": true
13
+ }
14
+ }
package/src/index.ts CHANGED
@@ -9,6 +9,9 @@ import {
9
9
  radioGroup as radioGroupFactory,
10
10
  combobox as comboboxFactory,
11
11
  date as dateFactory,
12
+ dateRange as dateRangeFactory,
13
+ timeline as timelineFactory,
14
+ stepper as stepperFactory,
12
15
  tooltip as tooltipFactory,
13
16
  avatar as avatarFactory,
14
17
  skeleton as skeletonFactory,
@@ -22,6 +25,8 @@ import {
22
25
  progress as progressFactory,
23
26
  separator as separatorFactory,
24
27
  icon as iconFactory,
28
+ iconText as iconTextFactory,
29
+ statusDot as statusDotFactory,
25
30
  stat as statFactory,
26
31
  dataTable as dataTableFactory,
27
32
  areaChart as areaChartFactory,
@@ -32,6 +37,7 @@ import {
32
37
  radialChart as radialChartFactory,
33
38
  scatterChart as scatterChartFactory,
34
39
  composedChart as composedChartFactory,
40
+ sparkline as sparklineFactory,
35
41
  row as rowFactory,
36
42
  column as columnFactory,
37
43
  container as containerFactory,
@@ -99,6 +105,14 @@ import {
99
105
  type RadioGroupProps,
100
106
  type ComboboxProps,
101
107
  type DateProps,
108
+ type DateRangeProps,
109
+ type DateRangePreset,
110
+ type TimelineProps,
111
+ type TimelineItem,
112
+ type TimelineItemStatus,
113
+ type StepperProps,
114
+ type StepperStepOptions,
115
+ type StepperStepStatus,
102
116
  type TooltipProps,
103
117
  type AvatarProps,
104
118
  type SkeletonProps,
@@ -111,6 +125,10 @@ import {
111
125
  type ProgressProps,
112
126
  type SeparatorProps,
113
127
  type IconProps,
128
+ type IconTextProps,
129
+ type IconSlotProps,
130
+ type StatusDotProps,
131
+ type StatusDotColor,
114
132
  type StatItem,
115
133
  type DataTableProps,
116
134
  type DataTableAction,
@@ -146,6 +164,11 @@ import {
146
164
  type ComposedSeriesType,
147
165
  type CartesianChartProps,
148
166
  type ChartSeries,
167
+ type ChartHeadline,
168
+ type ChartPeriod,
169
+ type ChartReferenceLine,
170
+ type ChartReferenceArea,
171
+ type SparklineProps,
149
172
  type CardProps,
150
173
  type DialogProps,
151
174
  type DialogStackProps,
@@ -312,6 +335,7 @@ import {
312
335
  TableBuilder,
313
336
  DialogElement,
314
337
  DialogStackElement,
338
+ StepperElement,
315
339
  AlertDialogElement,
316
340
  DropdownMenuElement,
317
341
  ContextMenuElement,
@@ -440,6 +464,14 @@ export type {
440
464
  DialogProps,
441
465
  DialogStackProps,
442
466
  DialogStackStepOptions,
467
+ StepperProps,
468
+ StepperStepOptions,
469
+ StepperStepStatus,
470
+ TimelineProps,
471
+ TimelineItem,
472
+ TimelineItemStatus,
473
+ DateRangeProps,
474
+ DateRangePreset,
443
475
  AlertDialogProps,
444
476
  DropdownMenuProps,
445
477
  DropdownItemOptions,
@@ -594,6 +626,7 @@ export {
594
626
  TableBuilder,
595
627
  DialogElement,
596
628
  DialogStackElement,
629
+ StepperElement,
597
630
  AlertDialogElement,
598
631
  DropdownMenuElement,
599
632
  SheetElement,
@@ -624,7 +657,10 @@ export function label(text?: string | (() => string), props?: Omit<LabelProps, '
624
657
  }
625
658
 
626
659
  /** Clickable button. Prefer `ui.button`. See {@link ButtonProps}. */
627
- export function button(text?: string, props?: Omit<ButtonProps, 'text'>): Element {
660
+ export function button(
661
+ text?: string | (() => string),
662
+ props?: Omit<ButtonProps, 'text'>,
663
+ ): Element {
628
664
  return buttonFactory(text, props);
629
665
  }
630
666
 
@@ -671,6 +707,29 @@ export function date(props?: DateProps): Element {
671
707
  return dateFactory(props);
672
708
  }
673
709
 
710
+ /** Date range picker with presets. Prefer `ui.dateRange`. See {@link DateRangeProps}. */
711
+ export function dateRange(props?: DateRangeProps): Element {
712
+ return dateRangeFactory(props);
713
+ }
714
+
715
+ /** Chronological events for feeds and deploy logs. See {@link TimelineProps}. */
716
+ export function timeline(props: TimelineProps): Element {
717
+ return timelineFactory(props);
718
+ }
719
+
720
+ /** Inline multi-step flow with step panels. See {@link StepperProps}. */
721
+ export function stepper(
722
+ fn: (s: StepperElement) => void,
723
+ props?: StepperProps,
724
+ ): StepperElement;
725
+ export function stepper(
726
+ props: StepperProps,
727
+ fn: (s: StepperElement) => void,
728
+ ): StepperElement;
729
+ export function stepper(a: any, b?: any): StepperElement {
730
+ return stepperFactory(a, b);
731
+ }
732
+
674
733
  /** Tooltip around content (`fn` or props-first). Prefer `ui.tooltip`. See {@link TooltipProps}. */
675
734
  export function tooltip(fn: () => void, props: TooltipProps): Element;
676
735
  export function tooltip(props: TooltipProps, fn: () => void): Element;
@@ -713,8 +772,11 @@ export function externalLink(
713
772
  }
714
773
 
715
774
  /** Small status badge. Prefer `ui.badge`. See {@link BadgeProps}. */
716
- export function badge(text?: string, props?: Omit<BadgeProps, 'text'>): Element {
717
- return badgeFactory(text, props);
775
+ export function badge(
776
+ text?: string | (() => string) | BadgeProps,
777
+ props?: Omit<BadgeProps, 'text'>,
778
+ ): Element {
779
+ return badgeFactory(text as Parameters<typeof badgeFactory>[0], props);
718
780
  }
719
781
 
720
782
  /**
@@ -766,6 +828,19 @@ export function icon(name: string, props?: Omit<IconProps, 'name'>): Element {
766
828
  return iconFactory(name, props);
767
829
  }
768
830
 
831
+ /** Inline icon + text (replaces manual `ui.row` + `ui.icon` + `ui.label`). See {@link IconTextProps}. */
832
+ export function iconText(
833
+ text?: string | (() => string),
834
+ props?: Omit<IconTextProps, 'text'>,
835
+ ): Element {
836
+ return iconTextFactory(text, props);
837
+ }
838
+
839
+ /** Status dot (or icon) + label for feeds and tables. See {@link StatusDotProps}. */
840
+ export function statusDot(props?: StatusDotProps): Element {
841
+ return statusDotFactory(props);
842
+ }
843
+
769
844
  /** Render markdown to HTML. Prefer `ui.markdown`. See {@link MarkdownProps}. */
770
845
  export function markdown(text?: string, props?: MarkdownProps): Element {
771
846
  return markdownFactory(text, props);
@@ -945,6 +1020,11 @@ export function composedChart(props: ComposedChartProps): Element {
945
1020
  return composedChartFactory(props);
946
1021
  }
947
1022
 
1023
+ /** KPI card with inline sparkline. Prefer `ui.sparkline`. See {@link SparklineProps}. */
1024
+ export function sparkline(props: SparklineProps): Element {
1025
+ return sparklineFactory(props);
1026
+ }
1027
+
948
1028
  /** Horizontal flex row (`fn` or props-first). Prefer `ui.row`. */
949
1029
  export function row(fn: () => void, props?: Parameters<typeof rowFactory>[1]): Element;
950
1030
  export function row(props: Parameters<typeof rowFactory>[0], fn: () => void): Element;
@@ -1497,6 +1577,9 @@ export const ui = {
1497
1577
  radioGroup,
1498
1578
  combobox,
1499
1579
  date,
1580
+ dateRange,
1581
+ timeline,
1582
+ stepper,
1500
1583
  tooltip,
1501
1584
  avatar,
1502
1585
  skeleton,
@@ -1543,6 +1626,7 @@ export const ui = {
1543
1626
  radialChart,
1544
1627
  scatterChart,
1545
1628
  composedChart,
1629
+ sparkline,
1546
1630
  row,
1547
1631
  column,
1548
1632
  container,
package/src/pages.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { fileURLToPath, pathToFileURL } from 'url';
2
2
  import { join } from 'path';
3
+ import { readFile } from 'fs/promises';
3
4
  import {
4
5
  clearPages,
5
6
  getRegisteredPaths,
6
7
  type PageFn,
7
8
  } from '@close-by/clay-core';
9
+ import { warnClayPageIssues } from '@close-by/clay-compiler';
8
10
  import type { AppNavItem } from '@close-by/clay-components';
9
11
 
10
12
  /**
@@ -26,6 +28,15 @@ export async function importFresh(absPath: string): Promise<unknown> {
26
28
  return import(href);
27
29
  }
28
30
 
31
+ async function warnPageModuleIfNeeded(absPath: string): Promise<void> {
32
+ try {
33
+ const text = await readFile(absPath, 'utf8');
34
+ warnClayPageIssues(text, absPath);
35
+ } catch {
36
+ // unreadable — import will surface the error
37
+ }
38
+ }
39
+
29
40
  /**
30
41
  * Optional metadata for a registered page — used by `navFromPages` / `loadPages`.
31
42
  * Export as `pageMeta` from a page module, or pass via `attachPageMeta`.
@@ -108,6 +119,7 @@ export async function loadPages(dir: string | URL): Promise<string[]> {
108
119
  for (const relative of files) {
109
120
  const fullPath = join(absDir, relative);
110
121
  const pathsBefore = new Set(getRegisteredPaths());
122
+ await warnPageModuleIfNeeded(fullPath);
111
123
  const mod = (await importFresh(fullPath)) as { pageMeta?: PageMeta };
112
124
  const added = getRegisteredPaths().filter((p) => !pathsBefore.has(p));
113
125
  if (added.length === 1 && mod.pageMeta) {