@close-by/clay 0.2.2 → 0.2.3

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 (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.ts +31 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@close-by/clay",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "NiceGUI-like ui.* facade for Clay apps",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,9 +25,9 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@close-by/clay-core": "0.2.2",
29
- "@close-by/clay-components": "0.2.2",
30
- "@close-by/clay-server": "0.2.2",
28
+ "@close-by/clay-core": "0.2.3",
29
+ "@close-by/clay-components": "0.2.3",
30
+ "@close-by/clay-server": "0.2.3",
31
31
  "@tailwindcss/cli": "^4.3.3",
32
32
  "tailwindcss": "^4.3.3"
33
33
  }
package/src/index.ts CHANGED
@@ -52,6 +52,7 @@ import {
52
52
  command as commandFactory,
53
53
  resizable as resizableFactory,
54
54
  scrollArea as scrollAreaFactory,
55
+ viewportEnter as viewportEnterFactory,
55
56
  keybind as keybindFactory,
56
57
  kbd as kbdFactory,
57
58
  sheet as sheetFactory,
@@ -66,6 +67,7 @@ import {
66
67
  markdown as markdownFactory,
67
68
  html as htmlFactory,
68
69
  image as imageFactory,
70
+ iframe as iframeFactory,
69
71
  upload as uploadFactory,
70
72
  rating as ratingFactory,
71
73
  colorPicker as colorPickerFactory,
@@ -175,6 +177,7 @@ import {
175
177
  type ResizablePanelProps,
176
178
  type ResizableHandleProps,
177
179
  type ScrollAreaProps,
180
+ type ViewportEnterProps,
178
181
  type KeybindProps,
179
182
  type KbdProps,
180
183
  type BreadcrumbItem,
@@ -200,6 +203,8 @@ import {
200
203
  type MarkdownProps,
201
204
  type HtmlProps,
202
205
  type ImageProps,
206
+ type IframeProps,
207
+ type ViewportEnterProps,
203
208
  type UploadProps,
204
209
  type UploadVariant,
205
210
  type UploadedFile,
@@ -474,6 +479,8 @@ export type {
474
479
  MarkdownProps,
475
480
  HtmlProps,
476
481
  ImageProps,
482
+ IframeProps,
483
+ ViewportEnterProps,
477
484
  UploadProps,
478
485
  UploadVariant,
479
486
  UploadedFile,
@@ -774,6 +781,11 @@ export function image(src: string, props?: ImageProps): Element {
774
781
  return imageFactory(src, props);
775
782
  }
776
783
 
784
+ /** Iframe embed. Prefer `ui.iframe`. See {@link IframeProps}. */
785
+ export function iframe(src: string, props?: IframeProps): Element {
786
+ return iframeFactory(src, props);
787
+ }
788
+
777
789
  /** File upload control (`POST /upload`). Prefer `ui.upload`. See {@link UploadProps}. */
778
790
  export function upload(props?: UploadProps): Element {
779
791
  return uploadFactory(props);
@@ -1115,6 +1127,23 @@ export function scrollArea(a: any, b?: any): Element {
1115
1127
  return scrollAreaFactory(a, b);
1116
1128
  }
1117
1129
 
1130
+ /**
1131
+ * Observe when children enter the viewport (IntersectionObserver).
1132
+ * Prefer `ui.viewportEnter`. See {@link ViewportEnterProps}.
1133
+ *
1134
+ * @example
1135
+ * ```ts
1136
+ * ui.viewportEnter({ onEnter: () => void loadMore(), once: true }, () => {
1137
+ * ui.label('Lazy section');
1138
+ * });
1139
+ * ```
1140
+ */
1141
+ export function viewportEnter(fn: () => void, props?: ViewportEnterProps): Element;
1142
+ export function viewportEnter(props: ViewportEnterProps, fn: () => void): Element;
1143
+ export function viewportEnter(a: any, b?: any): Element {
1144
+ return viewportEnterFactory(a, b);
1145
+ }
1146
+
1118
1147
  /**
1119
1148
  * Headless keyboard chord listener. Prefer `ui.keybind`. See {@link KeybindProps}.
1120
1149
  *
@@ -1485,6 +1514,7 @@ export const ui = {
1485
1514
  markdown,
1486
1515
  html,
1487
1516
  image,
1517
+ iframe,
1488
1518
  upload,
1489
1519
  rating,
1490
1520
  colorPicker,
@@ -1533,6 +1563,7 @@ export const ui = {
1533
1563
  command,
1534
1564
  resizable,
1535
1565
  scrollArea,
1566
+ viewportEnter,
1536
1567
  keybind,
1537
1568
  kbd,
1538
1569
  breadcrumb,