foxact 0.2.50 → 0.2.51

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.
@@ -1 +1 @@
1
- "use strict";var e=require("../magic-portal/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react-dom"),require("../context-state/index.cjs"),require("react"),require("../noop/index.cjs"),exports.createMagicPortal=e.createMagicPortal;
1
+ "use strict";var e=require("../magic-portal/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react-dom"),require("../context-state/index.cjs"),require("react"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),exports.createMagicPortal=e.createMagicPortal;
@@ -1 +1 @@
1
- export{createMagicPortal}from"../magic-portal/index.mjs";import"react/jsx-runtime";import"client-only";import"react-dom";import"../context-state/index.mjs";import"react";import"../noop/index.mjs";
1
+ export{createMagicPortal}from"../magic-portal/index.mjs";import"react/jsx-runtime";import"client-only";import"react-dom";import"../context-state/index.mjs";import"react";import"../noop/index.mjs";import"../no-ssr/index.mjs";
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react-dom"),r=require("../context-state/index.cjs");require("react"),require("../noop/index.cjs"),exports.createMagicPortal=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[o,a,c]=r.createContextState(null);function i(t){let{as:r,...o}=t;const a=c();return e.jsx(r||"div",{...n?{"data-foxact-magic-portal-target":n}:{},ref:a,...o})}function u(e){let{children:r}=e;const n=a();return"undefined"!=typeof window&&n?t.createPortal(r,n):null}return"production"!==process.env.NODE_ENV&&(i.displayName=n+".PortalTarget"),"production"!==process.env.NODE_ENV&&(u.displayName=n+".PortalContent"),[function(t){let{children:r}=t;return e.jsx(o,{children:r})},i,u]};
1
+ "use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react-dom"),t=require("../context-state/index.cjs"),n=require("../no-ssr/index.cjs"),o=require("react");require("../noop/index.cjs"),exports.createMagicPortal=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[i,l,a]=t.createContextState(null);function s(r){let{as:t,ssrFallback:o=null,...i}=r;null!=o&&n.noSSR();const l=a();return e.jsx(t||"div",{...c?{"data-foxact-magic-portal-target":c}:{},ref:l,...i})}function u(r){const{ssrFallback:t=null}=r;return null!=t?e.jsx(o.Suspense,{fallback:t,children:e.jsx(s,{...r})}):e.jsx(s,{...r})}function d(e){let{children:t}=e;const n=l();return"undefined"!=typeof window&&n?r.createPortal(t,n):null}function p(r){let{children:t}=r;return e.jsx(i,{children:t})}return"production"!==process.env.NODE_ENV&&(u.displayName=c+".PortalTarget"),"production"!==process.env.NODE_ENV&&(d.displayName=c+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=c+".PortalProvider"),[p,u,d]};
@@ -1,5 +1,11 @@
1
1
  type MagicPortalTargetProps<T extends React.ElementType = 'div'> = Omit<React.ComponentPropsWithoutRef<T>, 'children' | 'ref'> & {
2
2
  as?: T | null;
3
+ /**
4
+ * MagicPortal do not support server-side rendering. By default, it will render nothing on the server.
5
+ *
6
+ * However, you can use `ssrFallback` to emit a fallback (e.g. skeleton) into server-rendered HTML.
7
+ */
8
+ ssrFallback?: React.ReactNode | null;
3
9
  };
4
10
  /** @see https://foxact.skk.moe/magic-portal */
5
11
  declare function createMagicPortal(name?: string): [
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as n}from"../context-state/index.mjs";import"react";import"../noop/index.mjs";function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[r,i,c]=n(null);function a(o){let{as:n,...r}=o;const i=c();return t(n||"div",{...e?{"data-foxact-magic-portal-target":e}:{},ref:i,...r})}function l(t){let{children:n}=t;const e=i();return"undefined"!=typeof window&&e?o(n,e):null}return"production"!==process.env.NODE_ENV&&(a.displayName=e+".PortalTarget"),"production"!==process.env.NODE_ENV&&(l.displayName=e+".PortalContent"),[function(o){let{children:n}=o;return t(r,{children:n})},a,l]}export{e as createMagicPortal};
1
+ import{jsx as t}from"react/jsx-runtime";import"client-only";import{createPortal as o}from"react-dom";import{createContextState as n}from"../context-state/index.mjs";import{noSSR as r}from"../no-ssr/index.mjs";import{Suspense as e}from"react";import"../noop/index.mjs";function i(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anoymous)";const[l,c,a]=n(null);function m(o){let{as:n,ssrFallback:e=null,...l}=o;null!=e&&r();const c=a();return t(n||"div",{...i?{"data-foxact-magic-portal-target":i}:{},ref:c,...l})}function u(o){const{ssrFallback:n=null}=o;return null!=n?t(e,{fallback:n,children:t(m,{...o})}):t(m,{...o})}function s(t){let{children:n}=t;const r=c();return"undefined"!=typeof window&&r?o(n,r):null}function p(o){let{children:n}=o;return t(l,{children:n})}return"production"!==process.env.NODE_ENV&&(u.displayName=i+".PortalTarget"),"production"!==process.env.NODE_ENV&&(s.displayName=i+".PortalContent"),"production"!==process.env.NODE_ENV&&(p.displayName=i+".PortalProvider"),[p,u,s]}export{i as createMagicPortal};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxact",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
5
5
  "homepage": "https://foxact.skk.moe",
