@jielga/react-popup-window 0.1.0 → 0.2.0
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 -21
- package/README.md +371 -249
- package/dist/copyStyles.d.ts +11 -0
- package/dist/copyStyles.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +145 -72
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +26 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/usePopupWindow.d.ts.map +1 -1
- package/dist/whenStylesheetsLoad.d.ts +13 -0
- package/dist/whenStylesheetsLoad.d.ts.map +1 -0
- package/package.json +101 -100
- package/skills/getting-started/SKILL.md +229 -211
- package/skills/popup-content/SKILL.md +428 -227
package/dist/types.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export interface UsePopupWindowOptions {
|
|
|
18
18
|
* window. Defaults to `_blank` (a fresh window every time).
|
|
19
19
|
*/
|
|
20
20
|
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* URL the popup loads instead of `about:blank`: an empty page served on the
|
|
23
|
+
* same origin, such as `/popup.html`. The popup's address bar shows that
|
|
24
|
+
* URL. `isOpen` turns `true` at once; `Popup` renders once the page has
|
|
25
|
+
* loaded. If the page redirects to another origin, the popup closes and is
|
|
26
|
+
* reported through `onBlocked`. Defaults to `about:blank`.
|
|
27
|
+
*/
|
|
28
|
+
url?: string;
|
|
21
29
|
/** Extra `window.open` features. Defaults to `{ popup: true, width: 640, height: 480 }` merged with what you pass. */
|
|
22
30
|
features?: PopupWindowFeatures;
|
|
23
31
|
/**
|
|
@@ -28,14 +36,25 @@ export interface UsePopupWindowOptions {
|
|
|
28
36
|
/**
|
|
29
37
|
* Copy the opener document's stylesheets into the popup and keep them in
|
|
30
38
|
* sync (new/changed `<style>`/`<link>` tags, `class`/`style` attributes on
|
|
31
|
-
* `<html>`/`<body>`, adopted stylesheets).
|
|
39
|
+
* `<html>`/`<body>`, adopted stylesheets). `Popup` renders once the copied
|
|
40
|
+
* `<link>` stylesheets have loaded, or after 3 seconds, so the first frame
|
|
41
|
+
* shown is styled. Defaults to `true`.
|
|
32
42
|
*/
|
|
33
43
|
copyStyles?: boolean;
|
|
34
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Called when `Popup` starts rendering into the popup: once the window has
|
|
46
|
+
* opened, the `url` page has loaded, and copied `<link>` stylesheets have
|
|
47
|
+
* loaded.
|
|
48
|
+
*/
|
|
35
49
|
onOpen?: (popupWindow: Window) => void;
|
|
36
50
|
/** Called when the popup closes — via `close()`, the user, or the opener unloading. */
|
|
37
51
|
onClose?: () => void;
|
|
38
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Called when the popup cannot be used: `window.open` returned `null`
|
|
54
|
+
* (blocked by the browser), or the popup's document is not scriptable
|
|
55
|
+
* because a sandboxed embedder gave it an opaque origin or `url` led to
|
|
56
|
+
* another origin.
|
|
57
|
+
*/
|
|
39
58
|
onBlocked?: () => void;
|
|
40
59
|
}
|
|
41
60
|
export interface PopupProps {
|
|
@@ -56,7 +75,10 @@ export interface PopupWindowApi {
|
|
|
56
75
|
focus: () => void;
|
|
57
76
|
/** Whether the popup window is currently open. */
|
|
58
77
|
isOpen: boolean;
|
|
59
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Whether the last `open()` attempt was blocked — by the browser, or by a
|
|
80
|
+
* sandboxed embedder whose popups are not scriptable.
|
|
81
|
+
*/
|
|
60
82
|
isBlocked: boolean;
|
|
61
83
|
/**
|
|
62
84
|
* The popup `Window` while open, otherwise `null`. Escape hatch for
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE1C;;;GAGG;AACH,MAAM,WAAW,mB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IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACzB,kDAAkD;IAClD,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,qCAAqC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yDAAyD;IACzD,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B;;;OAGG;IACH,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,CAAA;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopupWindow.d.ts","sourceRoot":"","sources":["../src/usePopupWindow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,cAAc,EAEd,qBAAqB,EACtB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"usePopupWindow.d.ts","sourceRoot":"","sources":["../src/usePopupWindow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,cAAc,EAEd,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAgFhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CA+KlF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls `callback` once every stylesheet in `links` that applies has loaded
|
|
3
|
+
* or failed, or after `timeoutMs`, whichever comes first.
|
|
4
|
+
*
|
|
5
|
+
* When none of them is still loading, `callback` runs synchronously, before
|
|
6
|
+
* this function returns. Links that do not apply are not waited for: an
|
|
7
|
+
* alternate stylesheet, or a `media` query that does not match, such as
|
|
8
|
+
* `print`. Browsers fetch those at the lowest priority.
|
|
9
|
+
*
|
|
10
|
+
* Returns a function that stops waiting without calling `callback`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function whenStylesheetsLoad(links: readonly HTMLLinkElement[], timeoutMs: number, callback: () => void): () => void;
|
|
13
|
+
//# sourceMappingURL=whenStylesheetsLoad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whenStylesheetsLoad.d.ts","sourceRoot":"","sources":["../src/whenStylesheetsLoad.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,eAAe,EAAE,EACjC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,IAAI,GACnB,MAAM,IAAI,CA+BZ"}
|
package/package.json
CHANGED
|
@@ -1,100 +1,101 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jielga/react-popup-window",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "React hook to open part of your UI in a separate browser popup window — live portal rendering, style syncing and cross-window messaging.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "jielga",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://jielga.github.io/react-popup-window/",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"react",
|
|
18
|
-
"hook",
|
|
19
|
-
"popup",
|
|
20
|
-
"window",
|
|
21
|
-
"portal",
|
|
22
|
-
"window.open",
|
|
23
|
-
"multi-window",
|
|
24
|
-
"detached",
|
|
25
|
-
"panel",
|
|
26
|
-
"tanstack-intent"
|
|
27
|
-
],
|
|
28
|
-
"sideEffects": false,
|
|
29
|
-
"files": [
|
|
30
|
-
"dist",
|
|
31
|
-
"skills",
|
|
32
|
-
"!skills/_artifacts"
|
|
33
|
-
],
|
|
34
|
-
"intent": {
|
|
35
|
-
"docs": "README.md",
|
|
36
|
-
"repo": "Jielga/react-popup-window"
|
|
37
|
-
},
|
|
38
|
-
"main": "./dist/index.cjs",
|
|
39
|
-
"module": "./dist/index.js",
|
|
40
|
-
"types": "./dist/index.d.ts",
|
|
41
|
-
"exports": {
|
|
42
|
-
".": {
|
|
43
|
-
"types": "./dist/index.d.ts",
|
|
44
|
-
"import": "./dist/index.js",
|
|
45
|
-
"require": "./dist/index.cjs"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"scripts": {
|
|
49
|
-
"dev": "vite --config docs/vite.config.ts",
|
|
50
|
-
"build": "vite build && tsc -p tsconfig.build.json",
|
|
51
|
-
"docs:build": "vite build --config docs/vite.config.ts",
|
|
52
|
-
"docs:preview": "vite preview --config docs/vite.config.ts",
|
|
53
|
-
"test": "vitest run",
|
|
54
|
-
"test:watch": "vitest",
|
|
55
|
-
"e2e": "playwright test",
|
|
56
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
57
|
-
"skills:validate": "intent validate",
|
|
58
|
-
"changeset": "changeset",
|
|
59
|
-
"version-packages": "changeset version && node scripts/sync-skill-version.mjs",
|
|
60
|
-
"release": "changeset publish",
|
|
61
|
-
"prepublishOnly": "npm run build"
|
|
62
|
-
},
|
|
63
|
-
"peerDependencies": {
|
|
64
|
-
"react": ">=19.2.0",
|
|
65
|
-
"react-dom": ">=19.2.0"
|
|
66
|
-
},
|
|
67
|
-
"publishConfig": {
|
|
68
|
-
"access": "public",
|
|
69
|
-
"provenance": true
|
|
70
|
-
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"@changesets/changelog-github": "^1.0.0",
|
|
73
|
-
"@changesets/cli": "^3.0.1",
|
|
74
|
-
"@jielga/tmdatagrid": "^0.
|
|
75
|
-
"@mantine/core": "^9.5.1",
|
|
76
|
-
"@mantine/hooks": "^9.5.1",
|
|
77
|
-
"@playwright/test": "^1.62.1",
|
|
78
|
-
"@tabler/icons-react": "^3.46.0",
|
|
79
|
-
"@tanstack/intent": "^0.3.6",
|
|
80
|
-
"@tanstack/react-
|
|
81
|
-
"@tanstack/react-
|
|
82
|
-
"@tanstack/react-
|
|
83
|
-
"@tanstack/react-
|
|
84
|
-
"@tanstack/
|
|
85
|
-
"@tanstack/
|
|
86
|
-
"@
|
|
87
|
-
"@testing-library/
|
|
88
|
-
"@
|
|
89
|
-
"@types/
|
|
90
|
-
"@types/react
|
|
91
|
-
"@
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"react
|
|
95
|
-
"react-
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@jielga/react-popup-window",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "React hook to open part of your UI in a separate browser popup window — live portal rendering, style syncing and cross-window messaging.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "jielga",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Jielga/react-popup-window.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://jielga.github.io/react-popup-window/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Jielga/react-popup-window/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"react",
|
|
18
|
+
"hook",
|
|
19
|
+
"popup",
|
|
20
|
+
"window",
|
|
21
|
+
"portal",
|
|
22
|
+
"window.open",
|
|
23
|
+
"multi-window",
|
|
24
|
+
"detached",
|
|
25
|
+
"panel",
|
|
26
|
+
"tanstack-intent"
|
|
27
|
+
],
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"skills",
|
|
32
|
+
"!skills/_artifacts"
|
|
33
|
+
],
|
|
34
|
+
"intent": {
|
|
35
|
+
"docs": "README.md",
|
|
36
|
+
"repo": "Jielga/react-popup-window"
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.cjs",
|
|
39
|
+
"module": "./dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"import": "./dist/index.js",
|
|
45
|
+
"require": "./dist/index.cjs"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "vite --config docs/vite.config.ts",
|
|
50
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
51
|
+
"docs:build": "vite build --config docs/vite.config.ts",
|
|
52
|
+
"docs:preview": "vite preview --config docs/vite.config.ts",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:watch": "vitest",
|
|
55
|
+
"e2e": "playwright test",
|
|
56
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
57
|
+
"skills:validate": "node node_modules/@tanstack/intent/dist/cli.mjs validate",
|
|
58
|
+
"changeset": "changeset",
|
|
59
|
+
"version-packages": "changeset version && npm install --package-lock-only --no-audit --no-fund && node scripts/sync-skill-version.mjs",
|
|
60
|
+
"release": "changeset publish",
|
|
61
|
+
"prepublishOnly": "npm run build"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": ">=19.2.0",
|
|
65
|
+
"react-dom": ">=19.2.0"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public",
|
|
69
|
+
"provenance": true
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@changesets/changelog-github": "^1.0.0",
|
|
73
|
+
"@changesets/cli": "^3.0.1",
|
|
74
|
+
"@jielga/tmdatagrid": "^2.0.0-beta.15",
|
|
75
|
+
"@mantine/core": "^9.5.1",
|
|
76
|
+
"@mantine/hooks": "^9.5.1",
|
|
77
|
+
"@playwright/test": "^1.62.1",
|
|
78
|
+
"@tabler/icons-react": "^3.46.0",
|
|
79
|
+
"@tanstack/intent": "^0.3.6",
|
|
80
|
+
"@tanstack/react-form": "^1.33.5",
|
|
81
|
+
"@tanstack/react-query": "^5.101.4",
|
|
82
|
+
"@tanstack/react-store": "^0.11.1",
|
|
83
|
+
"@tanstack/react-table": "^9.2.4",
|
|
84
|
+
"@tanstack/react-virtual": "^3.14.9",
|
|
85
|
+
"@tanstack/store": "^0.11.1",
|
|
86
|
+
"@tanstack/table-core": "^9.2.4",
|
|
87
|
+
"@testing-library/dom": "^10.4.1",
|
|
88
|
+
"@testing-library/react": "^16.3.2",
|
|
89
|
+
"@types/node": "^26.1.2",
|
|
90
|
+
"@types/react": "^19.2.18",
|
|
91
|
+
"@types/react-dom": "^19.2.4",
|
|
92
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
93
|
+
"jsdom": "^30.0.1",
|
|
94
|
+
"react": "^19.2.8",
|
|
95
|
+
"react-dom": "^19.2.8",
|
|
96
|
+
"react-resizable-panels": "^4.12.2",
|
|
97
|
+
"typescript": "^7.0.2",
|
|
98
|
+
"vite": "^8.2.1",
|
|
99
|
+
"vitest": "^4.1.10"
|
|
100
|
+
}
|
|
101
|
+
}
|