@plasmicapp/query
Advanced tools
Comparing version 0.1.64 to 0.1.65
@@ -1,1 +0,2 @@ | ||
export { addLoadingStateListener, LoadingStateListener, PlasmicPrepassContext, PlasmicQueryDataProvider, SWRResponse, useMutablePlasmicQueryData, usePlasmicDataConfig, usePlasmicQueryData, wrapLoadingFetcher, } from './query-data'; | ||
export { useSWRConfig } from 'swr'; | ||
export { addLoadingStateListener, LoadingStateListener, PlasmicPrepassContext, PlasmicQueryDataProvider, SWRResponse, useMutablePlasmicQueryData, usePlasmicDataConfig, usePlasmicQueryData, wrapLoadingFetcher, isPlasmicPrepass, } from './query-data'; |
@@ -57,1 +57,2 @@ import React, { PropsWithChildren } from 'react'; | ||
export declare function wrapLoadingFetcher<T extends (...args: any[]) => Promise<any> | any>(fetcher: T): T; | ||
export declare function isPlasmicPrepass(): boolean; |
@@ -944,2 +944,6 @@ 'use client';'use strict'; | ||
} | ||
function isPlasmicPrepass() { | ||
var _React$__SECRET_INTER, _React$__SECRET_INTER2, _React$__SECRET_INTER3; | ||
return !!((_React$__SECRET_INTER = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) != null && (_React$__SECRET_INTER2 = _React$__SECRET_INTER.ReactCurrentDispatcher) != null && (_React$__SECRET_INTER3 = _React$__SECRET_INTER2.current) != null && _React$__SECRET_INTER3.isPlasmicPrepass); | ||
} | ||
@@ -957,5 +961,12 @@ if (typeof window !== 'undefined') { | ||
Object.defineProperty(exports, 'useSWRConfig', { | ||
enumerable: true, | ||
get: function () { | ||
return useSWR.useSWRConfig; | ||
} | ||
}); | ||
exports.PlasmicPrepassContext = PlasmicPrepassContext; | ||
exports.PlasmicQueryDataProvider = PlasmicQueryDataProvider; | ||
exports.addLoadingStateListener = addLoadingStateListener; | ||
exports.isPlasmicPrepass = isPlasmicPrepass; | ||
exports.useMutablePlasmicQueryData = useMutablePlasmicQueryData; | ||
@@ -962,0 +973,0 @@ exports.usePlasmicDataConfig = usePlasmicDataConfig; |
@@ -1,2 +0,2 @@ | ||
'use client';"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("react")),r=require("swr"),n=t(r);function o(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function u(t){o(a,n,i,u,c,"next",t)}function c(t){o(a,n,i,u,c,"throw",t)}u(void 0)}))}}function a(){return(a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function u(t,e){return t(e={exports:{}},e.exports),e.exports}var c=u((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function l(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var d=Object.getPrototypeOf,y=d&&d(d(O([])));y&&y!==e&&r.call(y,o)&&(v=y);var g=p.prototype=l.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return h.prototype=p,u(g,"constructor",p),u(p,"constructor",h),h.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),u(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=O,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),s=void 0,f=e.createContext(!1),l=0,h=[];function p(t){return i(c.mark((function e(){var r,n=arguments;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0===l&&h.forEach((function(t){return t(!0)})),l+=1,e.prev=2,!v(r=t.apply(void 0,n))){e.next=10;break}return e.next=7,r;case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=r;case 11:return e.abrupt("return",e.t0);case 12:return e.prev=12,0==(l-=1)&&h.forEach((function(t){return t(!1)})),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[2,,12,16]])})))}function v(t){return!!t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then}if("undefined"!=typeof window){var d=window,y=d.__SWRMutateAllKeys;d.__SWRMutateAllKeys=function(){!function(){if(s){var t=s.mutate;Array.from(s.cache.keys()).forEach((function(e){t(e)}))}}(),"function"==typeof y&&y()}}exports.PlasmicPrepassContext=function(t){var n=t.cache;return e.createElement(f.Provider,{value:!0},e.createElement(r.SWRConfig,{value:{provider:function(){return n},suspense:!0,fallback:{}}},t.children))},exports.PlasmicQueryDataProvider=function(t){var n=t.children,o=t.suspense,i=t.prefetchedCache;return e.useContext(f)?e.createElement(e.Fragment,null,n):e.createElement(r.SWRConfig,{value:{fallback:null!=i?i:{},suspense:o}},n)},exports.addLoadingStateListener=function(t,e){return h.push(t),null!=e&&e.immediate&&t(l>0),function(){h.splice(h.indexOf(t),1)}},exports.useMutablePlasmicQueryData=function(t,o,u){var l=e.useContext(f),h=a({},{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1},u);l&&(h.suspense=!0);var v=r.useSWRConfig();e.useEffect((function(){s=v}),[v]);var d=e.useState(!1),y=d[0],g=d[1],m=e.useCallback(i(c.mark((function t(){var e=arguments;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g(!0),t.prev=1,t.next=4,p(o).apply(void 0,e);case 4:return t.abrupt("return",t.sent);case 5:return t.prev=5,g(!1),t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])}))),[o]),w=n(t,m,h),x=w.isValidating,b=w.mutate,L=w.data,E=w.error;return e.useMemo((function(){return a({isValidating:x,mutate:b,isLoading:void 0===L&&void 0===E||y},void 0!==L?{data:L}:{},void 0!==E?{error:E}:{})}),[x,b,L,E,y])},exports.usePlasmicDataConfig=function(){return r.useSWRConfig()},exports.usePlasmicQueryData=function(t,o){var i={revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1};e.useContext(f)&&(i.suspense=!0);var a=r.useSWRConfig();e.useEffect((function(){s=a}),[a]);var u=e.useMemo((function(){return p(o)}),[o]),c=n(t,u,i);return void 0!==c.data?{data:c.data}:c.error?{error:c.error}:{isLoading:!0}},exports.wrapLoadingFetcher=p; | ||
'use client';"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("react")),r=require("swr"),n=t(r);function o(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function u(t){o(a,n,i,u,c,"next",t)}function c(t){o(a,n,i,u,c,"throw",t)}u(void 0)}))}}function a(){return(a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function u(t,e){return t(e={exports:{}},e.exports),e.exports}var c=u((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function l(){}function h(){}function p(){}var v={};u(v,o,(function(){return this}));var d=Object.getPrototypeOf,y=d&&d(d(_([])));y&&y!==e&&r.call(y,o)&&(v=y);var g=p.prototype=l.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function _(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=p,u(g,"constructor",p),u(p,"constructor",h),h.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),u(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),s=void 0,f=e.createContext(!1),l=0,h=[];function p(t){return i(c.mark((function e(){var r,n=arguments;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0===l&&h.forEach((function(t){return t(!0)})),l+=1,e.prev=2,!v(r=t.apply(void 0,n))){e.next=10;break}return e.next=7,r;case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=r;case 11:return e.abrupt("return",e.t0);case 12:return e.prev=12,0==(l-=1)&&h.forEach((function(t){return t(!1)})),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[2,,12,16]])})))}function v(t){return!!t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then}if("undefined"!=typeof window){var d=window,y=d.__SWRMutateAllKeys;d.__SWRMutateAllKeys=function(){!function(){if(s){var t=s.mutate;Array.from(s.cache.keys()).forEach((function(e){t(e)}))}}(),"function"==typeof y&&y()}}Object.defineProperty(exports,"useSWRConfig",{enumerable:!0,get:function(){return r.useSWRConfig}}),exports.PlasmicPrepassContext=function(t){var n=t.cache;return e.createElement(f.Provider,{value:!0},e.createElement(r.SWRConfig,{value:{provider:function(){return n},suspense:!0,fallback:{}}},t.children))},exports.PlasmicQueryDataProvider=function(t){var n=t.children,o=t.suspense,i=t.prefetchedCache;return e.useContext(f)?e.createElement(e.Fragment,null,n):e.createElement(r.SWRConfig,{value:{fallback:null!=i?i:{},suspense:o}},n)},exports.addLoadingStateListener=function(t,e){return h.push(t),null!=e&&e.immediate&&t(l>0),function(){h.splice(h.indexOf(t),1)}},exports.isPlasmicPrepass=function(){var t,r,n;return!(null==(t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)||null==(r=t.ReactCurrentDispatcher)||null==(n=r.current)||!n.isPlasmicPrepass)},exports.useMutablePlasmicQueryData=function(t,o,u){var l=e.useContext(f),h=a({},{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1},u);l&&(h.suspense=!0);var v=r.useSWRConfig();e.useEffect((function(){s=v}),[v]);var d=e.useState(!1),y=d[0],g=d[1],m=e.useCallback(i(c.mark((function t(){var e=arguments;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g(!0),t.prev=1,t.next=4,p(o).apply(void 0,e);case 4:return t.abrupt("return",t.sent);case 5:return t.prev=5,g(!1),t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])}))),[o]),w=n(t,m,h),x=w.isValidating,b=w.mutate,E=w.data,L=w.error;return e.useMemo((function(){return a({isValidating:x,mutate:b,isLoading:void 0===E&&void 0===L||y},void 0!==E?{data:E}:{},void 0!==L?{error:L}:{})}),[x,b,E,L,y])},exports.usePlasmicDataConfig=function(){return r.useSWRConfig()},exports.usePlasmicQueryData=function(t,o){var i={revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1};e.useContext(f)&&(i.suspense=!0);var a=r.useSWRConfig();e.useEffect((function(){s=a}),[a]);var u=e.useMemo((function(){return p(o)}),[o]),c=n(t,u,i);return void 0!==c.data?{data:c.data}:c.error?{error:c.error}:{isLoading:!0}},exports.wrapLoadingFetcher=p; | ||
//# sourceMappingURL=query.cjs.production.min.js.map |
'use client';import React from 'react'; | ||
import useSWR, { useSWRConfig, SWRConfig } from 'swr'; | ||
export { useSWRConfig } from 'swr'; | ||
@@ -937,2 +938,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
} | ||
function isPlasmicPrepass() { | ||
var _React$__SECRET_INTER, _React$__SECRET_INTER2, _React$__SECRET_INTER3; | ||
return !!((_React$__SECRET_INTER = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) != null && (_React$__SECRET_INTER2 = _React$__SECRET_INTER.ReactCurrentDispatcher) != null && (_React$__SECRET_INTER3 = _React$__SECRET_INTER2.current) != null && _React$__SECRET_INTER3.isPlasmicPrepass); | ||
} | ||
@@ -950,3 +955,3 @@ if (typeof window !== 'undefined') { | ||
export { PlasmicPrepassContext, PlasmicQueryDataProvider, addLoadingStateListener, useMutablePlasmicQueryData, usePlasmicDataConfig, usePlasmicQueryData, wrapLoadingFetcher }; | ||
export { PlasmicPrepassContext, PlasmicQueryDataProvider, addLoadingStateListener, isPlasmicPrepass, useMutablePlasmicQueryData, usePlasmicDataConfig, usePlasmicQueryData, wrapLoadingFetcher }; | ||
//# sourceMappingURL=query.esm.js.map |
{ | ||
"version": "0.1.64", | ||
"version": "0.1.65", | ||
"license": "MIT", | ||
@@ -63,3 +63,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "411497d52815f71297b6268e358218711ddbb967" | ||
"gitHead": "fa865641d9193b8b0b6cf7f073688d9801d2e59c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
249274
1976