6
6
  "repository": {
@@ -65,6 +65,15 @@
65
65
  "require": "./context-state/index.cjs",
66
66
  "default": "./context-state/index.cjs"
67
67
  },
68
+ "./create-context-state": {
69
+ "types": "./create-context-state/index.d.ts",
70
+ "import": {
71
+ "types": "./create-context-state/index.d.ts",
72
+ "default": "./create-context-state/index.mjs"
73
+ },
74
+ "require": "./create-context-state/index.cjs",
75
+ "default": "./create-context-state/index.cjs"
76
+ },
68
77
  "./create-fixed-array": {
69
78
  "types": "./create-fixed-array/index.d.ts",
70
79
  "import": {
@@ -92,15 +101,6 @@
92
101
  "require": "./create-magic-portal/index.cjs",
93
102
  "default": "./create-magic-portal/index.cjs"
94
103
  },
95
- "./create-context-state": {
96
- "types": "./create-context-state/index.d.ts",
97
- "import": {
98
- "types": "./create-context-state/index.d.ts",
99
- "default": "./create-context-state/index.mjs"
100
- },
101
- "require": "./create-context-state/index.cjs",
102
- "default": "./create-context-state/index.cjs"
103
- },
104
104
  "./create-session-storage-state": {
105
105
  "types": "./create-session-storage-state/index.d.ts",
106
106
  "import": {
@@ -119,6 +119,15 @@
119
119
  "require": "./create-storage-hook/index.cjs",
120
120
  "default": "./create-storage-hook/index.cjs"
121
121
  },
122
+ "./current-year": {
123
+ "types": "./current-year/index.d.ts",
124
+ "import": {
125
+ "types": "./current-year/index.d.ts",
126
+ "default": "./current-year/index.mjs"
127
+ },
128
+ "require": "./current-year/index.cjs",
129
+ "default": "./current-year/index.cjs"
130
+ },
122
131
  "./create-storage-state-factory": {
123
132
  "types": "./create-storage-state-factory/index.d.ts",
124
133
  "import": {
@@ -128,14 +137,14 @@
128
137
  "require": "./create-storage-state-factory/index.cjs",
129
138
  "default": "./create-storage-state-factory/index.cjs"
130
139
  },
131
- "./current-year": {
132
- "types": "./current-year/index.d.ts",
140
+ "./email-protection": {
141
+ "types": "./email-protection/index.d.ts",
133
142
  "import": {
134
- "types": "./current-year/index.d.ts",
135
- "default": "./current-year/index.mjs"
143
+ "types": "./email-protection/index.d.ts",
144
+ "default": "./email-protection/index.mjs"
136
145
  },
137
- "require": "./current-year/index.cjs",
138
- "default": "./current-year/index.cjs"
146
+ "require": "./email-protection/index.cjs",
147
+ "default": "./email-protection/index.cjs"
139
148
  },
140
149
  "./fetch-jsonp": {
141
150
  "types": "./fetch-jsonp/index.d.ts",
@@ -191,15 +200,6 @@
191
200
  "require": "./noop/index.cjs",
192
201
  "default": "./noop/index.cjs"
193
202
  },
194
- "./email-protection": {
195
- "types": "./email-protection/index.d.ts",
196
- "import": {
197
- "types": "./email-protection/index.d.ts",
198
- "default": "./email-protection/index.mjs"
199
- },
200
- "require": "./email-protection/index.cjs",
201
- "default": "./email-protection/index.cjs"
202
- },
203
203
  "./nullthrow": {
204
204
  "types": "./nullthrow/index.d.ts",
205
205
  "import": {
@@ -281,15 +281,6 @@
281
281
  "require": "./use-array/index.cjs",
282
282
  "default": "./use-array/index.cjs"
283
283
  },
284
- "./use-component-will-receive-update": {
285
- "types": "./use-component-will-receive-update/index.d.ts",
286
- "import": {
287
- "types": "./use-component-will-receive-update/index.d.ts",
288
- "default": "./use-component-will-receive-update/index.mjs"
289
- },
290
- "require": "./use-component-will-receive-update/index.cjs",
291
- "default": "./use-component-will-receive-update/index.cjs"
292
- },
293
284
  "./use-clipboard": {
294
285
  "types": "./use-clipboard/index.d.ts",
295
286
  "import": {
@@ -299,6 +290,15 @@
299
290
  "require": "./use-clipboard/index.cjs",
300
291
  "default": "./use-clipboard/index.cjs"
301
292
  },
293
+ "./use-component-will-receive-update": {
294
+ "types": "./use-component-will-receive-update/index.d.ts",
295
+ "import": {
296
+ "types": "./use-component-will-receive-update/index.d.ts",
297
+ "default": "./use-component-will-receive-update/index.mjs"
298
+ },
299
+ "require": "./use-component-will-receive-update/index.cjs",
300
+ "default": "./use-component-will-receive-update/index.cjs"
301
+ },
302
302
  "./use-composition-input": {
303
303
  "types": "./use-composition-input/index.d.ts",
304
304
  "import": {
@@ -380,15 +380,6 @@
380
380
  "require": "./use-isomorphic-layout-effect/index.cjs",
381
381
  "default": "./use-isomorphic-layout-effect/index.cjs"
382
382
  },
383
- "./use-map": {
384
- "types": "./use-map/index.d.ts",
385
- "import": {
386
- "types": "./use-map/index.d.ts",
387
- "default": "./use-map/index.mjs"
388
- },
389
- "require": "./use-map/index.cjs",
390
- "default": "./use-map/index.cjs"
391
- },
392
383
  "./use-local-storage": {
393
384
  "types": "./use-local-storage/index.d.ts",
394
385
  "import": {
@@ -398,6 +389,15 @@
398
389
  "require": "./use-local-storage/index.cjs",
399
390
  "default": "./use-local-storage/index.cjs"
400
391
  },
392
+ "./use-map": {
393
+ "types": "./use-map/index.d.ts",
394
+ "import": {
395
+ "types": "./use-map/index.d.ts",
396
+ "default": "./use-map/index.mjs"
397
+ },
398
+ "require": "./use-map/index.cjs",
399
+ "default": "./use-map/index.cjs"
400
+ },
401
401
  "./use-media-query": {
402
402
  "types": "./use-media-query/index.d.ts",
403
403
  "import": {
@@ -506,15 +506,6 @@
506
506
  "require": "./use-typescript-happy-callback/index.cjs",
507
507
  "default": "./use-typescript-happy-callback/index.cjs"
508
508
  },
509
- "./use-url-hash-state": {
510
- "types": "./use-url-hash-state/index.d.ts",
511
- "import": {
512
- "types": "./use-url-hash-state/index.d.ts",
513
- "default": "./use-url-hash-state/index.mjs"
514
- },
515
- "require": "./use-url-hash-state/index.cjs",
516
- "default": "./use-url-hash-state/index.cjs"
517
- },
518
509
  "./use-uncontrolled": {
519
510
  "types": "./use-uncontrolled/index.d.ts",
520
511
  "import": {
@@ -523,6 +514,15 @@
523
514
  },
524
515
  "require": "./use-uncontrolled/index.cjs",
525
516
  "default": "./use-uncontrolled/index.cjs"
517
+ },
518
+ "./use-url-hash-state": {
519
+ "types": "./use-url-hash-state/index.d.ts",
520
+ "import": {
521
+ "types": "./use-url-hash-state/index.d.ts",
522
+ "default": "./use-url-hash-state/index.mjs"
523
+ },
524
+ "require": "./use-url-hash-state/index.cjs",
525
+ "default": "./use-url-hash-state/index.cjs"
526
526
  }
527
527
  }
528
528
  }
package/sizes.json CHANGED
@@ -1 +1 @@
1
- {"total":{"raw":25234,"gzip":15377,"br":0},"exports":{"context-state":{"raw":402,"gzip":259,"br":221},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-local-storage-state":{"raw":402,"gzip":216,"br":189},"create-context-state":{"raw":145,"gzip":116,"br":96},"create-magic-portal":{"raw":196,"gzip":131,"br":104},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"current-year":{"raw":592,"gzip":400,"br":326},"create-session-storage-state":{"raw":406,"gzip":215,"br":188},"create-storage-hook":{"raw":2132,"gzip":903,"br":789},"create-storage-state-factory":{"raw":592,"gzip":338,"br":304},"is-safari":{"raw":248,"gzip":164,"br":117},"magic-portal":{"raw":768,"gzip":431,"br":364},"noop":{"raw":33,"gzip":53,"br":37},"no-ssr":{"raw":474,"gzip":316,"br":260},"email-protection":{"raw":426,"gzip":321,"br":272},"fetch-jsonp":{"raw":899,"gzip":547,"br":430},"open-new-tab":{"raw":344,"gzip":260,"br":190},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"types":{"raw":0,"gzip":20,"br":1},"nullthrow":{"raw":187,"gzip":163,"br":121},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"use-array":{"raw":322,"gzip":236,"br":202},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-clipboard":{"raw":1177,"gzip":650,"br":552},"invariant":{"raw":178,"gzip":156,"br":118},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-fast-click":{"raw":553,"gzip":364,"br":297},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":112},"use-is-online":{"raw":356,"gzip":212,"br":158},"rem":{"raw":823,"gzip":395,"br":350},"use-map":{"raw":339,"gzip":243,"br":208},"use-local-storage":{"raw":384,"gzip":215,"br":201},"use-next-pathname":{"raw":314,"gzip":235,"br":203},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-next-link":{"raw":1656,"gzip":880,"br":743},"use-react-router-enable-concurrent-navigation":{"raw":966,"gzip":470,"br":397},"use-react-router-is-match":{"raw":594,"gzip":395,"br":337},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-set":{"raw":340,"gzip":238,"br":203},"use-session-storage":{"raw":390,"gzip":210,"br":201},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":249},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-url-hash-state":{"raw":1133,"gzip":641,"br":554},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-media-query":{"raw":725,"gzip":406,"br":332}}}
1
+ {"total":{"raw":25541,"gzip":15476,"br":0},"exports":{"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-context-state":{"raw":145,"gzip":116,"br":96},"context-state":{"raw":402,"gzip":259,"br":221},"create-magic-portal":{"raw":224,"gzip":136,"br":112},"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-session-storage-state":{"raw":406,"gzip":215,"br":188},"create-local-storage-state":{"raw":402,"gzip":216,"br":189},"create-storage-state-factory":{"raw":592,"gzip":338,"br":304},"email-protection":{"raw":426,"gzip":321,"br":272},"current-year":{"raw":592,"gzip":400,"br":326},"invariant":{"raw":178,"gzip":156,"br":118},"fetch-jsonp":{"raw":899,"gzip":547,"br":430},"create-storage-hook":{"raw":2132,"gzip":903,"br":789},"is-safari":{"raw":248,"gzip":164,"br":117},"noop":{"raw":33,"gzip":53,"br":37},"no-ssr":{"raw":474,"gzip":316,"br":260},"nullthrow":{"raw":187,"gzip":163,"br":121},"magic-portal":{"raw":1047,"gzip":525,"br":451},"types":{"raw":0,"gzip":20,"br":1},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"rem":{"raw":823,"gzip":395,"br":350},"request-idle-callback":{"raw":410,"gzip":229,"br":175},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"open-new-tab":{"raw":344,"gzip":260,"br":190},"use":{"raw":298,"gzip":197,"br":160},"use-array":{"raw":322,"gzip":236,"br":202},"use-clipboard":{"raw":1177,"gzip":650,"br":552},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-debounced-value":{"raw":524,"gzip":342,"br":286},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-isomorphic-layout-effect":{"raw":178,"gzip":142,"br":112},"use-intersection":{"raw":1230,"gzip":649,"br":597},"use-is-online":{"raw":356,"gzip":212,"br":158},"use-fast-click":{"raw":553,"gzip":364,"br":297},"use-local-storage":{"raw":384,"gzip":215,"br":201},"use-map":{"raw":339,"gzip":243,"br":208},"use-next-pathname":{"raw":314,"gzip":235,"br":203},"use-page-visibility":{"raw":290,"gzip":206,"br":154},"use-media-query":{"raw":725,"gzip":406,"br":332},"use-next-link":{"raw":1656,"gzip":880,"br":743},"use-retimer":{"raw":199,"gzip":166,"br":127},"use-react-router-is-match":{"raw":594,"gzip":395,"br":337},"use-set":{"raw":340,"gzip":238,"br":203},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":459,"gzip":325,"br":249},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-session-storage":{"raw":390,"gzip":210,"br":201},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-react-router-enable-concurrent-navigation":{"raw":966,"gzip":470,"br":397},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-url-hash-state":{"raw":1133,"gzip":641,"br":554}}}