@aracna/react 1.0.48 → 1.0.50
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/definitions/interfaces.d.ts +1 -1
- package/functions/create-base-element-component.d.ts +4 -4
- package/functions/create-base-element-component.js +1 -1
- package/functions/create-element-component.d.ts +2 -2
- package/functions/create-element-component.js +1 -1
- package/functions/create-floating-element-component.d.ts +4 -4
- package/functions/create-floating-element-component.js +1 -1
- package/functions/create-focus-trap-element-component.d.ts +4 -4
- package/functions/create-focus-trap-element-component.js +1 -1
- package/functions/create-form-control-element-component.d.ts +4 -4
- package/functions/create-form-control-element-component.js +1 -1
- package/hooks/use-intersection-observer.js +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +14 -699
- package/index.iife.js +1 -1
- package/package.json +23 -23
- package/definitions/generated-props.d.ts +0 -194
- package/definitions/generated-props.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttributeChangeEvent, StateChangeEvent } from '@aracna/web';
|
|
1
|
+
import type { AttributeChangeEvent, StateChangeEvent } from '@aracna/web-components';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
3
|
import type { UseIntersectionObserverElement } from './types.js';
|
|
4
4
|
export interface UseIntersectionObserverAreSomeIntersecting {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyOf } from '@aracna/core';
|
|
2
|
-
import {
|
|
3
|
-
import { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
1
|
+
import type { KeyOf } from '@aracna/core';
|
|
2
|
+
import type { AracnaBaseElementAttributes, AracnaBaseElementEventMap } from '@aracna/web-components';
|
|
3
|
+
import type { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new React component that renders a custom element which extends `BaseElement`.
|
|
6
6
|
* Optionally the events can be defined as well.
|
|
7
7
|
*
|
|
8
8
|
* [Aracna Reference](https://aracna.dariosechi.it/react/functions/create-base-element-component)
|
|
9
9
|
*/
|
|
10
|
-
export declare function createBaseElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends
|
|
10
|
+
export declare function createBaseElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends AracnaBaseElementAttributes = AracnaBaseElementAttributes, Events extends AracnaBaseElementEventMap = AracnaBaseElementEventMap, Props extends ElementComponentProps<Element, Attributes, Events> = ElementComponentProps<Element, Attributes, Events>, Key extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap>(tag: Key, element: new () => Element, events?: KeyOf.Shallow<Events>[]): ElementComponent<Element, Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElementComponent as
|
|
1
|
+
import{createElementComponent as a}from"./create-element-component.js";function o(e,t,n=[]){return a(e,t,["attribute-change","state-change",...n])}export{o as createBaseElementComponent};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KeyOf } from '@aracna/core';
|
|
2
|
-
import { ElementComponent, ElementComponentAttributes, ElementComponentEvents, ElementComponentProps } from '../definitions/types.js';
|
|
1
|
+
import { type KeyOf } from '@aracna/core';
|
|
2
|
+
import type { ElementComponent, ElementComponentAttributes, ElementComponentEvents, ElementComponentProps } from '../definitions/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new React component that renders a custom element.
|
|
5
5
|
* Optionally the events can be defined as well.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPascalCaseString as E}from"@aracna/core";import{createComponent as
|
|
1
|
+
import{getPascalCaseString as E}from"@aracna/core";import{createComponent as s}from"@lit/react";import p from"react";import{DEFAULT_ELEMENT_COMPONENT_EVENTS as r}from"../definitions/constants.js";function f(t,n,o=[]){return s({elementClass:n,events:{...r,...o.reduce((m,e)=>({...m,["on"+E(String(e))]:e}),{})},react:p,tagName:t})}export{f as createElementComponent};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyOf } from '@aracna/core';
|
|
2
|
-
import {
|
|
3
|
-
import { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
1
|
+
import type { KeyOf } from '@aracna/core';
|
|
2
|
+
import type { AracnaFloatingElementAttributes, AracnaFloatingElementEventMap } from '@aracna/web-components';
|
|
3
|
+
import type { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new React component that renders a custom element which extends `FloatingElement`.
|
|
6
6
|
* Optionally the events can be defined as well.
|
|
7
7
|
*
|
|
8
8
|
* [Aracna Reference](https://aracna.dariosechi.it/react/functions/create-floating-element-component)
|
|
9
9
|
*/
|
|
10
|
-
export declare function createFloatingElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends
|
|
10
|
+
export declare function createFloatingElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends AracnaFloatingElementAttributes = AracnaFloatingElementAttributes, Events extends AracnaFloatingElementEventMap = AracnaFloatingElementEventMap, Props extends ElementComponentProps<Element, Attributes, Events> = ElementComponentProps<Element, Attributes, Events>, Key extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap>(tag: Key, element: new () => Element, events?: KeyOf.Shallow<Events>[]): ElementComponent<Element, Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createBaseElementComponent as
|
|
1
|
+
import{createBaseElementComponent as o}from"./create-base-element-component.js";function m(e,t,n){return o(e,t,n)}export{m as createFloatingElementComponent};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyOf } from '@aracna/core';
|
|
2
|
-
import {
|
|
3
|
-
import { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
1
|
+
import type { KeyOf } from '@aracna/core';
|
|
2
|
+
import type { AracnaFocusTrapElementAttributes, AracnaFocusTrapElementEventMap } from '@aracna/web-components';
|
|
3
|
+
import type { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new React component that renders a custom element which extends `FocusTrapElement`.
|
|
6
6
|
* Optionally the events can be defined as well.
|
|
7
7
|
*
|
|
8
8
|
* [Aracna Reference](https://aracna.dariosechi.it/react/functions/create-focus-trap-element-component)
|
|
9
9
|
*/
|
|
10
|
-
export declare function createFocusTrapElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends
|
|
10
|
+
export declare function createFocusTrapElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends AracnaFocusTrapElementAttributes = AracnaFocusTrapElementAttributes, Events extends AracnaFocusTrapElementEventMap = AracnaFocusTrapElementEventMap, Props extends ElementComponentProps<Element, Attributes, Events> = ElementComponentProps<Element, Attributes, Events>, Key extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap>(tag: Key, element: new () => Element, events?: KeyOf.Shallow<Events>[]): ElementComponent<Element, Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createBaseElementComponent as
|
|
1
|
+
import{createBaseElementComponent as a}from"./create-base-element-component.js";function r(e,t,n=[]){return a(e,t,["focus-trap-activate","focus-trap-deactivate","focus-trap-post-activate","focus-trap-post-deactivate",...n])}export{r as createFocusTrapElementComponent};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KeyOf } from '@aracna/core';
|
|
2
|
-
import {
|
|
3
|
-
import { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
1
|
+
import type { KeyOf } from '@aracna/core';
|
|
2
|
+
import type { AracnaFormControlElementAttributes, AracnaFormControlElementEventMap } from '@aracna/web-components';
|
|
3
|
+
import type { ElementComponent, ElementComponentProps } from '../definitions/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new React component that renders a custom element which extends `FormControlElement`.
|
|
6
6
|
* Optionally the events can be defined as well.
|
|
7
7
|
*
|
|
8
8
|
* [Aracna Reference](https://aracna.dariosechi.it/react/functions/create-form-control-element-component)
|
|
9
9
|
*/
|
|
10
|
-
export declare function createFormControlElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends
|
|
10
|
+
export declare function createFormControlElementComponent<Element extends HTMLElementTagNameMap[Key], Attributes extends AracnaFormControlElementAttributes = AracnaFormControlElementAttributes, Events extends AracnaFormControlElementEventMap = AracnaFormControlElementEventMap, Props extends ElementComponentProps<Element, Attributes, Events> = ElementComponentProps<Element, Attributes, Events>, Key extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap>(tag: Key, element: new () => Element, events?: KeyOf.Shallow<Events>[]): ElementComponent<Element, Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createBaseElementComponent as o}from"./create-base-element-component.js";function
|
|
1
|
+
import{createBaseElementComponent as o}from"./create-base-element-component.js";function m(e,t,n){return o(e,t,n)}export{m as createFormControlElementComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import{isArray as b}from"@aracna/core";import{useEffect as y,useRef as a,useState as d}from"react";function L(c,r,u=[]){const t=a(),[s,f]=d([]),o=(...e)=>{const n=b(e[0])?e[0][0]instanceof Element?e[0]:[]:e[0]instanceof Element?e:[];if(n.length>0)return s.filter(i=>n.includes(i.target));const I=b(e[0])?e[0][0]?.current instanceof Element?e[0]:[]:e[0]?.current instanceof Element?e:[];return I.length>0?s.filter(i=>I.some(O=>O.current===i.target)):s},l=(...e)=>o(...e).some(n=>n.isIntersecting),v=(...e)=>o(...e).every(n=>n.isIntersecting),E=(...e)=>l(...e),m=e=>{f(e)};return y(()=>{t.current=new IntersectionObserver(m,r);for(let e of c){if(e instanceof Element){t.current.observe(e);continue}e?.current instanceof Element&&t.current.observe(e.current)}return()=>t.current?.disconnect()},[...c,r?.root,r?.rootMargin,r?.threshold,...u]),{entries:s,observer:t,areSomeIntersecting:l,isEveryIntersecting:v,isIntersecting:E}}export{L as useIntersectionObserver};
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var V=Object.create;var v=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var J=(e,t)=>{for(var n in t)v(e,n,{get:t[n],enumerable:!0})},P=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!q.call(e,s)&&s!==n&&v(e,s,{get:()=>t[s],enumerable:!(o=_(t,s))||o.enumerable});return e};var Q=(e,t,n)=>(n=e!=null?V(G(e)):{},P(t||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)),X=e=>P(v({},"__esModule",{value:!0}),e);var me={};J(me,{ComponentLifeCycle:()=>h,Memo:()=>Y,createBaseElementComponent:()=>l,createElementComponent:()=>g,createFloatingElementComponent:()=>Z,createFocusTrapElementComponent:()=>$,createFormControlElementComponent:()=>ee,forwardRef:()=>te,useDOMRect:()=>ne,useDispatch:()=>T,useElementRef:()=>oe,useEventListener:()=>re,useIntersectionObserver:()=>se,useLifeCycle:()=>C,useObservableElementComponent:()=>ae,useWindowEventListener:()=>O,useWindowSize:()=>ie});module.exports=X(me);var A=require("react");function Y(e){return(0,A.useMemo)(()=>e.children,e.deps??[])}var h=(o=>(o.CONSTRUCTED="CONSTRUCTED",o.MOUNTED="MOUNTED",o.UNMOUNTED="UNMOUNTED",o))(h||{});var L=require("@aracna/core"),N=require("@lit/react"),K=Q(require("react"),1);var R={onAbort:"abort",onAnimationEnd:"animationend",onAnimationIteration:"animationiteration",onAnimationStart:"animationstart",onAuxClick:"auxclick",onBeforeInput:"beforeinput",onBlur:"blur",onCanPlay:"canplay",onCanPlayThrough:"canplaythrough",onChange:"change",onClick:"click",onCompositionEnd:"compositionend",onCompositionStart:"compositionstart",onCompositionUpdate:"compositionupdate",onContextMenu:"contextmenu",onCopy:"copy",onCut:"cut",onDoubleClick:"doubleclick",onDrag:"drag",onDragEnd:"dragend",onDragEnter:"dragenter",onDragExit:"dragexit",onDragLeave:"dragleave",onDragOver:"dragover",onDragStart:"dragstart",onDrop:"drop",onDurationChange:"durationchange",onEmptied:"emptied",onEncrypted:"encrypted",onEnded:"ended",onError:"error",onEventHandler:"eventhandler",onFocus:"focus",onInput:"input",onInvalid:"invalid",onKeyDown:"keydown",onKeyPress:"keypress",onKeyUp:"keyup",onLoad:"load",onLoadStart:"loadstart",onLoadedData:"loadeddata",onLoadedMetadata:"loadedmetadata",onMouseDown:"mousedown",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onPaste:"paste",onPause:"pause",onPlay:"play",onPlaying:"playing",onPointerCancel:"pointercancel",onPointerDown:"pointerdown",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerMove:"pointermove",onPointerOut:"pointerout",onPointerOver:"pointerover",onPointerUp:"pointerup",onProgress:"progress",onRateChange:"ratechange",onReset:"reset",onResize:"resize",onScroll:"scroll",onSeeked:"seeked",onSeeking:"seeking",onSelect:"select",onStalled:"stalled",onSubmit:"submit",onSuspend:"suspend",onTimeUpdate:"timeupdate",onTouchCancel:"touchcancel",onTouchEnd:"touchend",onTouchMove:"touchmove",onTouchStart:"touchstart",onTransitionEnd:"transitionend",onVolumeChange:"volumechange",onWaiting:"waiting",onWheel:"wheel"};function g(e,t,n=[]){return(0,N.createComponent)({elementClass:t,events:{...R,...n.reduce((o,s)=>({...o,["on"+(0,L.getPascalCaseString)(String(s))]:s}),{})},react:K.default,tagName:e})}function l(e,t,n=[]){return g(e,t,["attribute-change","state-change",...n])}function Z(e,t,n){return l(e,t,n)}function $(e,t,n=[]){return l(e,t,["focus-trap-activate","focus-trap-deactivate","focus-trap-post-activate","focus-trap-post-deactivate",...n])}function ee(e,t,n){return l(e,t,n)}var D=require("react");function te(...e){return(0,D.forwardRef)(e[0])}var I=require("react");var b=require("react");function C(){let e=(0,b.useRef)("CONSTRUCTED");return(0,b.useEffect)(()=>(e.current="MOUNTED",()=>{e.current="UNMOUNTED"}),[]),e}function T(e){let t=C(),n=(0,I.useReducer)(()=>({}),{});return()=>{switch(t.current){case"CONSTRUCTED":case"UNMOUNTED":break;case"MOUNTED":n[1](),e&&e();break}}}var k=require("@aracna/web"),y=require("react");function ne(e,t=[]){let[n,o]=(0,y.useState)(new k.StubDOMRect);return(0,y.useEffect)(()=>{if(e instanceof Element){o(e.getBoundingClientRect());return}e?.current instanceof Element&&o(e.current.getBoundingClientRect())},[e,...t]),n}var U=require("@aracna/core"),F=require("react");function oe(e,t){return(0,F.useRef)((0,U.isWindowDefined)()?document.createElement(e,t):{current:{}})}var S=require("react");function re(e,t,n,o=[]){(0,S.useEffect)(()=>{if(e instanceof Element)return e.addEventListener(t,n),()=>e.removeEventListener(t,n);if(e?.current instanceof Element)return e.current.addEventListener(t,n),()=>e.current?.removeEventListener(t,n)},[e,t,n,...o])}var x=require("@aracna/core"),E=require("react");function se(e,t,n=[]){let o=(0,E.useRef)(),[s,u]=(0,E.useState)([]),p=(...r)=>{let c=(0,x.isArray)(r[0])?r[0][0]instanceof Element?r[0]:[]:r[0]instanceof Element?r:[];if(c.length>0)return s.filter(M=>c.includes(M.target));let w=(0,x.isArray)(r[0])?r[0][0]?.current instanceof Element?r[0]:[]:r[0]?.current instanceof Element?r:[];return w.length>0?s.filter(M=>w.some(B=>B.current===M.target)):s},a=(...r)=>p(...r).some(c=>c.isIntersecting),i=(...r)=>p(...r).every(c=>c.isIntersecting),j=(...r)=>a(...r),W=r=>{u(r)};return(0,E.useEffect)(()=>{o.current=new IntersectionObserver(W,t);for(let r of e){if(r instanceof Element){o.current.observe(r);continue}r?.current instanceof Element&&o.current.observe(r.current)}return()=>o.current?.disconnect()},[...e,t?.root,t?.rootMargin,t?.threshold,...n]),{entries:s,observer:o,areSomeIntersecting:a,isEveryIntersecting:i,isIntersecting:j}}var m=require("react");function ae(e){let t=(0,m.useRef)(null),n=T(),[o,s]=(0,m.useState)({}),u=(0,m.useCallback)(a=>{a.detail&&(e?.blacklist&&e.blacklist.includes(a.detail.name)||e?.whitelist&&!e.whitelist.includes(a.detail.name)||s(i=>a.detail?{...i,[a.detail.name]:a.detail.value}:i))},[e?.blacklist,e?.whitelist]),p=(0,m.useCallback)(a=>{a.detail&&(e?.blacklist&&e.blacklist.includes(a.detail.name)||e?.whitelist&&!e.whitelist.includes(a.detail.name)||s(i=>a.detail?{...i,[a.detail.name]:a.detail.value}:i))},[e?.blacklist,e?.whitelist]);return(0,m.useEffect)(()=>n(),[t.current]),{element:t.current,onAttributeChange:u,onStateChange:p,properties:o,ref:t}}var H=require("react");function O(e,t,n=[]){(0,H.useEffect)(()=>(window.addEventListener(e,t),()=>window.removeEventListener(e,t)),[e,t,...n])}var d=require("@aracna/core"),f=require("react");function ie(e=[]){let[t,n]=(0,f.useState)((0,d.isWindowDefined)()?window.innerHeight:0),[o,s]=(0,f.useState)((0,d.isWindowDefined)()?window.innerWidth:0),[u,p]=(0,f.useState)((0,d.isWindowDefined)()?window.outerHeight:0),[a,i]=(0,f.useState)((0,d.isWindowDefined)()?window.outerWidth:0);return O("resize",()=>{n(window.innerHeight),s(window.innerWidth),p(window.outerHeight),i(window.outerWidth)},e),{innerHeight:t,innerWidth:o,outerHeight:u,outerWidth:a}}
|