@stacksjs/components 0.2.467 → 0.2.468

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.
@@ -0,0 +1,22 @@
1
+ // src/utils/overlays.ts
2
+ function stack() {
3
+ return globalThis.stx?.overlays;
4
+ }
5
+ function openOverlay(id, options) {
6
+ stack()?.open(id, options);
7
+ }
8
+ function closeOverlay(id) {
9
+ stack()?.close(id);
10
+ }
11
+ function isTopOverlay(id) {
12
+ return stack()?.isTop(id) ?? false;
13
+ }
14
+ function openOverlays() {
15
+ return stack()?.list() ?? [];
16
+ }
17
+ export {
18
+ closeOverlay,
19
+ isTopOverlay,
20
+ openOverlay,
21
+ openOverlays
22
+ };
@@ -17,7 +17,7 @@ export declare function openOverlays(): string[];
17
17
  * library's dialogs instead of competing with them (stacksjs/stx#2057).
18
18
  *
19
19
  * ```ts
20
- * import { closeOverlay, openOverlay } from '@stacksjs/components'
20
+ * import { closeOverlay, openOverlay } from '@stacksjs/components/overlays'
21
21
  *
22
22
  * effect(() => {
23
23
  * if (panelOpen()) openOverlay('workout-panel', { panel: '#wp-panel', onEscape: close })
@@ -28,6 +28,10 @@ export declare function openOverlays(): string[];
28
28
  *
29
29
  * Every call is a no-op where there is no runtime (server rendering, tests
30
30
  * without a DOM), so shared code can call them unguarded.
31
+ *
32
+ * Import them from `@stacksjs/components/overlays` in a `<script client>`. The
33
+ * package root re-exports them too, but the root also reaches the syntax
34
+ * highlighter, which needs Node's streams and cannot be bundled for a browser.
31
35
  */
32
36
  export declare interface OverlayOptions {
33
37
  panel: Element | string | null | (() => Element | null)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.467",
4
+ "version": "0.2.468",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -45,6 +45,11 @@
45
45
  "types": "./dist/ui/chat/controller.d.ts",
46
46
  "bun": "./dist/chat/controller.js",
47
47
  "import": "./dist/chat/controller.js"
48
+ },
49
+ "./overlays": {
50
+ "types": "./dist/utils/overlays.d.ts",
51
+ "bun": "./dist/overlays/overlays.js",
52
+ "import": "./dist/overlays/overlays.js"
48
53
  }
49
54
  },
50
55
  "module": "./dist/index.js",
@@ -69,8 +74,8 @@
69
74
  "dependencies": {
70
75
  "@iconify-json/f7": "^1.2.2",
71
76
  "@stacksjs/ts-css": "^0.3.2",
72
- "@stacksjs/stx": "0.2.467",
73
- "bun-plugin-stx": "0.2.467",
77
+ "@stacksjs/stx": "0.2.468",
78
+ "bun-plugin-stx": "0.2.468",
74
79
  "ts-syntax-highlighter": "^0.2.17"
75
80
  },
76
81
  "devDependencies": {
@@ -9,7 +9,7 @@
9
9
  * library's dialogs instead of competing with them (stacksjs/stx#2057).
10
10
  *
11
11
  * ```ts
12
- * import { closeOverlay, openOverlay } from '@stacksjs/components'
12
+ * import { closeOverlay, openOverlay } from '@stacksjs/components/overlays'
13
13
  *
14
14
  * effect(() => {
15
15
  * if (panelOpen()) openOverlay('workout-panel', { panel: '#wp-panel', onEscape: close })
@@ -20,6 +20,10 @@
20
20
  *
21
21
  * Every call is a no-op where there is no runtime (server rendering, tests
22
22
  * without a DOM), so shared code can call them unguarded.
23
+ *
24
+ * Import them from `@stacksjs/components/overlays` in a `<script client>`. The
25
+ * package root re-exports them too, but the root also reaches the syntax
26
+ * highlighter, which needs Node's streams and cannot be bundled for a browser.
23
27
  */
24
28
 
25
29
  export interface OverlayOptions {