react-ink-scripter 0.0.24 → 0.0.25

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/dist/cjs/index.js CHANGED
@@ -4,7 +4,7 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
4
  var react = require('react');
5
5
  var reactDom = require('react-dom');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var clsx = require('clsx');
7
+ var _typeof = require('@babel/runtime/helpers/typeof');
8
8
  var _extends = require('@babel/runtime/helpers/extends');
9
9
 
10
10
  var IFrame = react.forwardRef(function (props, ref) {
@@ -24,7 +24,7 @@ var IFrame = react.forwardRef(function (props, ref) {
24
24
  var attachBody = iframeRef === null || iframeRef === void 0 ? void 0 : (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : (_iframeRef$current$co = _iframeRef$current.contentWindow) === null || _iframeRef$current$co === void 0 ? void 0 : (_iframeRef$current$co2 = _iframeRef$current$co.document) === null || _iframeRef$current$co2 === void 0 ? void 0 : _iframeRef$current$co2.body;
25
25
  var attachHead = iframeRef === null || iframeRef === void 0 ? void 0 : (_iframeRef$current2 = iframeRef.current) === null || _iframeRef$current2 === void 0 ? void 0 : (_iframeRef$current2$c = _iframeRef$current2.contentWindow) === null || _iframeRef$current2$c === void 0 ? void 0 : (_iframeRef$current2$c2 = _iframeRef$current2$c.document) === null || _iframeRef$current2$c2 === void 0 ? void 0 : _iframeRef$current2$c2.head;
26
26
  react.useImperativeHandle(ref, function () {
27
- return iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current;
27
+ return (iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current) || undefined;
28
28
  }, []);
29
29
  return jsxRuntime.jsxs("iframe", {
30
30
  ref: iframeRef,
@@ -37,6 +37,18 @@ var IFrame = react.forwardRef(function (props, ref) {
37
37
  });
38
38
  });
39
39
 
40
+ function r(e) {
41
+ var t,
42
+ f,
43
+ n = "";
44
+ if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == _typeof(e)) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);else for (t in e) e[t] && (n && (n += " "), n += t);
45
+ return n;
46
+ }
47
+ function clsx() {
48
+ for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
49
+ return n;
50
+ }
51
+
40
52
  var PrinterFrame = react.forwardRef(function (props, ref) {
41
53
  var _iframeRef$current2, _iframeRef$current2$c, _iframeRef$current2$c2, _iframeRef$current3, _iframeRef$current3$c, _iframeRef$current3$c2, _iframeRef$current4, _iframeRef$current4$c, _iframeRef$current4$c2;
42
54
  var styleCss = props.styleCss,
@@ -1,4 +1,4 @@
1
- import type { ReactNode, ForwardRefExoticComponent, RefAttributes } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  export interface IFrameProps {
3
3
  className?: string;
4
4
  styleCss?: string;
@@ -6,4 +6,4 @@ export interface IFrameProps {
6
6
  width?: string | number;
7
7
  height?: string | number;
8
8
  }
9
- export declare const IFrame: ForwardRefExoticComponent<IFrameProps & RefAttributes<any>>;
9
+ export declare const IFrame: import("react").ForwardRefExoticComponent<IFrameProps & import("react").RefAttributes<HTMLIFrameElement | undefined>>;
package/dist/esm/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, useRef, useMemo, useImperativeHandle, useState, useCallback, useLayoutEffect } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import clsx from 'clsx';
5
4
 
6
5
  const IFrame = forwardRef((props, ref) => {
7
6
  const { styleCss, className, children, width, height } = props;
@@ -12,11 +11,13 @@ const IFrame = forwardRef((props, ref) => {
12
11
  const attachBody = iframeRef?.current?.contentWindow?.document?.body;
13
12
  const attachHead = iframeRef?.current?.contentWindow?.document?.head;
14
13
  useImperativeHandle(ref, () => {
15
- return iframeRef?.current;
14
+ return iframeRef?.current || undefined;
16
15
  }, []);
17
16
  return (jsxs("iframe", { ref: iframeRef, className: className, width: frameWidth, height: frameHeight, children: [attachBody && createPortal(children, attachBody), attachHead && createPortal(jsx("style", { children: styleCss }), attachHead)] }));
18
17
  });
19
18
 
19
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
20
+
20
21
  const PrinterFrame = forwardRef((props, ref) => {
21
22
  const { styleCss, open, className, children, actionRef, src, containerId, width, height, } = props;
22
23
  const iframeRef = useRef(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-ink-scripter",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "a react component for generate page to print",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,16 +23,13 @@
23
23
  },
24
24
  "homepage": "https://github.com/lawrsp/react-ink-scripter#readme",
25
25
  "scripts": {
26
- "dev": "start-storybook -p 6016",
26
+ "dev": "storybook dev -p 6016",
27
27
  "prepack": "json -f package.json -I -e \"delete this.devDependencies;delete this.scripts;\"",
28
28
  "build": "rimraf dist && rollup -c && yarn copy-styles",
29
29
  "copy-styles": "node ./copy-styles.mjs",
30
30
  "preview": "vite preview",
31
- "storybook": "start-storybook -p 6006",
32
- "build-storybook": "build-storybook"
33
- },
34
- "dependencies": {
35
- "clsx": "^1.2.1"
31
+ "storybook": "storybook dev -p 6006",
32
+ "build-storybook": "storybook build"
36
33
  },
37
34
  "devDependencies": {
38
35
  "@babel/core": "^7.21.0",
@@ -47,32 +44,30 @@
47
44
  "@rollup/plugin-node-resolve": "^15.0.1",
48
45
  "@rollup/plugin-strip": "^3.0.2",
49
46
  "@rollup/plugin-typescript": "^11.0.0",
50
- "@storybook/addon-actions": "^6.5.16",
51
- "@storybook/addon-essentials": "^6.5.16",
52
- "@storybook/addon-interactions": "^6.5.16",
53
- "@storybook/addon-links": "^6.5.16",
54
- "@storybook/builder-vite": "^0.4.2",
55
- "@storybook/react": "^6.5.16",
56
- "@storybook/testing-library": "^0.0.13",
57
- "@types/react": "^18.0.27",
58
- "@types/react-dom": "^18.0.10",
59
- "@vitejs/plugin-react": "^3.1.0",
47
+ "@storybook/addon-docs": "^10.1.2",
48
+ "@storybook/react-vite": "^10.1.2",
49
+ "@types/react": "^19.2.7",
50
+ "@types/react-dom": "^19.2.3",
51
+ "@vitejs/plugin-react": "^5.1.1",
60
52
  "babel-loader": "^8.3.0",
53
+ "clsx": "^1.2.1",
61
54
  "json": "^11.0.0",
62
- "react": "^18.2.0",
63
- "react-dom": "^18.2.0",
55
+ "react": "^19.2.0",
56
+ "react-dom": "^19.2.0",
64
57
  "rimraf": "^4.1.3",
65
58
  "rollup": "^3.18.0",
66
59
  "rollup-plugin-sizes": "^1.0.5",
60
+ "storybook": "^10.1.2",
67
61
  "tslib": "^2.8.1",
68
62
  "typescript": "^4.9.3",
69
- "vite": "^4.1.0"
63
+ "vite": "^7.2.4"
70
64
  },
71
65
  "peerDependencies": {
72
- "@types/react": "^17.0.0 || ^18.0.0",
73
- "@types/react-dom": "^17.0.0 || ^18.0.0",
74
- "react": "^17.0.0 || ^18.0.0",
75
- "react-dom": "^17.0.0 || ^18.0.0"
66
+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
67
+ "@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
68
+ "clsx": "^1.2.0 || ^2.1.0",
69
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
70
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
76
71
  },
77
72
  "peerDependenciesMeta": {
78
73
  "@types/react": {