jsxc-react-hook 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -1
- package/dist/App.d.ts +3 -0
- package/dist/Jsxc.d.ts +16 -0
- package/dist/Sel.d.ts +1 -0
- package/dist/demo.png +0 -0
- package/dist/jsxc-react-hook.js +695 -0
- package/dist/jsxc-react-hook.umd.cjs +30 -0
- package/dist/jsxc.bundle.js +2 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +10 -0
- package/dist/vite.svg +1 -0
- package/package.json +1 -1
- package/public/jsxc.bundle.js +1 -1
- package/src/Jsxc.tsx +19 -10
- package/src/Sel.tsx +7 -7
- package/src/lib/styles/jsxc.bundle.css +3 -3
@@ -0,0 +1,30 @@
|
|
1
|
+
(function(w,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],C):(w=typeof globalThis<"u"?globalThis:w||self,C(w["jsxc-react-hook"]={},w.React))})(this,function(w,C){"use strict";var X={exports:{}},Y={};/**
|
2
|
+
* @license React
|
3
|
+
* react-jsx-runtime.production.min.js
|
4
|
+
*
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/var ie;function Ae(){if(ie)return Y;ie=1;var j=C,x=Symbol.for("react.element"),k=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,A=j.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,D={key:!0,ref:!0,__self:!0,__source:!0};function O(E,f,R){var d,y={},_=null,T=null;R!==void 0&&(_=""+R),f.key!==void 0&&(_=""+f.key),f.ref!==void 0&&(T=f.ref);for(d in f)b.call(f,d)&&!D.hasOwnProperty(d)&&(y[d]=f[d]);if(E&&E.defaultProps)for(d in f=E.defaultProps,f)y[d]===void 0&&(y[d]=f[d]);return{$$typeof:x,type:E,key:_,ref:T,props:y,_owner:A.current}}return Y.Fragment=k,Y.jsx=O,Y.jsxs=O,Y}var L={};/**
|
10
|
+
* @license React
|
11
|
+
* react-jsx-runtime.development.js
|
12
|
+
*
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
14
|
+
*
|
15
|
+
* This source code is licensed under the MIT license found in the
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
17
|
+
*/var se;function De(){return se||(se=1,process.env.NODE_ENV!=="production"&&function(){var j=C,x=Symbol.for("react.element"),k=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),E=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),B=Symbol.iterator,$="@@iterator";function F(e){if(e===null||typeof e!="object")return null;var r=B&&e[B]||e[$];return typeof r=="function"?r:null}var g=j.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];We("error",e,t)}}function We(e,r,t){{var n=g.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Ye=!1,Le=!1,$e=!1,Me=!1,Ue=!1,ue;ue=Symbol.for("react.module.reference");function Ve(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===D||Ue||e===A||e===R||e===d||Me||e===T||Ye||Le||$e||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===y||e.$$typeof===O||e.$$typeof===E||e.$$typeof===f||e.$$typeof===ue||e.getModuleId!==void 0))}function Ne(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ce(e){return e.displayName||"Context"}function m(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case k:return"Portal";case D:return"Profiler";case A:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var r=e;return ce(r)+".Consumer";case O:var t=e;return ce(t._context)+".Provider";case f:return Ne(e,e.render,"ForwardRef");case y:var n=e.displayName||null;return n!==null?n:m(e.type)||"Memo";case _:{var i=e,s=i._payload,o=i._init;try{return m(o(s))}catch{return null}}}return null}var S=Object.assign,M=0,le,fe,de,ve,pe,ge,he;function ye(){}ye.__reactDisabledLog=!0;function Je(){{if(M===0){le=console.log,fe=console.info,de=console.warn,ve=console.error,pe=console.group,ge=console.groupCollapsed,he=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ye,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function Be(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:le}),info:S({},e,{value:fe}),warn:S({},e,{value:de}),error:S({},e,{value:ve}),group:S({},e,{value:pe}),groupCollapsed:S({},e,{value:ge}),groupEnd:S({},e,{value:he})})}M<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=g.ReactCurrentDispatcher,Z;function q(e,r,t){{if(Z===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Z=n&&n[1]||""}return`
|
18
|
+
`+Z+e}}var Q=!1,K;{var qe=typeof WeakMap=="function"?WeakMap:Map;K=new qe}function me(e,r){if(!e||Q)return"";{var t=K.get(e);if(t!==void 0)return t}var n;Q=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=H.current,H.current=null,Je();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(p){n=p}Reflect.construct(e,[],o)}else{try{o.call()}catch(p){n=p}e.call(o.prototype)}}else{try{throw Error()}catch(p){n=p}e()}}catch(p){if(p&&n&&typeof p.stack=="string"){for(var a=p.stack.split(`
|
19
|
+
`),v=n.stack.split(`
|
20
|
+
`),u=a.length-1,c=v.length-1;u>=1&&c>=0&&a[u]!==v[c];)c--;for(;u>=1&&c>=0;u--,c--)if(a[u]!==v[c]){if(u!==1||c!==1)do if(u--,c--,c<0||a[u]!==v[c]){var h=`
|
21
|
+
`+a[u].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),typeof e=="function"&&K.set(e,h),h}while(u>=1&&c>=0);break}}}finally{Q=!1,H.current=s,Be(),Error.prepareStackTrace=i}var W=e?e.displayName||e.name:"",P=W?q(W):"";return typeof e=="function"&&K.set(e,P),P}function Ke(e,r,t){return me(e,!1)}function ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function z(e,r,t){if(e==null)return"";if(typeof e=="function")return me(e,ze(e));if(typeof e=="string")return q(e);switch(e){case R:return q("Suspense");case d:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Ke(e.render);case y:return z(e.type,r,t);case _:{var n=e,i=n._payload,s=n._init;try{return z(s(i),r,t)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,be={},Ee=g.ReactDebugCurrentFrame;function G(e){if(e){var r=e._owner,t=z(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}function Ge(e,r,t,n,i){{var s=Function.call.bind(U);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var v=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){a=u}a&&!(a instanceof Error)&&(G(i),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),G(null)),a instanceof Error&&!(a.message in be)&&(be[a.message]=!0,G(i),l("Failed %s type: %s",t,a.message),G(null))}}}var Xe=Array.isArray;function ee(e){return Xe(e)}function He(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Ze(e){try{return Re(e),!1}catch{return!0}}function Re(e){return""+e}function _e(e){if(Ze(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",He(e)),Re(e)}var V=g.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},we,je,re;re={};function er(e){if(U.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function rr(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function tr(e,r){if(typeof e.ref=="string"&&V.current&&r&&V.current.stateNode!==r){var t=m(V.current.type);re[t]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',m(V.current.type),e.ref),re[t]=!0)}}function nr(e,r){{var t=function(){we||(we=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function ar(e,r){{var t=function(){je||(je=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var or=function(e,r,t,n,i,s,o){var a={$$typeof:x,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ir(e,r,t,n,i){{var s,o={},a=null,v=null;t!==void 0&&(_e(t),a=""+t),rr(r)&&(_e(r.key),a=""+r.key),er(r)&&(v=r.ref,tr(r,i));for(s in r)U.call(r,s)&&!Qe.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var u=e.defaultProps;for(s in u)o[s]===void 0&&(o[s]=u[s])}if(a||v){var c=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&nr(o,c),v&&ar(o,c)}return or(e,a,v,i,n,V.current,o)}}var te=g.ReactCurrentOwner,xe=g.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=z(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}function Te(){{if(te.current){var e=m(te.current.type);if(e)return`
|
22
|
+
|
23
|
+
Check the render method of \``+e+"`."}return""}}function sr(e){return""}var Ce={};function ur(e){{var r=Te();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
24
|
+
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function Oe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ur(r);if(Ce[t])return;Ce[t]=!0;var n="";e&&e._owner&&e._owner!==te.current&&(n=" It was passed a child from "+m(e._owner.type)+"."),I(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function Se(e,r){{if(typeof e!="object")return;if(ee(e))for(var t=0;t<e.length;t++){var n=e[t];ae(n)&&Oe(n,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var i=F(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)ae(o.value)&&Oe(o.value,r)}}}function cr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===y))t=r.propTypes;else return;if(t){var n=m(r);Ge(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var i=m(r);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var Pe={};function ke(e,r,t,n,i,s){{var o=Ve(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var v=sr();v?a+=v:a+=Te();var u;e===null?u="null":ee(e)?u="array":e!==void 0&&e.$$typeof===x?(u="<"+(m(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a)}var c=ir(e,r,t,i,s);if(c==null)return c;if(o){var h=r.children;if(h!==void 0)if(n)if(ee(h)){for(var W=0;W<h.length;W++)Se(h[W],e);Object.freeze&&Object.freeze(h)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Se(h,e)}if(U.call(r,"key")){var P=m(e),p=Object.keys(r).filter(function(hr){return hr!=="key"}),oe=p.length>0?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}";if(!Pe[P+oe]){var gr=p.length>0?"{"+p.join(": ..., ")+": ...}":"{}";l(`A props object containing a "key" prop is being spread into JSX:
|
26
|
+
let props = %s;
|
27
|
+
<%s {...props} />
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
29
|
+
let props = %s;
|
30
|
+
<%s key={someKey} {...props} />`,oe,P,gr,P),Pe[P+oe]=!0}}return e===b?lr(c):cr(c),c}}function fr(e,r,t){return ke(e,r,t,!0)}function dr(e,r,t){return ke(e,r,t,!1)}var vr=dr,pr=fr;L.Fragment=b,L.jsx=vr,L.jsxs=pr}()),L}process.env.NODE_ENV==="production"?X.exports=Ae():X.exports=De();var N=X.exports;let J="";async function Fe(j){if(!J)throw"user jid is empty, please initialize jsxc";await window.jsxc.getAccount(J).account.getConnection().getRosterService().addContact(new window.jsxc.JID(j),""),window.jsxc.getAccount(J).getContact(j).openChatWindow()}function Ie(j){const x="roster-append",k="windowlist-append",b="dialog-append",{jqueryUrl:A="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.js",marginTop:D="40px",marginLeft:O="40px",marginBottom:E="40px",marginRight:f="40px",contactId:R=null,showMenu:d,fullscreen:y,boshUrl:_,id:T,pw:B}=j;return J=T,C.useEffect(()=>{if(window.jsxc){R&&window.jsxc.getAccount(T).getContact(R).openChatWindow();return}y&&(document.getElementsByTagName("body")[0].className="jsxc-fullscreen");const $=document.createElement("script");$.type="text/javascript",$.src=A,document.head.appendChild($);let F=document.createElement("script");F.type="text/javascript",F.src="/jsxc.bundle.js",document.head.appendChild(F);const g=document.documentElement;g.style.setProperty("--jsxc-margin-top",D),g.style.setProperty("--jsxc-margin-left",O),g.style.setProperty("--jsxc-margin-bottom",E),g.style.setProperty("--jsxc-margin-right",f),F.onload=()=>{localStorage.removeItem("jsxc2:accounts");let l=new window.JSXC({rosterAppend:"#"+x,dialogAppend:"#"+b,windowListAppend:"#"+k});window.jsxc=l,l.start(_,T,B)},d==="yes"&&(g.style.setProperty("--jsxc-show-menu","none"),console.log("not show jsxc menu"))},[]),N.jsxs("div",{id:"jsxc-containers",style:{width:"100%",height:"100%"},children:[N.jsx("div",{style:{width:"100%",height:"100%"},id:x}),N.jsx("div",{style:{width:"100%",height:"100%"},id:b}),N.jsx("div",{style:{width:"100%",height:"100%"},id:k})]})}w.Jsxc=Ie,w.directOpenChatWindow=Fe,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|