@alwith/module-auth 0.1.7 → 0.1.8
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/THIRD_PARTY_NOTICES.md +1 -0
- package/assets/pets/lounge/autumn.png +0 -0
- package/assets/pets/lounge/spring.png +0 -0
- package/assets/pets/lounge/summer.png +0 -0
- package/assets/pets/lounge/winter.png +0 -0
- package/dist/pets/react/components/pet-lounge.d.ts +18 -0
- package/dist/pets/react/components/pet-lounge.js +1 -0
- package/dist/pets/react/index.d.ts +1 -0
- package/dist/pets/react/index.js +1 -1
- package/dist/pets/react/lib/season.d.ts +3 -0
- package/dist/pets/react/lib/season.js +1 -0
- package/dist/pets/react/lib/use-season.d.ts +2 -0
- package/dist/pets/react/lib/use-season.js +1 -0
- package/licenses/tyme4ts-MIT.txt +21 -0
- package/package.json +2 -1
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -14,6 +14,7 @@ actually distributed by your application, including transitive dependencies.
|
|
|
14
14
|
| Package | Inspected version | License | Included license copy |
|
|
15
15
|
| ------- | ----------------- | ------- | ----------------------- |
|
|
16
16
|
| fflate | 0.8.3 | MIT | licenses/fflate-MIT.txt |
|
|
17
|
+
| tyme4ts | 1.5.3 | MIT | licenses/tyme4ts-MIT.txt |
|
|
17
18
|
|
|
18
19
|
The pet React entry uses the external dependencies and optional React peers declared in `package.json`. Asset and core entries do not load React.
|
|
19
20
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./lounge-burst.css";
|
|
2
|
+
export interface LoungeNest {
|
|
3
|
+
inlineEnd: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
interface Point {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function PetLounge({ active, nest, onOpenCenter, onSend, dropTarget }: {
|
|
12
|
+
active: boolean;
|
|
13
|
+
nest: LoungeNest;
|
|
14
|
+
onOpenCenter: () => void;
|
|
15
|
+
onSend: (petId: string, center?: Point) => Promise<void>;
|
|
16
|
+
dropTarget?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as v,Fragment as A}from"react/jsx-runtime";import{PlusIcon as G}from"lucide-react";import{useEffect as W,useRef as E,useState as f}from"react";import{createPortal as T}from"react-dom";import{useTranslation as J}from"react-i18next";import K from"../../../../assets/pets/lounge/autumn.png?url";import O from"../../../../assets/pets/lounge/spring.png?url";import Q from"../../../../assets/pets/lounge/summer.png?url";import Z from"../../../../assets/pets/lounge/winter.png?url";import{vibemonHost as tt}from"../../core/host.js";import{loadVibemonResource as et}from"../../core/lib/vibemon-resources.js";import{getVibemonScopeSync as rt,useVibemonState as ot}from"../lib/account-state.js";import{useSeason as nt}from"../lib/use-season.js";import{Button as B}from"../ui/button.js";import{SpriteRenderer as st}from"./sprite-renderer.js";import"./lounge-burst.css";var it={spring:O,summer:Q,autumn:K,winter:Z};function Et({active:Y,nest:s,onOpenCenter:j,onSend:_,dropTarget:k=!1}){let C=tt(),o=ot(),h=rt(),{t:F}=J("common"),L=nt(),[y,P]=f(null),[S,g]=f(null),[U,D]=f(0),[x,I]=f(!1),[u,d]=f(null),[w,N]=f(null),m=E(null),z=E(!1),b=E(!1),a=y?.pet===o.pet&&y.scope===h?y.resource:null;W(()=>{let t=!1,e=null;if(g(null),P(null),d(null),h!==null&&o.pet)(async()=>{if(!(await C.assets.getMyVibemons()).some((n)=>n.vibemon_uuid===o.pet))throw Error("This account does not own the selected Vibemon");if(t)return;if(e=await et(o.pet),t)e.dispose();else P({pet:o.pet,scope:h,resource:e})})().catch((r)=>{if(!t)g(r instanceof Error?r.message:String(r))});return()=>{t=!0,e?.dispose()}},[C,h,o.pet,U]);let R=async(t)=>{if(z.current)return;if(z.current=!0,I(!0),g(null),t)d({center:t,scale:2}),N(t);try{await _(o.pet,t)}catch(e){g(e instanceof Error?e.message:String(e))}finally{z.current=!1,I(!1),d(null)}},V=(t)=>a&&i(st,{config:a.config,spriteUrl:a.spriteUrl,staticImage:a.staticImage,stateId:a.config.behaviorMap.sleep,flipped:!1,active:Y||t,onMouseDown:()=>{},onClick:()=>{},onRenderError:(e)=>g(e.message)}),M={insetInlineEnd:s.inlineEnd,bottom:s.bottom,width:s.size,height:s.size};return v(A,{children:[i("img",{src:it[L],alt:"",draggable:!1,className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 w-full"}),(k||u!==null&&!x)&&i("div",{"data-testid":"pet-lounge-drop",className:"border-primary bg-primary/10 pointer-events-none absolute z-30 rounded-xl border-4 border-dashed",style:M}),!o.enabled&&!o.pet&&i(B,{"aria-label":"Vibémon",onClick:j,className:"border-primary bg-primary/10 text-primary absolute z-20 rounded-xl border-4 border-dashed p-0",style:M,children:i(G,{className:"size-16"})}),!o.enabled&&a&&i("button",{type:"button","aria-label":"Vibémon",disabled:x,className:"vibemon-lounge-pet absolute z-20 cursor-grab touch-none border-0 bg-transparent p-0 disabled:cursor-wait",style:{...M,opacity:u?0:1},onPointerDown:(t)=>{if(t.button!==0||x)return;let e=t.currentTarget.getBoundingClientRect(),r=t.currentTarget.parentElement;if(!r)throw Error("Lounge requires its station");let n=getComputedStyle(r).direction==="rtl",c=r.getBoundingClientRect();b.current=!1,m.current={start:{x:t.clientX,y:t.clientY},origin:{x:e.left+e.width/2,y:e.top+e.height/2},rect:e,edge:n?c.right:c.left,rtl:n,pointer:t.pointerId},t.currentTarget.setPointerCapture(t.pointerId)},onPointerMove:(t)=>{let e=m.current;if(!e)return;let r=t.clientX-e.start.x,n=t.clientY-e.start.y,c=Math.hypot(r,n);if(c<=4&&!b.current)return;b.current=!0;let l={x:e.origin.x+r,y:e.origin.y+n},X=1+Math.min(c/200,1);d({center:l,scale:X});let p=s.size*X/2,H=Math.max(0,Math.min(l.x+p,innerWidth)-Math.max(l.x-p,0)),q=Math.max(0,Math.min(l.y+p,innerHeight)-Math.max(l.y-p,0));if(H*q<p*p*2)m.current=null,t.currentTarget.releasePointerCapture(t.pointerId),R(l)},onPointerUp:(t)=>{let e=m.current;if(m.current=null,!e||!b.current)return;let r=t.clientX-e.start.x,n=t.clientY-e.start.y,c=t.clientX>=e.rect.left&&t.clientX<=e.rect.right&&t.clientY>=e.rect.top&&t.clientY<=e.rect.bottom,l=e.rtl?t.clientX>e.edge:t.clientX<e.edge;if(!c&&l&&Math.hypot(r,n)>=200)R({x:e.origin.x+r,y:e.origin.y+n});else d(null)},onPointerCancel:()=>{m.current=null,d(null),b.current=!0},children:V(!1)}),u&&a&&T(i("div",{className:"pointer-events-none fixed z-[9999]",style:{left:u.center.x-s.size/2,top:u.center.y-s.size/2,width:s.size,height:s.size,transform:`scale(${u.scale})`},children:V(!0)}),document.body),w&&T(i("div",{className:"alwith-vibemon-burst pointer-events-none fixed z-[10000]",style:{left:w.x,top:w.y,width:280,height:280,transform:"translate(-50%, -50%) scale(0.7142857)"},onAnimationEnd:()=>N(null)}),document.body),S&&v("div",{role:"alert",className:"bg-popover text-popover-foreground absolute inset-x-2 bottom-36 z-30 rounded-lg p-2 text-xs",children:[S,i(B,{size:"sm",variant:"outline",onClick:()=>D((t)=>t+1),children:F("vibemon.updateResources")})]})]})}export{Et as PetLounge};
|
|
@@ -2,3 +2,4 @@ export { VibemonPage as PetCenter } from "./components/vibemon-page.js";
|
|
|
2
2
|
export { PetWindow } from "./components/pet-window.js";
|
|
3
3
|
export { PetQuickReply } from "./components/quick-reply.js";
|
|
4
4
|
export { PetModeButton } from "./components/pet-mode-button.js";
|
|
5
|
+
export { PetLounge } from "./components/pet-lounge.js";
|
package/dist/pets/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VibemonPage as t}from"./components/vibemon-page.js";import{PetWindow as m}from"./components/pet-window.js";import{PetQuickReply as P}from"./components/quick-reply.js";import{PetModeButton as n}from"./components/pet-mode-button.js";export{t as PetCenter,n as PetModeButton,P as PetQuickReply,m as PetWindow};
|
|
1
|
+
import{VibemonPage as t}from"./components/vibemon-page.js";import{PetWindow as m}from"./components/pet-window.js";import{PetQuickReply as P}from"./components/quick-reply.js";import{PetModeButton as n}from"./components/pet-mode-button.js";import{PetLounge as i}from"./components/pet-lounge.js";export{t as PetCenter,i as PetLounge,n as PetModeButton,P as PetQuickReply,m as PetWindow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SolarTime as u}from"tyme4ts";var s={立春:"spring",雨水:"spring",惊蛰:"spring",春分:"spring",清明:"spring",谷雨:"spring",立夏:"summer",小满:"summer",芒种:"summer",夏至:"summer",小暑:"summer",大暑:"summer",立秋:"autumn",处暑:"autumn",白露:"autumn",秋分:"autumn",寒露:"autumn",霜降:"autumn",立冬:"winter",小雪:"winter",大雪:"winter",冬至:"winter",小寒:"winter",大寒:"winter"},i={spring:"autumn",summer:"winter",autumn:"spring",winter:"summer"};function g(e=new Date,m="north"){let t=new Date(e.getTime()+28800000),r=u.fromYmdHms(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds()).getTerm().getName(),n=s[r];if(!n)throw Error(`Unknown solar term: ${r}`);return m==="south"?i[n]:n}export{g as currentSeason};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{currentSeason as r}from"./season.js";var i=new Set(["Antarctica","Australia","Pacific/Auckland","Pacific/Chatham","Pacific/Fiji","Pacific/Noumea","Pacific/Port_Moresby","Pacific/Guadalcanal","Pacific/Tongatapu","Pacific/Apia","Pacific/Tahiti","America/Sao_Paulo","America/Argentina","America/Santiago","America/Montevideo","America/Asuncion","America/La_Paz","America/Lima","America/Recife","America/Bahia","America/Cuiaba","America/Campo_Grande","Africa/Johannesburg","Africa/Maputo","Africa/Windhoek","Africa/Harare","Africa/Lusaka","Africa/Gaborone","Africa/Luanda","Africa/Dar_es_Salaam","Indian/Antananarivo","Indian/Mauritius","Indian/Reunion"]);function c(){let a=Intl.DateTimeFormat().resolvedOptions().timeZone;if(!a)return"north";let e=a.split("/")[0];if(i.has(a)||i.has(e))return"south";let n=a.split("/").slice(0,2).join("/");return i.has(n)?"south":"north"}function t(){return r(new Date,c())}export{t as useSeason};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 6tail
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwith/module-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"motion": "^13.4.6",
|
|
102
102
|
"react-i18next": "^17.0.15",
|
|
103
103
|
"sonner": "^2.0.8",
|
|
104
|
+
"tyme4ts": "^1.5.3",
|
|
104
105
|
"zustand": "^5.0.15"
|
|
105
106
|
},
|
|
106
107
|
"peerDependencies": {
|