@inditextech/weave-react 0.1.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/README.md +282 -0
- package/dist/react.cjs +22 -0
- package/dist/react.cjs.gz +0 -0
- package/dist/react.d.ts +81 -0
- package/dist/react.js +866 -0
- package/dist/react.js.gz +0 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.)
|
|
3
|
+
|
|
4
|
+
SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
[](https://badge.fury.io/js/angular2-expandable-list)
|
|
8
|
+
[](https://github.com/prettier/prettier)
|
|
9
|
+
|
|
10
|
+
# Weave.js / SDK
|
|
11
|
+
|
|
12
|
+
> Write a project description
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
This project requires NodeJS (version 8 or later) and NPM.
|
|
17
|
+
[Node](http://nodejs.org/) and [NPM](https://npmjs.org/) are really easy to install.
|
|
18
|
+
To make sure you have them available on your machine,
|
|
19
|
+
try running the following command.
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
$ npm -v && node -v
|
|
23
|
+
6.4.1
|
|
24
|
+
v8.16.0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Table of contents
|
|
28
|
+
|
|
29
|
+
- [Project Name](#project-name)
|
|
30
|
+
- [Prerequisites](#prerequisites)
|
|
31
|
+
- [Table of contents](#table-of-contents)
|
|
32
|
+
- [Getting Started](#getting-started)
|
|
33
|
+
- [Installation](#installation)
|
|
34
|
+
- [Usage](#usage)
|
|
35
|
+
- [Serving the app](#serving-the-app)
|
|
36
|
+
- [Running the tests](#running-the-tests)
|
|
37
|
+
- [Building a distribution version](#building-a-distribution-version)
|
|
38
|
+
- [Serving the distribution version](#serving-the-distribution-version)
|
|
39
|
+
- [API](#api)
|
|
40
|
+
- [useBasicFetch](#usebasicfetch)
|
|
41
|
+
- [Options](#options)
|
|
42
|
+
- [fetchData](#fetchdata)
|
|
43
|
+
- [Contributing](#contributing)
|
|
44
|
+
- [Credits](#credits)
|
|
45
|
+
- [Built With](#built-with)
|
|
46
|
+
- [Versioning](#versioning)
|
|
47
|
+
- [Authors](#authors)
|
|
48
|
+
- [License](#license)
|
|
49
|
+
|
|
50
|
+
## Getting Started
|
|
51
|
+
|
|
52
|
+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
**BEFORE YOU INSTALL:** please read the [prerequisites](#prerequisites)
|
|
57
|
+
|
|
58
|
+
Start with cloning this repo on your local machine:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
$ git clone https://github.com/ORG/PROJECT.git
|
|
62
|
+
$ cd PROJECT
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To install and set up the library, run:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
$ npm install -S myLib
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or if you prefer using Yarn:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
$ yarn add --dev myLib
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
### Serving the app
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
$ npm start
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Running the tests
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
$ npm test
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Building a distribution version
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
$ npm run build
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This task will create a distribution version of the project
|
|
98
|
+
inside your local `dist/` folder
|
|
99
|
+
|
|
100
|
+
### Serving the distribution version
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
$ npm run serve:dist
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This will use `lite-server` for servign your already
|
|
107
|
+
generated distribution version of the project.
|
|
108
|
+
|
|
109
|
+
_Note_ this requires
|
|
110
|
+
[Building a distribution version](#building-a-distribution-version) first.
|
|
111
|
+
|
|
112
|
+
## API
|
|
113
|
+
|
|
114
|
+
### useBasicFetch
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
useBasicFetch(((url: string) = ''), ((delay: number) = 0));
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Supported options and result fields for the `useBasicFetch` hook are listed below.
|
|
121
|
+
|
|
122
|
+
#### Options
|
|
123
|
+
|
|
124
|
+
`url`
|
|
125
|
+
|
|
126
|
+
| Type | Default value |
|
|
127
|
+
| ------ | ------------- |
|
|
128
|
+
| string | '' |
|
|
129
|
+
|
|
130
|
+
If present, the request will be performed as soon as the component is mounted
|
|
131
|
+
|
|
132
|
+
Example:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
const MyComponent: React.FC = () => {
|
|
136
|
+
const { data, error, loading } = useBasicFetch(
|
|
137
|
+
'https://api.icndb.com/jokes/random'
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
if (error) {
|
|
141
|
+
return <p>Error</p>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (loading) {
|
|
145
|
+
return <p>Loading...</p>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div className="App">
|
|
150
|
+
<h2>Chuck Norris Joke of the day</h2>
|
|
151
|
+
{data && data.value && <p>{data.value.joke}</p>}
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`delay`
|
|
158
|
+
|
|
159
|
+
| Type | Default value | Description |
|
|
160
|
+
| ------ | ------------- | -------------------- |
|
|
161
|
+
| number | 0 | Time in milliseconds |
|
|
162
|
+
|
|
163
|
+
If present, the request will be delayed by the given amount of time
|
|
164
|
+
|
|
165
|
+
Example:
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
type Joke = {
|
|
169
|
+
value: {
|
|
170
|
+
id: number;
|
|
171
|
+
joke: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const MyComponent: React.FC = () => {
|
|
176
|
+
const { data, error, loading } = useBasicFetch<Joke>(
|
|
177
|
+
'https://api.icndb.com/jokes/random',
|
|
178
|
+
2000
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
if (error) {
|
|
182
|
+
return <p>Error</p>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (loading) {
|
|
186
|
+
return <p>Loading...</p>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<div className="App">
|
|
191
|
+
<h2>Chuck Norris Joke of the day</h2>
|
|
192
|
+
{data && data.value && <p>{data.value.joke}</p>}
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### fetchData
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
fetchData(url: string)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Perform an asynchronous http request against a given url
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
type Joke = {
|
|
208
|
+
value: {
|
|
209
|
+
id: number;
|
|
210
|
+
joke: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const ChuckNorrisJokes: React.FC = () => {
|
|
215
|
+
const { data, fetchData, error, loading } = useBasicFetch<Joke>();
|
|
216
|
+
const [jokeId, setJokeId] = useState(1);
|
|
217
|
+
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
fetchData(`https://api.icndb.com/jokes/${jokeId}`);
|
|
220
|
+
}, [jokeId, fetchData]);
|
|
221
|
+
|
|
222
|
+
const handleNext = () => setJokeId(jokeId + 1);
|
|
223
|
+
|
|
224
|
+
if (error) {
|
|
225
|
+
return <p>Error</p>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const jokeData = data && data.value;
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<div className="Comments">
|
|
232
|
+
{loading && <p>Loading...</p>}
|
|
233
|
+
{!loading && jokeData && (
|
|
234
|
+
<div>
|
|
235
|
+
<p>Joke ID: {jokeData.id}</p>
|
|
236
|
+
<p>{jokeData.joke}</p>
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
{!loading && jokeData && !jokeData.joke && <p>{jokeData}</p>}
|
|
240
|
+
<button disabled={loading} onClick={handleNext}>
|
|
241
|
+
Next Joke
|
|
242
|
+
</button>
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Contributing
|
|
249
|
+
|
|
250
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
251
|
+
|
|
252
|
+
1. Fork it!
|
|
253
|
+
2. Create your feature branch: `git checkout -b my-new-feature`
|
|
254
|
+
3. Add your changes: `git add .`
|
|
255
|
+
4. Commit your changes: `git commit -am 'Add some feature'`
|
|
256
|
+
5. Push to the branch: `git push origin my-new-feature`
|
|
257
|
+
6. Submit a pull request :sunglasses:
|
|
258
|
+
|
|
259
|
+
## Credits
|
|
260
|
+
|
|
261
|
+
TODO: Write credits
|
|
262
|
+
|
|
263
|
+
## Built With
|
|
264
|
+
|
|
265
|
+
- Dropwizard - Bla bla bla
|
|
266
|
+
- Maven - Maybe
|
|
267
|
+
- Atom - ergaerga
|
|
268
|
+
- Love
|
|
269
|
+
|
|
270
|
+
## Versioning
|
|
271
|
+
|
|
272
|
+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
|
|
273
|
+
|
|
274
|
+
## Authors
|
|
275
|
+
|
|
276
|
+
- **John Doe** - _Initial work_ - [JohnDoe](https://github.com/JohnDoe)
|
|
277
|
+
|
|
278
|
+
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
[MIT License](https://andreasonny.mit-license.org/2019) © Andrea SonnY
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),O=require("@inditextech/weave-sdk");var Ye={exports:{}},oe={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.development.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
|
+
*/(function(){var c=w,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),D=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),K=Symbol.iterator,ie="@@iterator";function se(e){if(e===null||typeof e!="object")return null;var r=K&&e[K]||e[ie];return typeof r=="function"?r:null}var I=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),i=1;i<r;i++)t[i-1]=arguments[i];ue("error",e,t)}}function ue(e,r,t){{var i=I.ReactDebugCurrentFrame,l=i.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var f=t.map(function(u){return String(u)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var ce=!1,le=!1,fe=!1,G=!1,de=!1,$;$=Symbol.for("react.module.reference");function z(e){return!!(typeof e=="string"||typeof e=="function"||e===m||e===Y||de||e===j||e===E||e===_||G||e===V||ce||le||fe||typeof e=="object"&&e!==null&&(e.$$typeof===W||e.$$typeof===y||e.$$typeof===N||e.$$typeof===D||e.$$typeof===A||e.$$typeof===$||e.getModuleId!==void 0))}function B(e,r,t){var i=e.displayName;if(i)return i;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function L(e){return e.displayName||"Context"}function S(e){if(e==null)return null;if(typeof e.tag=="number"&&g("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 m:return"Fragment";case n:return"Portal";case Y:return"Profiler";case j:return"StrictMode";case E:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case D:var r=e;return L(r)+".Consumer";case N:var t=e;return L(t._context)+".Provider";case A:return B(e,e.render,"ForwardRef");case y:var i=e.displayName||null;return i!==null?i:S(e.type)||"Memo";case W:{var l=e,f=l._payload,u=l._init;try{return S(u(f))}catch{return null}}}return null}var k=Object.assign,F=0,X,q,J,Q,ee,a,x;function P(){}P.__reactDisabledLog=!0;function R(){{if(F===0){X=console.log,q=console.info,J=console.warn,Q=console.error,ee=console.group,a=console.groupCollapsed,x=console.groupEnd;var e={configurable:!0,enumerable:!0,value:P,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}F++}}function T(){{if(F--,F===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:X}),info:k({},e,{value:q}),warn:k({},e,{value:J}),error:k({},e,{value:Q}),group:k({},e,{value:ee}),groupCollapsed:k({},e,{value:a}),groupEnd:k({},e,{value:x})})}F<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ve=I.ReactCurrentDispatcher,ge;function re(e,r,t){{if(ge===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);ge=i&&i[1]||""}return`
|
|
10
|
+
`+ge+e}}var pe=!1,te;{var $e=typeof WeakMap=="function"?WeakMap:Map;te=new $e}function Ee(e,r){if(!e||pe)return"";{var t=te.get(e);if(t!==void 0)return t}var i;pe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=ve.current,ve.current=null,R();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(b){i=b}Reflect.construct(e,[],u)}else{try{u.call()}catch(b){i=b}e.call(u.prototype)}}else{try{throw Error()}catch(b){i=b}e()}}catch(b){if(b&&i&&typeof b.stack=="string"){for(var s=b.stack.split(`
|
|
11
|
+
`),p=i.stack.split(`
|
|
12
|
+
`),d=s.length-1,v=p.length-1;d>=1&&v>=0&&s[d]!==p[v];)v--;for(;d>=1&&v>=0;d--,v--)if(s[d]!==p[v]){if(d!==1||v!==1)do if(d--,v--,v<0||s[d]!==p[v]){var C=`
|
|
13
|
+
`+s[d].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&te.set(e,C),C}while(d>=1&&v>=0);break}}}finally{pe=!1,ve.current=f,T(),Error.prepareStackTrace=l}var Z=e?e.displayName||e.name:"",U=Z?re(Z):"";return typeof e=="function"&&te.set(e,U),U}function Le(e,r,t){return Ee(e,!1)}function Me(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ne(e,r,t){if(e==null)return"";if(typeof e=="function")return Ee(e,Me(e));if(typeof e=="string")return re(e);switch(e){case E:return re("Suspense");case _:return re("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case A:return Le(e.render);case y:return ne(e.type,r,t);case W:{var i=e,l=i._payload,f=i._init;try{return ne(f(l),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Se={},Ce=I.ReactDebugCurrentFrame;function ae(e){if(e){var r=e._owner,t=ne(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}function Ze(e,r,t,i,l){{var f=Function.call.bind(H);for(var u in e)if(f(e,u)){var s=void 0;try{if(typeof e[u]!="function"){var p=Error((i||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}s=e[u](r,u,i,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){s=d}s&&!(s instanceof Error)&&(ae(l),g("%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).",i||"React class",t,u,typeof s),ae(null)),s instanceof Error&&!(s.message in Se)&&(Se[s.message]=!0,ae(l),g("Failed %s type: %s",t,s.message),ae(null))}}}var Ne=Array.isArray;function he(e){return Ne(e)}function Ve(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ze(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function Pe(e){if(ze(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(e)),_e(e)}var Te=I.ReactCurrentOwner,Be={key:!0,ref:!0,__self:!0,__source:!0},we,Oe;function He(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ke(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ge(e,r){typeof e.ref=="string"&&Te.current}function Xe(e,r){{var t=function(){we||(we=!0,g("%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 qe(e,r){{var t=function(){Oe||(Oe=!0,g("%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 Je=function(e,r,t,i,l,f,u){var s={$$typeof:o,type:e,key:r,ref:t,props:u,_owner:f};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function Qe(e,r,t,i,l){{var f,u={},s=null,p=null;t!==void 0&&(Pe(t),s=""+t),Ke(r)&&(Pe(r.key),s=""+r.key),He(r)&&(p=r.ref,Ge(r,l));for(f in r)H.call(r,f)&&!Be.hasOwnProperty(f)&&(u[f]=r[f]);if(e&&e.defaultProps){var d=e.defaultProps;for(f in d)u[f]===void 0&&(u[f]=d[f])}if(s||p){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&Xe(u,v),p&&qe(u,v)}return Je(e,s,p,l,i,Te.current,u)}}var be=I.ReactCurrentOwner,je=I.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=ne(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}var me;me=!1;function ye(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ke(){{if(be.current){var e=S(be.current.type);if(e)return`
|
|
14
|
+
|
|
15
|
+
Check the render method of \``+e+"`."}return""}}function er(e){return""}var xe={};function rr(e){{var r=ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
16
|
+
|
|
17
|
+
Check the top-level render call using <`+t+">.")}return r}}function Ae(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=rr(r);if(xe[t])return;xe[t]=!0;var i="";e&&e._owner&&e._owner!==be.current&&(i=" It was passed a child from "+S(e._owner.type)+"."),M(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,i),M(null)}}function Ie(e,r){{if(typeof e!="object")return;if(he(e))for(var t=0;t<e.length;t++){var i=e[t];ye(i)&&Ae(i,r)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var l=se(e);if(typeof l=="function"&&l!==e.entries)for(var f=l.call(e),u;!(u=f.next()).done;)ye(u.value)&&Ae(u.value,r)}}}function tr(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===A||r.$$typeof===y))t=r.propTypes;else return;if(t){var i=S(r);Ze(t,e.props,"prop",i,e)}else if(r.PropTypes!==void 0&&!me){me=!0;var l=S(r);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function nr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var i=r[t];if(i!=="children"&&i!=="key"){M(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),M(null);break}}e.ref!==null&&(M(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var De={};function We(e,r,t,i,l,f){{var u=z(e);if(!u){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" 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 p=er();p?s+=p:s+=ke();var d;e===null?d="null":he(e)?d="array":e!==void 0&&e.$$typeof===o?(d="<"+(S(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,s)}var v=Qe(e,r,t,l,f);if(v==null)return v;if(u){var C=r.children;if(C!==void 0)if(i)if(he(C)){for(var Z=0;Z<C.length;Z++)Ie(C[Z],e);Object.freeze&&Object.freeze(C)}else g("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 Ie(C,e)}if(H.call(r,"key")){var U=S(e),b=Object.keys(r).filter(function(cr){return cr!=="key"}),Re=b.length>0?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}";if(!De[U+Re]){var ur=b.length>0?"{"+b.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,Re,U,ur,U),De[U+Re]=!0}}return e===m?nr(v):tr(v),v}}function ar(e,r,t){return We(e,r,t,!0)}function or(e,r,t){return We(e,r,t,!1)}var ir=or,sr=ar;oe.Fragment=m,oe.jsx=ir,oe.jsxs=sr})();Ye.exports=oe;var Fe=Ye.exports;const lr={IDLE:"idle"},Ue=c=>{let o;const n=new Set,m=(E,_)=>{const y=typeof E=="function"?E(o):E;if(!Object.is(y,o)){const W=o;o=_??(typeof y!="object"||y===null)?y:Object.assign({},o,y),n.forEach(V=>V(o,W))}},j=()=>o,D={setState:m,getState:j,getInitialState:()=>A,subscribe:E=>(n.add(E),()=>n.delete(E))},A=o=c(m,j,D);return D},fr=c=>c?Ue(c):Ue,dr=c=>c;function vr(c,o=dr){const n=w.useSyncExternalStore(c.subscribe,()=>o(c.getState()),()=>o(c.getInitialState()));return w.useDebugValue(n),n}const gr=c=>{const o=fr(c),n=m=>vr(o,m);return Object.assign(n,o),n},pr=c=>gr,h=pr()(c=>({instance:null,appState:{weave:{}},status:lr.IDLE,room:{loaded:!1},connection:{status:"disconnected"},users:{},undoRedo:{canUndo:!1,canRedo:!1},zoom:{value:1,canZoomIn:!1,canZoomOut:!1},contextMenu:{show:!1,position:{x:0,y:0},options:[]},selection:{nodes:[],node:void 0},actions:{active:!1,actual:void 0},setInstance:o=>c(n=>({...n,instance:o})),setStatus:o=>c(n=>({...n,status:o})),setAppState:o=>c(n=>({...n,appState:o})),setConnectionStatus:o=>c(n=>({...n,connection:{...n.connection,status:o}})),setRoomLoaded:o=>c(n=>({...n,room:{...n.room,loaded:o}})),setUsers:o=>c(n=>({...n,users:o})),setCanUndo:o=>c(n=>({...n,undoRedo:{...n.undoRedo,canUndo:o}})),setCanRedo:o=>c(n=>({...n,undoRedo:{...n.undoRedo,canRedo:o}})),setZoom:o=>c(n=>({...n,zoom:{...n.zoom,value:o}})),setCanZoomIn:o=>c(n=>({...n,zoom:{...n.zoom,canZoomIn:o}})),setCanZoomOut:o=>c(n=>({...n,zoom:{...n.zoom,canZoomOut:o}})),setSelectedNodes:o=>c(n=>({...n,selection:{...n.selection,nodes:o}})),setNode:o=>c(n=>({...n,selection:{...n.selection,node:o}})),setActualAction:o=>c(n=>({...n,actions:{...n.actions,active:typeof o<"u",actual:o}}))})),hr=({containerId:c,getUser:o,store:n,nodes:m=[],actions:j=[],plugins:Y=[],customPlugins:N=[],fonts:D=[],callbacks:A={},children:E})=>{const _=w.useRef(null),y=h(a=>a.selection.nodes),W=h(a=>a.setInstance),V=h(a=>a.setAppState),K=h(a=>a.setStatus),ie=h(a=>a.setRoomLoaded),se=h(a=>a.setUsers),I=h(a=>a.setCanUndo),g=h(a=>a.setCanRedo),ue=h(a=>a.setZoom),ce=h(a=>a.setCanZoomIn),le=h(a=>a.setCanZoomOut),fe=h(a=>a.setSelectedNodes),G=h(a=>a.setNode),de=h(a=>a.setActualAction),{onInstanceStatus:$,onRoomLoaded:z,onStateChange:B,onUndoManagerStatusChange:L,onActiveActionChange:S,...k}=A,F=w.useCallback(a=>{K(a),$==null||$(a)},[]),X=w.useCallback(a=>{ie(a),z==null||z(a)},[]),q=w.useCallback(a=>{V(a),B==null||B(a)},[y]),J=w.useCallback(a=>{const{canUndo:x,canRedo:P}=a;I(x),g(P),L==null||L(a)},[]),Q=w.useCallback(a=>{de(a),S==null||S(status)},[y]),ee=w.useCallback(a=>{a.length===1&&G(a[0].node),a.length!==1&&G(void 0),fe(a)},[]);return w.useEffect(()=>{async function a(){const x=document.getElementById(c),P=x==null?void 0:x.getBoundingClientRect();if(x&&!_.current){if(m.length>0)for(const T of m);if(j.length>0)for(const T of j);const R=[];if(Y.length>0)for(const T of Y)R.push(T);else R.push(new O.WeaveStageGridPlugin({})),R.push(new O.WeaveStagePanningPlugin),R.push(new O.WeaveStageResizePlugin),R.push(new O.WeaveStageZoomPlugin({onZoomChange:T=>{ue(T.scale),ce(T.canZoomIn),le(T.canZoomOut)}})),R.push(new O.WeaveNodesSelectionPlugin({onNodesChange:ee})),R.push(new O.WeaveStageDropAreaPlugin({})),R.push(new O.WeaveConnectedUsersPlugin({onConnectedUsersChanged:T=>{se(T)},getUser:o})),R.push(new O.WeaveUsersPointersPlugin({getUser:o})),R.push(new O.WeaveCopyPasteNodesPlugin({}));_.current=new O.Weave({store:n,nodes:m,actions:j,plugins:[...R,...N],fonts:D,callbacks:{...k,onInstanceStatus:F,onRoomLoaded:X,onStateChange:q,onUndoManagerStatusChange:J,onActiveActionChange:Q},logger:{level:"info"}},{container:c,width:(P==null?void 0:P.width)??1920,height:(P==null?void 0:P.height)??1080}),W(_.current),_.current.start()}}a()},[]),Fe.jsx(Fe.Fragment,{children:E})};exports.WeaveProvider=hr;exports.useWeave=h;
|
|
Binary file
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { StoreApi } from 'zustand';
|
|
3
|
+
import { UseBoundStore } from 'zustand';
|
|
4
|
+
import { Weave } from '@inditextech/weave-sdk';
|
|
5
|
+
import { WeaveAction } from '@inditextech/weave-sdk';
|
|
6
|
+
import { WeaveCallbacks } from '@inditextech/weave-types';
|
|
7
|
+
import { WeaveConnectedUsersChanged } from '@inditextech/weave-sdk';
|
|
8
|
+
import { WeaveFont } from '@inditextech/weave-types';
|
|
9
|
+
import { WeaveNode } from '@inditextech/weave-sdk';
|
|
10
|
+
import { WeavePlugin } from '@inditextech/weave-sdk';
|
|
11
|
+
import { WeaveSelection } from '@inditextech/weave-types';
|
|
12
|
+
import { WeaveState } from '@inditextech/weave-types';
|
|
13
|
+
import { WeaveStateElement } from '@inditextech/weave-types';
|
|
14
|
+
import { WeaveStatus } from '@inditextech/weave-types';
|
|
15
|
+
import { WeaveStore } from '@inditextech/weave-sdk';
|
|
16
|
+
import { WeaveUser } from '@inditextech/weave-types';
|
|
17
|
+
|
|
18
|
+
export declare const useWeave: UseBoundStore<StoreApi<WeaveRuntimeState>>;
|
|
19
|
+
|
|
20
|
+
export declare const WeaveProvider: ({ containerId, getUser, store, nodes, actions, plugins, customPlugins, fonts, callbacks, children, }: Readonly<WeaveProviderType>) => default_2.JSX.Element;
|
|
21
|
+
|
|
22
|
+
declare type WeaveProviderType = {
|
|
23
|
+
containerId: string;
|
|
24
|
+
getUser: () => WeaveUser;
|
|
25
|
+
fonts?: WeaveFont[];
|
|
26
|
+
store: WeaveStore;
|
|
27
|
+
nodes?: WeaveNode[];
|
|
28
|
+
actions?: WeaveAction[];
|
|
29
|
+
plugins?: WeavePlugin[];
|
|
30
|
+
customNodes?: WeaveNode[];
|
|
31
|
+
customActions?: WeaveAction[];
|
|
32
|
+
customPlugins?: WeavePlugin[];
|
|
33
|
+
callbacks?: WeaveCallbacks;
|
|
34
|
+
children: default_2.ReactNode;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
declare interface WeaveRuntimeState {
|
|
38
|
+
instance: Weave | null;
|
|
39
|
+
appState: WeaveState;
|
|
40
|
+
status: WeaveStatus;
|
|
41
|
+
connection: {
|
|
42
|
+
status: string;
|
|
43
|
+
};
|
|
44
|
+
room: {
|
|
45
|
+
loaded: boolean;
|
|
46
|
+
};
|
|
47
|
+
users: WeaveConnectedUsersChanged;
|
|
48
|
+
undoRedo: {
|
|
49
|
+
canUndo: boolean;
|
|
50
|
+
canRedo: boolean;
|
|
51
|
+
};
|
|
52
|
+
zoom: {
|
|
53
|
+
value: number;
|
|
54
|
+
canZoomIn: boolean;
|
|
55
|
+
canZoomOut: boolean;
|
|
56
|
+
};
|
|
57
|
+
selection: {
|
|
58
|
+
nodes: WeaveSelection[];
|
|
59
|
+
node: WeaveStateElement | undefined;
|
|
60
|
+
};
|
|
61
|
+
actions: {
|
|
62
|
+
active: boolean;
|
|
63
|
+
actual: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
setInstance: (newInstance: Weave | null) => void;
|
|
66
|
+
setStatus: (newStatus: WeaveStatus) => void;
|
|
67
|
+
setAppState: (newAppState: WeaveState) => void;
|
|
68
|
+
setConnectionStatus: (newConnectionStatus: string) => void;
|
|
69
|
+
setRoomLoaded: (newStatus: boolean) => void;
|
|
70
|
+
setUsers: (newUsers: WeaveConnectedUsersChanged) => void;
|
|
71
|
+
setCanUndo: (newCanUndo: boolean) => void;
|
|
72
|
+
setCanRedo: (newCanRedo: boolean) => void;
|
|
73
|
+
setZoom: (newZoom: number) => void;
|
|
74
|
+
setCanZoomIn: (newCanZoomIn: boolean) => void;
|
|
75
|
+
setCanZoomOut: (newCanZoomOut: boolean) => void;
|
|
76
|
+
setSelectedNodes: (newSelectedNodes: WeaveSelection[]) => void;
|
|
77
|
+
setNode: (newNode: WeaveStateElement | undefined) => void;
|
|
78
|
+
setActualAction: (newActualAction: string | undefined) => void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
import w from "react";
|
|
2
|
+
import { WeaveStageGridPlugin as cr, WeaveStagePanningPlugin as lr, WeaveStageResizePlugin as fr, WeaveStageZoomPlugin as dr, WeaveNodesSelectionPlugin as vr, WeaveStageDropAreaPlugin as gr, WeaveConnectedUsersPlugin as pr, WeaveUsersPointersPlugin as hr, WeaveCopyPasteNodesPlugin as br, Weave as mr } from "@inditextech/weave-sdk";
|
|
3
|
+
var Ue = { exports: {} }, ae = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.development.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
(function() {
|
|
14
|
+
var c = w, o = Symbol.for("react.element"), n = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), U = Symbol.for("react.profiler"), M = Symbol.for("react.provider"), I = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), N = Symbol.for("react.offscreen"), H = Symbol.iterator, oe = "@@iterator";
|
|
15
|
+
function ie(e) {
|
|
16
|
+
if (e === null || typeof e != "object")
|
|
17
|
+
return null;
|
|
18
|
+
var r = H && e[H] || e[oe];
|
|
19
|
+
return typeof r == "function" ? r : null;
|
|
20
|
+
}
|
|
21
|
+
var A = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
22
|
+
function g(e) {
|
|
23
|
+
{
|
|
24
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
|
|
25
|
+
t[i - 1] = arguments[i];
|
|
26
|
+
se("error", e, t);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function se(e, r, t) {
|
|
30
|
+
{
|
|
31
|
+
var i = A.ReactDebugCurrentFrame, l = i.getStackAddendum();
|
|
32
|
+
l !== "" && (r += "%s", t = t.concat([l]));
|
|
33
|
+
var f = t.map(function(u) {
|
|
34
|
+
return String(u);
|
|
35
|
+
});
|
|
36
|
+
f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var ue = !1, ce = !1, le = !1, K = !1, fe = !1, Y;
|
|
40
|
+
Y = Symbol.for("react.module.reference");
|
|
41
|
+
function V(e) {
|
|
42
|
+
return !!(typeof e == "string" || typeof e == "function" || e === m || e === U || fe || e === O || e === E || e === _ || K || e === N || ue || ce || le || typeof e == "object" && e !== null && (e.$$typeof === D || e.$$typeof === R || e.$$typeof === M || e.$$typeof === I || e.$$typeof === x || // This needs to include all possible module reference object
|
|
43
|
+
// types supported by any Flight configuration anywhere since
|
|
44
|
+
// we don't know which Flight build this will end up being used
|
|
45
|
+
// with.
|
|
46
|
+
e.$$typeof === Y || e.getModuleId !== void 0));
|
|
47
|
+
}
|
|
48
|
+
function z(e, r, t) {
|
|
49
|
+
var i = e.displayName;
|
|
50
|
+
if (i)
|
|
51
|
+
return i;
|
|
52
|
+
var l = r.displayName || r.name || "";
|
|
53
|
+
return l !== "" ? t + "(" + l + ")" : t;
|
|
54
|
+
}
|
|
55
|
+
function $(e) {
|
|
56
|
+
return e.displayName || "Context";
|
|
57
|
+
}
|
|
58
|
+
function S(e) {
|
|
59
|
+
if (e == null)
|
|
60
|
+
return null;
|
|
61
|
+
if (typeof e.tag == "number" && g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
62
|
+
return e.displayName || e.name || null;
|
|
63
|
+
if (typeof e == "string")
|
|
64
|
+
return e;
|
|
65
|
+
switch (e) {
|
|
66
|
+
case m:
|
|
67
|
+
return "Fragment";
|
|
68
|
+
case n:
|
|
69
|
+
return "Portal";
|
|
70
|
+
case U:
|
|
71
|
+
return "Profiler";
|
|
72
|
+
case O:
|
|
73
|
+
return "StrictMode";
|
|
74
|
+
case E:
|
|
75
|
+
return "Suspense";
|
|
76
|
+
case _:
|
|
77
|
+
return "SuspenseList";
|
|
78
|
+
}
|
|
79
|
+
if (typeof e == "object")
|
|
80
|
+
switch (e.$$typeof) {
|
|
81
|
+
case I:
|
|
82
|
+
var r = e;
|
|
83
|
+
return $(r) + ".Consumer";
|
|
84
|
+
case M:
|
|
85
|
+
var t = e;
|
|
86
|
+
return $(t._context) + ".Provider";
|
|
87
|
+
case x:
|
|
88
|
+
return z(e, e.render, "ForwardRef");
|
|
89
|
+
case R:
|
|
90
|
+
var i = e.displayName || null;
|
|
91
|
+
return i !== null ? i : S(e.type) || "Memo";
|
|
92
|
+
case D: {
|
|
93
|
+
var l = e, f = l._payload, u = l._init;
|
|
94
|
+
try {
|
|
95
|
+
return S(u(f));
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
var j = Object.assign, F = 0, G, X, J, q, Q, a, k;
|
|
104
|
+
function P() {
|
|
105
|
+
}
|
|
106
|
+
P.__reactDisabledLog = !0;
|
|
107
|
+
function y() {
|
|
108
|
+
{
|
|
109
|
+
if (F === 0) {
|
|
110
|
+
G = console.log, X = console.info, J = console.warn, q = console.error, Q = console.group, a = console.groupCollapsed, k = console.groupEnd;
|
|
111
|
+
var e = {
|
|
112
|
+
configurable: !0,
|
|
113
|
+
enumerable: !0,
|
|
114
|
+
value: P,
|
|
115
|
+
writable: !0
|
|
116
|
+
};
|
|
117
|
+
Object.defineProperties(console, {
|
|
118
|
+
info: e,
|
|
119
|
+
log: e,
|
|
120
|
+
warn: e,
|
|
121
|
+
error: e,
|
|
122
|
+
group: e,
|
|
123
|
+
groupCollapsed: e,
|
|
124
|
+
groupEnd: e
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
F++;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function T() {
|
|
131
|
+
{
|
|
132
|
+
if (F--, F === 0) {
|
|
133
|
+
var e = {
|
|
134
|
+
configurable: !0,
|
|
135
|
+
enumerable: !0,
|
|
136
|
+
writable: !0
|
|
137
|
+
};
|
|
138
|
+
Object.defineProperties(console, {
|
|
139
|
+
log: j({}, e, {
|
|
140
|
+
value: G
|
|
141
|
+
}),
|
|
142
|
+
info: j({}, e, {
|
|
143
|
+
value: X
|
|
144
|
+
}),
|
|
145
|
+
warn: j({}, e, {
|
|
146
|
+
value: J
|
|
147
|
+
}),
|
|
148
|
+
error: j({}, e, {
|
|
149
|
+
value: q
|
|
150
|
+
}),
|
|
151
|
+
group: j({}, e, {
|
|
152
|
+
value: Q
|
|
153
|
+
}),
|
|
154
|
+
groupCollapsed: j({}, e, {
|
|
155
|
+
value: a
|
|
156
|
+
}),
|
|
157
|
+
groupEnd: j({}, e, {
|
|
158
|
+
value: k
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
F < 0 && g("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
var de = A.ReactCurrentDispatcher, ve;
|
|
166
|
+
function ee(e, r, t) {
|
|
167
|
+
{
|
|
168
|
+
if (ve === void 0)
|
|
169
|
+
try {
|
|
170
|
+
throw Error();
|
|
171
|
+
} catch (l) {
|
|
172
|
+
var i = l.stack.trim().match(/\n( *(at )?)/);
|
|
173
|
+
ve = i && i[1] || "";
|
|
174
|
+
}
|
|
175
|
+
return `
|
|
176
|
+
` + ve + e;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
var ge = !1, re;
|
|
180
|
+
{
|
|
181
|
+
var Ye = typeof WeakMap == "function" ? WeakMap : Map;
|
|
182
|
+
re = new Ye();
|
|
183
|
+
}
|
|
184
|
+
function ye(e, r) {
|
|
185
|
+
if (!e || ge)
|
|
186
|
+
return "";
|
|
187
|
+
{
|
|
188
|
+
var t = re.get(e);
|
|
189
|
+
if (t !== void 0)
|
|
190
|
+
return t;
|
|
191
|
+
}
|
|
192
|
+
var i;
|
|
193
|
+
ge = !0;
|
|
194
|
+
var l = Error.prepareStackTrace;
|
|
195
|
+
Error.prepareStackTrace = void 0;
|
|
196
|
+
var f;
|
|
197
|
+
f = de.current, de.current = null, y();
|
|
198
|
+
try {
|
|
199
|
+
if (r) {
|
|
200
|
+
var u = function() {
|
|
201
|
+
throw Error();
|
|
202
|
+
};
|
|
203
|
+
if (Object.defineProperty(u.prototype, "props", {
|
|
204
|
+
set: function() {
|
|
205
|
+
throw Error();
|
|
206
|
+
}
|
|
207
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
208
|
+
try {
|
|
209
|
+
Reflect.construct(u, []);
|
|
210
|
+
} catch (h) {
|
|
211
|
+
i = h;
|
|
212
|
+
}
|
|
213
|
+
Reflect.construct(e, [], u);
|
|
214
|
+
} else {
|
|
215
|
+
try {
|
|
216
|
+
u.call();
|
|
217
|
+
} catch (h) {
|
|
218
|
+
i = h;
|
|
219
|
+
}
|
|
220
|
+
e.call(u.prototype);
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
try {
|
|
224
|
+
throw Error();
|
|
225
|
+
} catch (h) {
|
|
226
|
+
i = h;
|
|
227
|
+
}
|
|
228
|
+
e();
|
|
229
|
+
}
|
|
230
|
+
} catch (h) {
|
|
231
|
+
if (h && i && typeof h.stack == "string") {
|
|
232
|
+
for (var s = h.stack.split(`
|
|
233
|
+
`), p = i.stack.split(`
|
|
234
|
+
`), d = s.length - 1, v = p.length - 1; d >= 1 && v >= 0 && s[d] !== p[v]; )
|
|
235
|
+
v--;
|
|
236
|
+
for (; d >= 1 && v >= 0; d--, v--)
|
|
237
|
+
if (s[d] !== p[v]) {
|
|
238
|
+
if (d !== 1 || v !== 1)
|
|
239
|
+
do
|
|
240
|
+
if (d--, v--, v < 0 || s[d] !== p[v]) {
|
|
241
|
+
var C = `
|
|
242
|
+
` + s[d].replace(" at new ", " at ");
|
|
243
|
+
return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, C), C;
|
|
244
|
+
}
|
|
245
|
+
while (d >= 1 && v >= 0);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} finally {
|
|
250
|
+
ge = !1, de.current = f, T(), Error.prepareStackTrace = l;
|
|
251
|
+
}
|
|
252
|
+
var Z = e ? e.displayName || e.name : "", W = Z ? ee(Z) : "";
|
|
253
|
+
return typeof e == "function" && re.set(e, W), W;
|
|
254
|
+
}
|
|
255
|
+
function $e(e, r, t) {
|
|
256
|
+
return ye(e, !1);
|
|
257
|
+
}
|
|
258
|
+
function Le(e) {
|
|
259
|
+
var r = e.prototype;
|
|
260
|
+
return !!(r && r.isReactComponent);
|
|
261
|
+
}
|
|
262
|
+
function te(e, r, t) {
|
|
263
|
+
if (e == null)
|
|
264
|
+
return "";
|
|
265
|
+
if (typeof e == "function")
|
|
266
|
+
return ye(e, Le(e));
|
|
267
|
+
if (typeof e == "string")
|
|
268
|
+
return ee(e);
|
|
269
|
+
switch (e) {
|
|
270
|
+
case E:
|
|
271
|
+
return ee("Suspense");
|
|
272
|
+
case _:
|
|
273
|
+
return ee("SuspenseList");
|
|
274
|
+
}
|
|
275
|
+
if (typeof e == "object")
|
|
276
|
+
switch (e.$$typeof) {
|
|
277
|
+
case x:
|
|
278
|
+
return $e(e.render);
|
|
279
|
+
case R:
|
|
280
|
+
return te(e.type, r, t);
|
|
281
|
+
case D: {
|
|
282
|
+
var i = e, l = i._payload, f = i._init;
|
|
283
|
+
try {
|
|
284
|
+
return te(f(l), r, t);
|
|
285
|
+
} catch {
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return "";
|
|
290
|
+
}
|
|
291
|
+
var B = Object.prototype.hasOwnProperty, Ee = {}, Se = A.ReactDebugCurrentFrame;
|
|
292
|
+
function ne(e) {
|
|
293
|
+
if (e) {
|
|
294
|
+
var r = e._owner, t = te(e.type, e._source, r ? r.type : null);
|
|
295
|
+
Se.setExtraStackFrame(t);
|
|
296
|
+
} else
|
|
297
|
+
Se.setExtraStackFrame(null);
|
|
298
|
+
}
|
|
299
|
+
function Ze(e, r, t, i, l) {
|
|
300
|
+
{
|
|
301
|
+
var f = Function.call.bind(B);
|
|
302
|
+
for (var u in e)
|
|
303
|
+
if (f(e, u)) {
|
|
304
|
+
var s = void 0;
|
|
305
|
+
try {
|
|
306
|
+
if (typeof e[u] != "function") {
|
|
307
|
+
var p = Error((i || "React class") + ": " + t + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
308
|
+
throw p.name = "Invariant Violation", p;
|
|
309
|
+
}
|
|
310
|
+
s = e[u](r, u, i, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
311
|
+
} catch (d) {
|
|
312
|
+
s = d;
|
|
313
|
+
}
|
|
314
|
+
s && !(s instanceof Error) && (ne(l), g("%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).", i || "React class", t, u, typeof s), ne(null)), s instanceof Error && !(s.message in Ee) && (Ee[s.message] = !0, ne(l), g("Failed %s type: %s", t, s.message), ne(null));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
var Me = Array.isArray;
|
|
319
|
+
function pe(e) {
|
|
320
|
+
return Me(e);
|
|
321
|
+
}
|
|
322
|
+
function Ne(e) {
|
|
323
|
+
{
|
|
324
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
325
|
+
return t;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function Ve(e) {
|
|
329
|
+
try {
|
|
330
|
+
return Ce(e), !1;
|
|
331
|
+
} catch {
|
|
332
|
+
return !0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function Ce(e) {
|
|
336
|
+
return "" + e;
|
|
337
|
+
}
|
|
338
|
+
function _e(e) {
|
|
339
|
+
if (Ve(e))
|
|
340
|
+
return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ne(e)), Ce(e);
|
|
341
|
+
}
|
|
342
|
+
var Pe = A.ReactCurrentOwner, ze = {
|
|
343
|
+
key: !0,
|
|
344
|
+
ref: !0,
|
|
345
|
+
__self: !0,
|
|
346
|
+
__source: !0
|
|
347
|
+
}, Te, we;
|
|
348
|
+
function Be(e) {
|
|
349
|
+
if (B.call(e, "ref")) {
|
|
350
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
351
|
+
if (r && r.isReactWarning)
|
|
352
|
+
return !1;
|
|
353
|
+
}
|
|
354
|
+
return e.ref !== void 0;
|
|
355
|
+
}
|
|
356
|
+
function He(e) {
|
|
357
|
+
if (B.call(e, "key")) {
|
|
358
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
359
|
+
if (r && r.isReactWarning)
|
|
360
|
+
return !1;
|
|
361
|
+
}
|
|
362
|
+
return e.key !== void 0;
|
|
363
|
+
}
|
|
364
|
+
function Ke(e, r) {
|
|
365
|
+
typeof e.ref == "string" && Pe.current;
|
|
366
|
+
}
|
|
367
|
+
function Ge(e, r) {
|
|
368
|
+
{
|
|
369
|
+
var t = function() {
|
|
370
|
+
Te || (Te = !0, g("%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));
|
|
371
|
+
};
|
|
372
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
373
|
+
get: t,
|
|
374
|
+
configurable: !0
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function Xe(e, r) {
|
|
379
|
+
{
|
|
380
|
+
var t = function() {
|
|
381
|
+
we || (we = !0, g("%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));
|
|
382
|
+
};
|
|
383
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
384
|
+
get: t,
|
|
385
|
+
configurable: !0
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
var Je = function(e, r, t, i, l, f, u) {
|
|
390
|
+
var s = {
|
|
391
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
392
|
+
$$typeof: o,
|
|
393
|
+
// Built-in properties that belong on the element
|
|
394
|
+
type: e,
|
|
395
|
+
key: r,
|
|
396
|
+
ref: t,
|
|
397
|
+
props: u,
|
|
398
|
+
// Record the component responsible for creating this element.
|
|
399
|
+
_owner: f
|
|
400
|
+
};
|
|
401
|
+
return s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
402
|
+
configurable: !1,
|
|
403
|
+
enumerable: !1,
|
|
404
|
+
writable: !0,
|
|
405
|
+
value: !1
|
|
406
|
+
}), Object.defineProperty(s, "_self", {
|
|
407
|
+
configurable: !1,
|
|
408
|
+
enumerable: !1,
|
|
409
|
+
writable: !1,
|
|
410
|
+
value: i
|
|
411
|
+
}), Object.defineProperty(s, "_source", {
|
|
412
|
+
configurable: !1,
|
|
413
|
+
enumerable: !1,
|
|
414
|
+
writable: !1,
|
|
415
|
+
value: l
|
|
416
|
+
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
417
|
+
};
|
|
418
|
+
function qe(e, r, t, i, l) {
|
|
419
|
+
{
|
|
420
|
+
var f, u = {}, s = null, p = null;
|
|
421
|
+
t !== void 0 && (_e(t), s = "" + t), He(r) && (_e(r.key), s = "" + r.key), Be(r) && (p = r.ref, Ke(r, l));
|
|
422
|
+
for (f in r)
|
|
423
|
+
B.call(r, f) && !ze.hasOwnProperty(f) && (u[f] = r[f]);
|
|
424
|
+
if (e && e.defaultProps) {
|
|
425
|
+
var d = e.defaultProps;
|
|
426
|
+
for (f in d)
|
|
427
|
+
u[f] === void 0 && (u[f] = d[f]);
|
|
428
|
+
}
|
|
429
|
+
if (s || p) {
|
|
430
|
+
var v = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
431
|
+
s && Ge(u, v), p && Xe(u, v);
|
|
432
|
+
}
|
|
433
|
+
return Je(e, s, p, l, i, Pe.current, u);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
var he = A.ReactCurrentOwner, Oe = A.ReactDebugCurrentFrame;
|
|
437
|
+
function L(e) {
|
|
438
|
+
if (e) {
|
|
439
|
+
var r = e._owner, t = te(e.type, e._source, r ? r.type : null);
|
|
440
|
+
Oe.setExtraStackFrame(t);
|
|
441
|
+
} else
|
|
442
|
+
Oe.setExtraStackFrame(null);
|
|
443
|
+
}
|
|
444
|
+
var be;
|
|
445
|
+
be = !1;
|
|
446
|
+
function me(e) {
|
|
447
|
+
return typeof e == "object" && e !== null && e.$$typeof === o;
|
|
448
|
+
}
|
|
449
|
+
function je() {
|
|
450
|
+
{
|
|
451
|
+
if (he.current) {
|
|
452
|
+
var e = S(he.current.type);
|
|
453
|
+
if (e)
|
|
454
|
+
return `
|
|
455
|
+
|
|
456
|
+
Check the render method of \`` + e + "`.";
|
|
457
|
+
}
|
|
458
|
+
return "";
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function Qe(e) {
|
|
462
|
+
return "";
|
|
463
|
+
}
|
|
464
|
+
var ke = {};
|
|
465
|
+
function er(e) {
|
|
466
|
+
{
|
|
467
|
+
var r = je();
|
|
468
|
+
if (!r) {
|
|
469
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
470
|
+
t && (r = `
|
|
471
|
+
|
|
472
|
+
Check the top-level render call using <` + t + ">.");
|
|
473
|
+
}
|
|
474
|
+
return r;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function xe(e, r) {
|
|
478
|
+
{
|
|
479
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
480
|
+
return;
|
|
481
|
+
e._store.validated = !0;
|
|
482
|
+
var t = er(r);
|
|
483
|
+
if (ke[t])
|
|
484
|
+
return;
|
|
485
|
+
ke[t] = !0;
|
|
486
|
+
var i = "";
|
|
487
|
+
e && e._owner && e._owner !== he.current && (i = " It was passed a child from " + S(e._owner.type) + "."), L(e), g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, i), L(null);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function Ae(e, r) {
|
|
491
|
+
{
|
|
492
|
+
if (typeof e != "object")
|
|
493
|
+
return;
|
|
494
|
+
if (pe(e))
|
|
495
|
+
for (var t = 0; t < e.length; t++) {
|
|
496
|
+
var i = e[t];
|
|
497
|
+
me(i) && xe(i, r);
|
|
498
|
+
}
|
|
499
|
+
else if (me(e))
|
|
500
|
+
e._store && (e._store.validated = !0);
|
|
501
|
+
else if (e) {
|
|
502
|
+
var l = ie(e);
|
|
503
|
+
if (typeof l == "function" && l !== e.entries)
|
|
504
|
+
for (var f = l.call(e), u; !(u = f.next()).done; )
|
|
505
|
+
me(u.value) && xe(u.value, r);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function rr(e) {
|
|
510
|
+
{
|
|
511
|
+
var r = e.type;
|
|
512
|
+
if (r == null || typeof r == "string")
|
|
513
|
+
return;
|
|
514
|
+
var t;
|
|
515
|
+
if (typeof r == "function")
|
|
516
|
+
t = r.propTypes;
|
|
517
|
+
else if (typeof r == "object" && (r.$$typeof === x || // Note: Memo only checks outer props here.
|
|
518
|
+
// Inner props are checked in the reconciler.
|
|
519
|
+
r.$$typeof === R))
|
|
520
|
+
t = r.propTypes;
|
|
521
|
+
else
|
|
522
|
+
return;
|
|
523
|
+
if (t) {
|
|
524
|
+
var i = S(r);
|
|
525
|
+
Ze(t, e.props, "prop", i, e);
|
|
526
|
+
} else if (r.PropTypes !== void 0 && !be) {
|
|
527
|
+
be = !0;
|
|
528
|
+
var l = S(r);
|
|
529
|
+
g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", l || "Unknown");
|
|
530
|
+
}
|
|
531
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function tr(e) {
|
|
535
|
+
{
|
|
536
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
537
|
+
var i = r[t];
|
|
538
|
+
if (i !== "children" && i !== "key") {
|
|
539
|
+
L(e), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), L(null);
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
e.ref !== null && (L(e), g("Invalid attribute `ref` supplied to `React.Fragment`."), L(null));
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
var Ie = {};
|
|
547
|
+
function De(e, r, t, i, l, f) {
|
|
548
|
+
{
|
|
549
|
+
var u = V(e);
|
|
550
|
+
if (!u) {
|
|
551
|
+
var s = "";
|
|
552
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
553
|
+
var p = Qe();
|
|
554
|
+
p ? s += p : s += je();
|
|
555
|
+
var d;
|
|
556
|
+
e === null ? d = "null" : pe(e) ? d = "array" : e !== void 0 && e.$$typeof === o ? (d = "<" + (S(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, s);
|
|
557
|
+
}
|
|
558
|
+
var v = qe(e, r, t, l, f);
|
|
559
|
+
if (v == null)
|
|
560
|
+
return v;
|
|
561
|
+
if (u) {
|
|
562
|
+
var C = r.children;
|
|
563
|
+
if (C !== void 0)
|
|
564
|
+
if (i)
|
|
565
|
+
if (pe(C)) {
|
|
566
|
+
for (var Z = 0; Z < C.length; Z++)
|
|
567
|
+
Ae(C[Z], e);
|
|
568
|
+
Object.freeze && Object.freeze(C);
|
|
569
|
+
} else
|
|
570
|
+
g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
571
|
+
else
|
|
572
|
+
Ae(C, e);
|
|
573
|
+
}
|
|
574
|
+
if (B.call(r, "key")) {
|
|
575
|
+
var W = S(e), h = Object.keys(r).filter(function(ur) {
|
|
576
|
+
return ur !== "key";
|
|
577
|
+
}), Re = h.length > 0 ? "{key: someKey, " + h.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
578
|
+
if (!Ie[W + Re]) {
|
|
579
|
+
var sr = h.length > 0 ? "{" + h.join(": ..., ") + ": ...}" : "{}";
|
|
580
|
+
g(`A props object containing a "key" prop is being spread into JSX:
|
|
581
|
+
let props = %s;
|
|
582
|
+
<%s {...props} />
|
|
583
|
+
React keys must be passed directly to JSX without using spread:
|
|
584
|
+
let props = %s;
|
|
585
|
+
<%s key={someKey} {...props} />`, Re, W, sr, W), Ie[W + Re] = !0;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return e === m ? tr(v) : rr(v), v;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function nr(e, r, t) {
|
|
592
|
+
return De(e, r, t, !0);
|
|
593
|
+
}
|
|
594
|
+
function ar(e, r, t) {
|
|
595
|
+
return De(e, r, t, !1);
|
|
596
|
+
}
|
|
597
|
+
var or = ar, ir = nr;
|
|
598
|
+
ae.Fragment = m, ae.jsx = or, ae.jsxs = ir;
|
|
599
|
+
})();
|
|
600
|
+
Ue.exports = ae;
|
|
601
|
+
var Fe = Ue.exports;
|
|
602
|
+
const Rr = {
|
|
603
|
+
IDLE: "idle"
|
|
604
|
+
}, We = (c) => {
|
|
605
|
+
let o;
|
|
606
|
+
const n = /* @__PURE__ */ new Set(), m = (E, _) => {
|
|
607
|
+
const R = typeof E == "function" ? E(o) : E;
|
|
608
|
+
if (!Object.is(R, o)) {
|
|
609
|
+
const D = o;
|
|
610
|
+
o = _ ?? (typeof R != "object" || R === null) ? R : Object.assign({}, o, R), n.forEach((N) => N(o, D));
|
|
611
|
+
}
|
|
612
|
+
}, O = () => o, I = { setState: m, getState: O, getInitialState: () => x, subscribe: (E) => (n.add(E), () => n.delete(E)) }, x = o = c(m, O, I);
|
|
613
|
+
return I;
|
|
614
|
+
}, yr = (c) => c ? We(c) : We, Er = (c) => c;
|
|
615
|
+
function Sr(c, o = Er) {
|
|
616
|
+
const n = w.useSyncExternalStore(
|
|
617
|
+
c.subscribe,
|
|
618
|
+
() => o(c.getState()),
|
|
619
|
+
() => o(c.getInitialState())
|
|
620
|
+
);
|
|
621
|
+
return w.useDebugValue(n), n;
|
|
622
|
+
}
|
|
623
|
+
const Cr = (c) => {
|
|
624
|
+
const o = yr(c), n = (m) => Sr(o, m);
|
|
625
|
+
return Object.assign(n, o), n;
|
|
626
|
+
}, _r = (c) => Cr, b = _r()((c) => ({
|
|
627
|
+
instance: null,
|
|
628
|
+
appState: {
|
|
629
|
+
weave: {}
|
|
630
|
+
},
|
|
631
|
+
status: Rr.IDLE,
|
|
632
|
+
room: {
|
|
633
|
+
loaded: !1
|
|
634
|
+
},
|
|
635
|
+
connection: {
|
|
636
|
+
status: "disconnected"
|
|
637
|
+
},
|
|
638
|
+
users: {},
|
|
639
|
+
undoRedo: {
|
|
640
|
+
canUndo: !1,
|
|
641
|
+
canRedo: !1
|
|
642
|
+
},
|
|
643
|
+
zoom: {
|
|
644
|
+
value: 1,
|
|
645
|
+
canZoomIn: !1,
|
|
646
|
+
canZoomOut: !1
|
|
647
|
+
},
|
|
648
|
+
contextMenu: {
|
|
649
|
+
show: !1,
|
|
650
|
+
position: {
|
|
651
|
+
x: 0,
|
|
652
|
+
y: 0
|
|
653
|
+
},
|
|
654
|
+
options: []
|
|
655
|
+
},
|
|
656
|
+
selection: {
|
|
657
|
+
nodes: [],
|
|
658
|
+
node: void 0
|
|
659
|
+
},
|
|
660
|
+
actions: {
|
|
661
|
+
active: !1,
|
|
662
|
+
actual: void 0
|
|
663
|
+
},
|
|
664
|
+
setInstance: (o) => c((n) => ({
|
|
665
|
+
...n,
|
|
666
|
+
instance: o
|
|
667
|
+
})),
|
|
668
|
+
setStatus: (o) => c((n) => ({
|
|
669
|
+
...n,
|
|
670
|
+
status: o
|
|
671
|
+
})),
|
|
672
|
+
setAppState: (o) => c((n) => ({
|
|
673
|
+
...n,
|
|
674
|
+
appState: o
|
|
675
|
+
})),
|
|
676
|
+
setConnectionStatus: (o) => c((n) => ({
|
|
677
|
+
...n,
|
|
678
|
+
connection: {
|
|
679
|
+
...n.connection,
|
|
680
|
+
status: o
|
|
681
|
+
}
|
|
682
|
+
})),
|
|
683
|
+
setRoomLoaded: (o) => c((n) => ({
|
|
684
|
+
...n,
|
|
685
|
+
room: {
|
|
686
|
+
...n.room,
|
|
687
|
+
loaded: o
|
|
688
|
+
}
|
|
689
|
+
})),
|
|
690
|
+
setUsers: (o) => c((n) => ({
|
|
691
|
+
...n,
|
|
692
|
+
users: o
|
|
693
|
+
})),
|
|
694
|
+
setCanUndo: (o) => c((n) => ({
|
|
695
|
+
...n,
|
|
696
|
+
undoRedo: {
|
|
697
|
+
...n.undoRedo,
|
|
698
|
+
canUndo: o
|
|
699
|
+
}
|
|
700
|
+
})),
|
|
701
|
+
setCanRedo: (o) => c((n) => ({
|
|
702
|
+
...n,
|
|
703
|
+
undoRedo: {
|
|
704
|
+
...n.undoRedo,
|
|
705
|
+
canRedo: o
|
|
706
|
+
}
|
|
707
|
+
})),
|
|
708
|
+
setZoom: (o) => c((n) => ({
|
|
709
|
+
...n,
|
|
710
|
+
zoom: {
|
|
711
|
+
...n.zoom,
|
|
712
|
+
value: o
|
|
713
|
+
}
|
|
714
|
+
})),
|
|
715
|
+
setCanZoomIn: (o) => c((n) => ({
|
|
716
|
+
...n,
|
|
717
|
+
zoom: {
|
|
718
|
+
...n.zoom,
|
|
719
|
+
canZoomIn: o
|
|
720
|
+
}
|
|
721
|
+
})),
|
|
722
|
+
setCanZoomOut: (o) => c((n) => ({
|
|
723
|
+
...n,
|
|
724
|
+
zoom: {
|
|
725
|
+
...n.zoom,
|
|
726
|
+
canZoomOut: o
|
|
727
|
+
}
|
|
728
|
+
})),
|
|
729
|
+
setSelectedNodes: (o) => c((n) => ({
|
|
730
|
+
...n,
|
|
731
|
+
selection: {
|
|
732
|
+
...n.selection,
|
|
733
|
+
nodes: o
|
|
734
|
+
}
|
|
735
|
+
})),
|
|
736
|
+
setNode: (o) => c((n) => ({
|
|
737
|
+
...n,
|
|
738
|
+
selection: {
|
|
739
|
+
...n.selection,
|
|
740
|
+
node: o
|
|
741
|
+
}
|
|
742
|
+
})),
|
|
743
|
+
setActualAction: (o) => c((n) => ({
|
|
744
|
+
...n,
|
|
745
|
+
actions: {
|
|
746
|
+
...n.actions,
|
|
747
|
+
active: typeof o < "u",
|
|
748
|
+
actual: o
|
|
749
|
+
}
|
|
750
|
+
}))
|
|
751
|
+
})), wr = ({
|
|
752
|
+
containerId: c,
|
|
753
|
+
getUser: o,
|
|
754
|
+
store: n,
|
|
755
|
+
nodes: m = [],
|
|
756
|
+
actions: O = [],
|
|
757
|
+
plugins: U = [],
|
|
758
|
+
customPlugins: M = [],
|
|
759
|
+
fonts: I = [],
|
|
760
|
+
callbacks: x = {},
|
|
761
|
+
children: E
|
|
762
|
+
}) => {
|
|
763
|
+
const _ = w.useRef(null), R = b((a) => a.selection.nodes), D = b((a) => a.setInstance), N = b((a) => a.setAppState), H = b((a) => a.setStatus), oe = b((a) => a.setRoomLoaded), ie = b((a) => a.setUsers), A = b((a) => a.setCanUndo), g = b((a) => a.setCanRedo), se = b((a) => a.setZoom), ue = b((a) => a.setCanZoomIn), ce = b((a) => a.setCanZoomOut), le = b((a) => a.setSelectedNodes), K = b((a) => a.setNode), fe = b((a) => a.setActualAction), {
|
|
764
|
+
onInstanceStatus: Y,
|
|
765
|
+
onRoomLoaded: V,
|
|
766
|
+
onStateChange: z,
|
|
767
|
+
onUndoManagerStatusChange: $,
|
|
768
|
+
onActiveActionChange: S,
|
|
769
|
+
...j
|
|
770
|
+
} = x, F = w.useCallback(
|
|
771
|
+
(a) => {
|
|
772
|
+
H(a), Y == null || Y(a);
|
|
773
|
+
},
|
|
774
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
775
|
+
[]
|
|
776
|
+
), G = w.useCallback(
|
|
777
|
+
(a) => {
|
|
778
|
+
oe(a), V == null || V(a);
|
|
779
|
+
},
|
|
780
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
781
|
+
[]
|
|
782
|
+
), X = w.useCallback(
|
|
783
|
+
(a) => {
|
|
784
|
+
N(a), z == null || z(a);
|
|
785
|
+
},
|
|
786
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
787
|
+
[R]
|
|
788
|
+
), J = w.useCallback(
|
|
789
|
+
(a) => {
|
|
790
|
+
const {
|
|
791
|
+
canUndo: k,
|
|
792
|
+
canRedo: P
|
|
793
|
+
} = a;
|
|
794
|
+
A(k), g(P), $ == null || $(a);
|
|
795
|
+
},
|
|
796
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
797
|
+
[]
|
|
798
|
+
), q = w.useCallback(
|
|
799
|
+
(a) => {
|
|
800
|
+
fe(a), S == null || S(status);
|
|
801
|
+
},
|
|
802
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
803
|
+
[R]
|
|
804
|
+
), Q = w.useCallback((a) => {
|
|
805
|
+
a.length === 1 && K(a[0].node), a.length !== 1 && K(void 0), le(a);
|
|
806
|
+
}, []);
|
|
807
|
+
return w.useEffect(() => {
|
|
808
|
+
async function a() {
|
|
809
|
+
const k = document.getElementById(c), P = k == null ? void 0 : k.getBoundingClientRect();
|
|
810
|
+
if (k && !_.current) {
|
|
811
|
+
if (m.length > 0)
|
|
812
|
+
for (const T of m)
|
|
813
|
+
;
|
|
814
|
+
if (O.length > 0)
|
|
815
|
+
for (const T of O)
|
|
816
|
+
;
|
|
817
|
+
const y = [];
|
|
818
|
+
if (U.length > 0)
|
|
819
|
+
for (const T of U)
|
|
820
|
+
y.push(T);
|
|
821
|
+
else
|
|
822
|
+
y.push(new cr({})), y.push(new lr()), y.push(new fr()), y.push(new dr({
|
|
823
|
+
onZoomChange: (T) => {
|
|
824
|
+
se(T.scale), ue(T.canZoomIn), ce(T.canZoomOut);
|
|
825
|
+
}
|
|
826
|
+
})), y.push(new vr({
|
|
827
|
+
onNodesChange: Q
|
|
828
|
+
})), y.push(new gr({})), y.push(new pr({
|
|
829
|
+
onConnectedUsersChanged: (T) => {
|
|
830
|
+
ie(T);
|
|
831
|
+
},
|
|
832
|
+
getUser: o
|
|
833
|
+
})), y.push(new hr({
|
|
834
|
+
getUser: o
|
|
835
|
+
})), y.push(new br({}));
|
|
836
|
+
_.current = new mr({
|
|
837
|
+
store: n,
|
|
838
|
+
nodes: m,
|
|
839
|
+
actions: O,
|
|
840
|
+
plugins: [...y, ...M],
|
|
841
|
+
fonts: I,
|
|
842
|
+
callbacks: {
|
|
843
|
+
...j,
|
|
844
|
+
onInstanceStatus: F,
|
|
845
|
+
onRoomLoaded: G,
|
|
846
|
+
onStateChange: X,
|
|
847
|
+
onUndoManagerStatusChange: J,
|
|
848
|
+
onActiveActionChange: q
|
|
849
|
+
},
|
|
850
|
+
logger: {
|
|
851
|
+
level: "info"
|
|
852
|
+
}
|
|
853
|
+
}, {
|
|
854
|
+
container: c,
|
|
855
|
+
width: (P == null ? void 0 : P.width) ?? 1920,
|
|
856
|
+
height: (P == null ? void 0 : P.height) ?? 1080
|
|
857
|
+
}), D(_.current), _.current.start();
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
a();
|
|
861
|
+
}, []), /* @__PURE__ */ Fe.jsx(Fe.Fragment, { children: E });
|
|
862
|
+
};
|
|
863
|
+
export {
|
|
864
|
+
wr as WeaveProvider,
|
|
865
|
+
b as useWeave
|
|
866
|
+
};
|
package/dist/react.js.gz
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inditextech/weave-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
|
|
7
|
+
"homepage": "https://inditextech.github.io/weavejs",
|
|
8
|
+
"repository": "github:InditexTech/weavejs",
|
|
9
|
+
"maintainers": [
|
|
10
|
+
{
|
|
11
|
+
"name": "Jesus Manuel Piñeiro Cid",
|
|
12
|
+
"email": "jesusmpc@inditex.com"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
"import": "./dist/react.js",
|
|
17
|
+
"require": "./dist/react.cjs"
|
|
18
|
+
},
|
|
19
|
+
"types": "dist/react.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:snapshot": "vite build --mode=development --sourcemap --emptyOutDir",
|
|
25
|
+
"build": "vite build --mode=production --minify --emptyOutDir",
|
|
26
|
+
"bump:snapshot": "npm version $npm_package_version.$(date \"+%s\")",
|
|
27
|
+
"bundle:analyze": "vite-bundle-visualizer",
|
|
28
|
+
"check": "echo \"Monorepo test script\" && exit 0",
|
|
29
|
+
"dev": "vite build --watch",
|
|
30
|
+
"dist:tag": "npm dist-tag add \"$(jq -r .name package.json)@$(jq -r .version package.json)\" \"$PR_TAG\" --registry=\"$NPM_PUBLISHING_REGISTRY\" --verbose",
|
|
31
|
+
"format": "npm run lint -- --quiet --fix --fix-type layout",
|
|
32
|
+
"link": "npm link",
|
|
33
|
+
"lint:fix": "npm run lint -- --fix",
|
|
34
|
+
"lint": "eslint ./src",
|
|
35
|
+
"publish:snapshot": "npm publish",
|
|
36
|
+
"release:perform": "npm publish --access public",
|
|
37
|
+
"release:prepare": "npm run verify",
|
|
38
|
+
"test": "vitest --passWithNoTests --coverage --watch=false",
|
|
39
|
+
"dev:test": "vitest --passWithNoTests --coverage",
|
|
40
|
+
"types:check": "tsc --noEmit",
|
|
41
|
+
"verify": "npm run lint && npm run test && npm run build",
|
|
42
|
+
"version:development": "npm version $(npm version minor)-SNAPSHOT",
|
|
43
|
+
"version:release": "npm version $RELEASE_VERSION -m \"[npm-scripts] prepare release $RELEASE_VERSION\" --tag-version-prefix \"\""
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@inditextech/weave-sdk": "0.1.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "8.26.0",
|
|
48
|
+
"@typescript-eslint/parser": "8.26.0",
|
|
49
|
+
"@vitejs/plugin-react": "4.3.4",
|
|
50
|
+
"@vitest/coverage-v8": "1.6.0",
|
|
51
|
+
"@vitest/ui": "1.6.0",
|
|
52
|
+
"eslint": "8.57.1",
|
|
53
|
+
"eslint-plugin-react": "7.34.1",
|
|
54
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
55
|
+
"jsdom": "^26.0.0",
|
|
56
|
+
"react-remove-attr": "0.0.6",
|
|
57
|
+
"typescript-eslint": "8.22.0",
|
|
58
|
+
"vite": "5.2.9",
|
|
59
|
+
"vite-bundle-visualizer": "1.1.0",
|
|
60
|
+
"vite-plugin-compression2": "1.0.0",
|
|
61
|
+
"vite-plugin-dts": "4.0.3",
|
|
62
|
+
"vitest": "1.6.0",
|
|
63
|
+
"vitest-canvas-mock": "0.3.3",
|
|
64
|
+
"vitest-sonar-reporter": "2.0.0",
|
|
65
|
+
"zustand": "5.0.3"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"@types/react": ">= 18.3.1 && < 19",
|
|
69
|
+
"@types/react-dom": ">= 18.3.0 && < 19",
|
|
70
|
+
"konva": ">= 9.3.18",
|
|
71
|
+
"react": ">= 18.2.0 && < 19",
|
|
72
|
+
"react-dom": ">= 18.2.0 && < 19"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": "^18.12 || ^20.11 || ^22.11",
|
|
76
|
+
"npm": ">= 8.19.x"
|
|
77
|
+
},
|
|
78
|
+
"nx": {
|
|
79
|
+
"implicitDependencies": [
|
|
80
|
+
"@inditextech/weave-sdk"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|