@pg-labs-incubator/cobweb 0.0.5 → 0.0.7
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/package.json +7 -4
- package/src/action/button.yaml +9 -0
- package/target/esbuild/action/action.css +1 -1
- package/target/esbuild/action/base.jsx +1 -1
- package/target/esbuild/action/button.jsx +6 -4
- package/target/esbuild/action/fab-menu-context.jsx +1 -1
- package/target/esbuild/action/fab-menu.jsx +3 -3
- package/target/esbuild/action/fab.jsx +3 -3
- package/target/esbuild/action/group.jsx +7 -7
- package/target/esbuild/action/icon-button.jsx +3 -3
- package/target/esbuild/action/index.jsx +1 -1
- package/target/esbuild/action/progress-button.css +1 -0
- package/target/esbuild/action/progress-button.jsx +4 -0
- package/target/esbuild/action/split-button.jsx +4 -4
- package/target/esbuild/color/contrast.jsx +1 -1
- package/target/esbuild/color/dynamic.jsx +1 -1
- package/target/esbuild/color/hct.jsx +1 -1
- package/target/esbuild/color/index.jsx +1 -1
- package/target/esbuild/color/palette.jsx +1 -1
- package/target/esbuild/color/scheme.jsx +1 -1
- package/target/esbuild/color/temperature.jsx +1 -1
- package/target/esbuild/container/card.jsx +1 -1
- package/target/esbuild/container/elevation-shadow.jsx +1 -1
- package/target/esbuild/container/index.jsx +1 -1
- package/target/esbuild/dom/client.jsx +1 -1
- package/target/esbuild/dom/index.jsx +1 -1
- package/target/esbuild/dom/server.jsx +1 -1
- package/target/esbuild/dom/types.jsx +1 -1
- package/target/esbuild/feedback/badge.jsx +6 -6
- package/target/esbuild/feedback/focus.jsx +1 -1
- package/target/esbuild/feedback/index.jsx +1 -1
- package/target/esbuild/feedback/loading.jsx +3 -3
- package/target/esbuild/feedback/observe.jsx +1 -1
- package/target/esbuild/feedback/progress.jsx +9 -9
- package/target/esbuild/feedback/snackbar.jsx +6 -6
- package/target/esbuild/feedback/tooltip.jsx +6 -6
- package/target/esbuild/icon/icon.jsx +1 -1
- package/target/esbuild/icon/index.jsx +1 -1
- package/target/esbuild/index.jsx +1 -1
- package/target/esbuild/input/autocomplete.jsx +2 -2
- package/target/esbuild/input/base.jsx +2 -2
- package/target/esbuild/input/date-picker.jsx +19 -19
- package/target/esbuild/input/date-time.jsx +3 -3
- package/target/esbuild/input/index.jsx +1 -1
- package/target/esbuild/input/paired-input.jsx +1 -1
- package/target/esbuild/input/picker-dialog.jsx +3 -3
- package/target/esbuild/input/select.jsx +4 -4
- package/target/esbuild/input/slider.jsx +7 -7
- package/target/esbuild/input/text-field.jsx +4 -4
- package/target/esbuild/input/time-picker.jsx +5 -5
- package/target/esbuild/motion/follow-height.jsx +1 -0
- package/target/esbuild/motion/frame.jsx +1 -1
- package/target/esbuild/motion/index.jsx +1 -1
- package/target/esbuild/motion/material.jsx +1 -1
- package/target/esbuild/motion/motion.jsx +1 -1
- package/target/esbuild/motion/spring.jsx +1 -1
- package/target/esbuild/motion/transition.jsx +1 -1
- package/target/esbuild/motion/velocity.jsx +1 -1
- package/target/esbuild/navigation/app-bar.jsx +8 -8
- package/target/esbuild/navigation/base.jsx +1 -1
- package/target/esbuild/navigation/drawer.jsx +7 -7
- package/target/esbuild/navigation/index.jsx +1 -1
- package/target/esbuild/navigation/navigation.jsx +12 -12
- package/target/esbuild/navigation/scroll.jsx +1 -1
- package/target/esbuild/navigation/search.jsx +4 -4
- package/target/esbuild/navigation/tabs.jsx +3 -3
- package/target/esbuild/navigation/toolbar.jsx +3 -3
- package/target/esbuild/selection/base.jsx +1 -1
- package/target/esbuild/selection/checkbox.jsx +4 -4
- package/target/esbuild/selection/chip.jsx +5 -5
- package/target/esbuild/selection/index.jsx +1 -1
- package/target/esbuild/selection/radio.jsx +3 -3
- package/target/esbuild/selection/segmented.jsx +4 -4
- package/target/esbuild/selection/switch.jsx +3 -3
- package/target/esbuild/shape/corner-rounding.jsx +1 -1
- package/target/esbuild/shape/cubic.jsx +1 -1
- package/target/esbuild/shape/index.jsx +1 -1
- package/target/esbuild/shape/material-shapes.jsx +1 -1
- package/target/esbuild/shape/morph.jsx +1 -1
- package/target/esbuild/shape/path.jsx +1 -1
- package/target/esbuild/shape/point.jsx +1 -1
- package/target/esbuild/shape/rounded-polygon.jsx +1 -1
- package/target/esbuild/shape/shapes.jsx +1 -1
- package/target/esbuild/spacing/index.jsx +1 -1
- package/target/esbuild/state/component.jsx +1 -1
- package/target/esbuild/state/controller.jsx +1 -1
- package/target/esbuild/state/index.jsx +1 -1
- package/target/esbuild/state/ripple.jsx +1 -1
- package/target/esbuild/state/state.jsx +1 -1
- package/target/esbuild/state/style.jsx +1 -1
- package/target/esbuild/surface/carousel-layout.jsx +1 -1
- package/target/esbuild/surface/carousel.jsx +2 -2
- package/target/esbuild/surface/dialog.jsx +5 -5
- package/target/esbuild/surface/divider.jsx +1 -1
- package/target/esbuild/surface/drag.jsx +1 -1
- package/target/esbuild/surface/gestures.jsx +3 -3
- package/target/esbuild/surface/index.jsx +1 -1
- package/target/esbuild/surface/interactive.jsx +1 -1
- package/target/esbuild/surface/list-patterns.jsx +3 -3
- package/target/esbuild/surface/list.jsx +2 -2
- package/target/esbuild/surface/menu.jsx +3 -3
- package/target/esbuild/surface/scaffold.jsx +7 -7
- package/target/esbuild/surface/sheet.jsx +5 -5
- package/target/esbuild/surface/side-sheet.jsx +2 -2
- package/target/esbuild/surface/slots.jsx +1 -1
- package/target/esbuild/surface/surface.jsx +1 -1
- package/target/esbuild/text/index.jsx +1 -1
- package/target/esbuild/text/text.jsx +2 -2
- package/target/esbuild/text/typography.jsx +1 -1
- package/target/esbuild/text/visually-hidden.css +1 -0
- package/target/esbuild/text/visually-hidden.jsx +1 -0
- package/target/esbuild/util/box-side.jsx +1 -1
- package/target/esbuild/util/debug.jsx +1 -1
- package/target/esbuild/util/dom.jsx +1 -1
- package/target/esbuild/util/environment.jsx +1 -0
- package/target/esbuild/util/event.jsx +1 -1
- package/target/esbuild/util/index.jsx +1 -1
- package/target/esbuild/util/preconditions.jsx +1 -1
- package/target/esbuild/util/reactive.jsx +1 -1
- package/target/node/color.js +1 -0
- package/target/node/shape.js +1 -0
- package/target/tsc/action/base.d.ts +27 -8
- package/target/tsc/action/index.d.ts +3 -1
- package/target/tsc/action/progress-button.css.d.ts +3 -0
- package/target/tsc/action/progress-button.d.ts +46 -0
- package/target/tsc/motion/follow-height.d.ts +51 -0
- package/target/tsc/motion/index.d.ts +7 -3
- package/target/tsc/motion/spring.d.ts +3 -3
- package/target/tsc/shape/index.d.ts +1 -1
- package/target/tsc/shape/material-shapes.d.ts +56 -0
- package/target/tsc/shape/path.d.ts +16 -0
- package/target/tsc/text/index.d.ts +5 -2
- package/target/tsc/text/visually-hidden.css.d.ts +3 -0
- package/target/tsc/text/visually-hidden.d.ts +33 -0
- package/target/tsc/util/environment.d.ts +14 -0
- package/target/tsc/util/index.d.ts +2 -1
- package/target/tsc/util/preconditions.d.ts +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DomController as K}from"../dom/client";import{assertDebug as O,checkArgument as F,checkState as g,consumeProps as U,deferAfterDelegatedCancellation as q,eventListenerOptionsOf as C}from"../util";import{isLeaveWithin as B}from"../util/event";import{DragState as l,FocusState as u,HoverState as f,PressState as s,highestInteractionStateOf as v,isInteractionState as H,isInteractionStateMask as A,nameOfInteractionState as X,streamInteractionStates as E}from"./state";import{applyRipple as j}from"./ripple";import{CSS_CLASS_FOCUS_INDICATOR as M,CSS_CLASS_INTERACTABLE as P,CSS_CLASS_STATE_LAYER as x,STATE_LAYER_PSEUDO_ELEMENT as $}from"./style";const z=150,J=350,Q=8,Z="button, input, select, textarea, a[href], [contenteditable]:not([contenteditable=false])",ee={click:s,contextmenu:l|s,focusin:u,focusout:u,keydown:s,keyup:s,lostpointercapture:l|s,pointercancel:l|s,pointerdown:l|s,pointerenter:f,pointerleave:l|f|s,pointermove:l|s,pointerup:l|s},V=Object.keys(ee),W=["click","focusin","keydown","pointerdown","pointerenter"],h=new WeakMap,R=new WeakMap,L=new WeakMap,D=new WeakMap,m=new WeakSet,p=new Set;function I(o){return typeof o=="object"&&o!==null&&o.nodeType===1}function N(o){return o.nodeType===11&&"host"in o}function y(o,e){const t=e?.defaultView?.PointerEvent;return typeof t=="function"&&o instanceof t||o.type.startsWith("pointer")&&"pointerId"in o&&"pointerType"in o}function te(o,e){const t=e?.defaultView?.MouseEvent;return typeof t=="function"&&o instanceof t||"clientX"in o}function ne(o){const e=o.target,t=o.currentTarget;return I(e)?e.ownerDocument:typeof t=="object"&&t!==null&&t.nodeType===9?t:o.composedPath().find(I)?.ownerDocument}function oe(o){const e=o.ownerDocument;return e.defaultView!==null?e:document}function ie(o){const e=[];for(let t=o.getRootNode();N(t);t=t.host.getRootNode())t.mode==="closed"&&e.push(t);return e}function c(o){return D.get(o)??null}function w(o){let e=R.get(o);if(e===void 0){const t=r=>b._maybeHandleTriggerEvent(r),n=C({capture:!0,passive:!1}),i=C({capture:!0,passive:!0});e={handler:t,root:o,subscribers:0},R.set(o,e);for(const r of V)o.addEventListener(r,t,r==="click"?n:i);N(o)&&L.set(o.host,o)}return e.subscribers++,e}function k(o){const e=o.root;if(o.subscribers--,o.subscribers===0){for(const t of V)e.removeEventListener(t,o.handler,!0);R.delete(e),N(e)&&L.delete(e.host)}}function _(o,e){const t=o.ownerDocument,n=e.document;n.root!==t&&(e.document=w(t),k(n)),e.closedRoots.length===0&&o.getRootNode()!==t&&(e.closedRoots=ie(o).map(w))}function re(o,e){const t=C({capture:!0,passive:!1}),n=i=>{o.isConnected&&(G(o,e),_(o,e)),b._maybeHandleTriggerEvent(i)};e.sentinel=n;for(const i of W)o.addEventListener(i,n,t)}function G(o,e){const t=e.sentinel;if(t!==void 0){e.sentinel=void 0;for(const n of W)o.removeEventListener(n,t,!0)}}function se(){for(const o of p){const e=h.get(o);e!==void 0&&(o.isConnected?_(o,e):re(o,e))}p.clear()}function le(o,e){const t=h.get(o);if(t?.controller===e)return;t!==void 0&&Y(o,t.controller);const n={closedRoots:[],controller:e,document:w(oe(o))};if(h.set(o,n),o.isConnected){_(o,n);return}p.size===0&&queueMicrotask(se),p.add(o)}function Y(o,e){const t=h.get(o);if(t?.controller===e){h.delete(o),p.delete(o),G(o,t),k(t.document);for(const n of t.closedRoots)k(n)}}function ae(o,e){for(let t=0;t<o.length;t++){const n=o[t];if(!I(n))continue;const i=h.get(n),r=L.get(n);if(i!==void 0)return{controller:i.controller,element:n};if(!e)return;if(r!==void 0&&o[t-1]!==r)return null;if(n.matches(Z))return}}function ue(o){return o.ownerDocument.defaultView?.matchMedia("(any-hover: hover)").matches===!0}function S(o){const e=v(o)??0;return e===s?e|(v(o&~s)??0):e}function ce(o){return"transitionProperty"in o&&o.transitionProperty==="color"&&o.effect?.pseudoElement===$}class b extends K{#p;#E;#m;#y;#S;#I;#g;#P;#a;#o;#n;#s;#d;#u;#e;#l;constructor(e,t){super(e,t),{onClick:this.#p,onFocusIn:this.#E,onFocusOut:this.#m,onInteractionStateEntered:this.#I,onInteractionStateExited:this.#g,onPointerEnter:this.#y,onPointerLeave:this.#S}=U(e,[],["onClick","onFocusIn","onFocusOut","onInteractionStateEntered","onInteractionStateExited","onPointerEnter","onPointerLeave"]),this.#P=t?.baseInteractionCssClassName??"cw-interactable",this.#a=(t?.noPressRipple?1:0)|(t?.noFocusIndicator?2:0)|([this.#p,this.#E,this.#m,this.#y,this.#S].some(n=>n!==void 0)?8:0),this.#o=t?.enabledInteractionStates??0,this.#n=0,F(A(this.#o))}#c(e){return(this.#a&e)===e}get isControllerDisposed(){return this.#c(16)}#w(e){const t=this.#c(e);return this.#a|=e,t}isPressRippleDisabled(){return this.#c(1)}isFocusIndicatorDisabled(){return this.#c(2)}#C(e){return`${this.#P}-${X(e)}`}get enabledInteractionStates(){return this.#o}get enteredInteractionStates(){return this.#n}isInteractionStateEnabled(e){return O(H(e)),(this.#o&e)===e}isInteractionStateEntered(e){return O(H(e)),(this.#n&e)===e}#f(e,t){const n=this;t!==null&&Y(t,n),!(e===null||this.isControllerDisposed||this.#o===0&&!this.#c(8))&&(le(e,n),e.isConnected&&queueMicrotask(()=>this.#v(this.#o)))}#k(e){const t=this.#c(8),n=super.styleElement?.classList;e?(n?.add(P),t||(this.#f(super.styleElement,null),this.#f(super.functionElement,null))):(n?.remove(P,x),this.#a&=-5,t||(this.#f(null,super.styleElement),this.#f(null,super.functionElement)))}setEnabledInteractionStates(e){const t=this.#o,n=this.#e;if(!(this.isControllerDisposed||t===e)){F(A(e)),this.#o=e,(e&s)===0&&(this.#l=void 0),n!==void 0&&(e&(n.dragStarted===!0?l:s))===0&&this.#t(!0);for(const i of E(this.#n&~e))this.#r(i,!0);t!==0!=(e!==0)&&this.#k(e!==0),this.#v(e&~t)}}#v(e){const t=super.styleElement,n=super.functionElement,i=(e&f)!==0&&t!==null&&t.matches(":hover")&&ue(t),r=(e&u)!==0&&I(n)&&n.matches(":focus-visible");if(!(this.isControllerDisposed||!i&&!r)){for(const a of this.#b())ce(a)&&a.finish();i&&this.#i(f),r&&this.#i(u)}}#b(){const e=super.styleElement;return e===null||typeof e.getAnimations!="function"?[]:e.getAnimations({subtree:!0}).filter(t=>{const n=t.effect;return n!==null&&n.target===e&&Number.isFinite(Number(n.getComputedTiming().endTime))&&t.playbackRate!==0&&t.playState!=="paused"})}#L(){this.#u?.cancel(),this.#u=void 0}#R(e,t,n){for(const i of E(t&~n))e.classList.remove(this.#C(i));for(const i of E(n&~t))e.classList.add(this.#C(i))}#i(e,t){if(this.#s?.(),this.isControllerDisposed||(e&this.#o&~this.#n)!==e)return;const n=super.styleElement,i=S(this.#n),r=S(this.#n|e);let a;if(g(n!==null,"interaction state requires a style element"),this.#n|=e,e===u&&!this.isFocusIndicatorDisabled()&&n.classList.add(M),(r&e)===0){this.#I?.(e,this,t);return}e===s&&(a=this.#b()),this.#w(4)||n.classList.add(x),this.#R(n,i,r),a!==void 0?(this.#d=Promise.allSettled(this.#b().filter(d=>!a.includes(d)).map(d=>d.finished)),this.isPressRippleDisabled()||(this.#u=j(n,this.#e?.position))):(i&~r&s)!==0&&(this.#d=void 0,this.#u?.finish()),this.#I?.(e,this,t)}#N(e,t,n){const i=()=>{this.#s===i&&(this.#s=void 0,this.#r(e,!0,n))};this.#d=void 0,this.#s?.(),this.#s=i,t.then(i)}#r(e,t,n){const i=this.#n,r=i&~e,a=(v(r)??0)<e,d=this.#d,T=super.styleElement;if(this.isInteractionStateEntered(e)){if(e===s&&this.#u?.finish(),a&&e===s&&d!==void 0){if(t!==!0){this.#N(e,d,n);return}this.#d=void 0}a&&this.#s!==void 0&&(this.#s(),!this.isInteractionStateEntered(e))||(g(T!==null,"interaction state requires a style element"),this.#n=r,e===u&&T.classList.remove(M),this.#R(T,S(i),S(r)),this.#g?.(e,this,n))}}#T(e,t){const n=y(e,t),i=c(t);let r=i;if(!this.isControllerDisposed){if(i!==null){if(n&&e.type==="pointerdown"&&i===this.#e&&i.pointerId===e.pointerId)return;i!==this.#e||i.touchTimeoutId===void 0?(i.controller.#t(!0,e),r=null):(t.defaultView?.clearTimeout(i.touchTimeoutId),i.touchTimeoutId=void 0)}if(!this.isControllerDisposed){if(r??=this.#_(e,t),r.position===void 0&&te(e,t)&&(e.type!=="click"||n&&e.pointerType!=="")&&(r.position=[e.clientX,e.clientY]),!n){this.#i(s,e);return}if(r.pointerId=e.pointerId,r.pointerType=e.pointerType,e.type==="pointerdown"&&!this.isInteractionStateEnabled(s)){this.isInteractionStateEnabled(l)||this.#t(!0,e);return}if(e.type==="click"||e.pointerType!=="touch"||t.defaultView===null){this.#i(s,e);return}this.#O(r,e)}}}#_(e,t){const n=t.defaultView,i={controller:this,document:t,keyboard:e.type==="keydown"};if(D.set(t,i),this.#e=i,i.keyboard&&n!==null){const r=()=>{this.#e===i&&this.#t(!0)};n.addEventListener("blur",r),i.removeBlurListener=()=>n.removeEventListener("blur",r)}return i}#O(e,t){const n=e.document.defaultView?.setTimeout(()=>{c(e.document)!==e||e.touchTimeoutId!==n||e.dragStarted===!0||(e.touchTimeoutId=void 0,this.#i(s,t))},z);e.touchTimeoutId=n}#F(e,t){const n=super.styleElement,i=e.position;if(!(e.dragStarted===!0||i===void 0||!this.isInteractionStateEnabled(l)||(t.clientX-i[0])**2+(t.clientY-i[1])**2<Q**2)&&(e.touchTimeoutId!==void 0&&(e.document.defaultView?.clearTimeout(e.touchTimeoutId),e.touchTimeoutId=void 0),e.dragStarted=!0,this.#i(l,t),!(this.#e!==e||n===null||!n.isConnected)))try{n.setPointerCapture(t.pointerId),e.pointerCaptureElement=n}catch{}}#H(e,t){if(this.#r(l,!1,t),!(this.isControllerDisposed||this.#e!==e)){if(!this.isInteractionStateEntered(s)){this.#t(!0,t);return}this.#D(e,t)}}#A(e,t){(t.type!=="lostpointercapture"||e.releaseTimeoutId===void 0)&&this.#t(!0,t)}#D(e,t){const n=e.document.defaultView?.setTimeout(()=>{c(e.document)===e&&e.releaseTimeoutId===n&&(e.releaseTimeoutId=void 0,this.#t(!0,t))},e.pointerType==="touch"?J:0);this.#u?.finish(),n===void 0?this.#t(!0,t):e.releaseTimeoutId=n}#t(e,t){const n=this.#e,i=n?.document.defaultView,r=n?.pointerCaptureElement;if(g(n!==void 0,"controller owns no press"),D.delete(n.document),this.#e=void 0,this.#l=void 0,n.removeBlurListener?.(),r!==void 0&&n.pointerId!==void 0)try{r.hasPointerCapture(n.pointerId)&&r.releasePointerCapture(n.pointerId)}catch{}n.releaseTimeoutId!==void 0&&i?.clearTimeout(n.releaseTimeoutId),this.#r(l,e??!0,t),n.touchTimeoutId!==void 0?i?.clearTimeout(n.touchTimeoutId):this.#r(s,e??!0,t)}onEvent(e){e.type==="click"?this.#p?.(e,this):e.type==="focusin"?this.#E?.(e,this):e.type==="focusout"?this.#m?.(e,this):e.type==="pointerenter"?this.#y?.(e,this):e.type==="pointerleave"&&this.#S?.(e,this)}#M(e,t,n){if(!this.isControllerDisposed){switch(e.type){case"click":this.#x(e,n);return;case"focusin":case"focusout":this.#V(e,t);return;case"keydown":case"keyup":this.#W(e,t);return}y(e,n)&&e.isPrimary&&this.#G(e,t,n)}}#x(e,t){let n;this.onEvent(e),this.isInteractionStateEnabled(s)&&(n=c(t),(n===null||n===this.#e&&n.touchTimeoutId!==void 0)&&(this.#T(e,t),n=c(t)),n!==null&&n.controller.#t(!1,e))}#V(e,t){if(t===super.functionElement){if(e.type==="focusin"){this.onEvent(e),t.matches(":focus-visible")&&this.#i(u,e);return}this.#l=void 0,this.#e?.keyboard===!0&&this.#t(!0,e),this.onEvent(e),this.#r(u,!1,e)}}#W(e,t){const n=this.#e;if(!(t!==super.functionElement||t.localName!=="button")){if(e.type==="keyup"){this.#l=void 0,n?.keyboard===!0&&this.#D(n,e);return}e.repeat||e.isComposing||!this.isInteractionStateEnabled(s)||(this.#l=e,q(e,t,()=>{this.#l===e&&!this.isControllerDisposed&&!e.defaultPrevented&&t===super.functionElement&&t.matches(":focus:enabled")&&this.isInteractionStateEnabled(s)&&this.#T(e,t.ownerDocument)},!1))}}#G(e,t,n){const i=e.pointerType==="touch",r=this.#e;if(e.type==="pointerdown"){(this.isInteractionStateEnabled(s)||this.isInteractionStateEnabled(l))&&(i||e.buttons===1)&&this.#T(e,n);return}if(!(i||t!==super.styleElement)&&!(e.type==="pointerleave"&&B(e,t))){if(this.onEvent(e),e.type==="pointerenter"){this.#i(f,e);return}this.#r(f,!1,e),r!==void 0&&r.pointerId===e.pointerId&&r.dragStarted!==!0&&r.releaseTimeoutId===void 0&&this.#t(!0,e)}}static#Y(e,t){const n=c(t);if(n!==null){if(e.type==="contextmenu"){m.add(e),n.controller.#t(!0,e);return}!y(e,t)||!e.isPrimary||e.pointerId!==n.pointerId||(m.add(e),e.type==="pointermove"?n.controller.#F(n,e):e.type==="pointerup"?n.controller.#H(n,e):n.controller.#A(n,e))}}static _maybeHandleTriggerEvent(e){const t=ne(e);if(t===void 0||m.has(e))return;switch(e.type){case"contextmenu":case"lostpointercapture":case"pointercancel":case"pointermove":case"pointerup":b.#Y(e,t);return;case"keydown":case"keyup":if(e.key!==" ")return;break}const n=ae(e.composedPath(),e.type==="click"||e.type==="pointerdown"),i=c(t);if(n!=null){m.add(e),n.controller.#M(e,n.element,t);return}n===void 0&&i!==null&&(e.type==="click"||e.type==="pointerdown")&&(!y(e,t)||i.pointerId===e.pointerId)&&i.controller.#t(!0,e)}#h(e,t){this.#l=void 0,this.#e!==void 0&&this.#t(!0),this.#L();for(const n of E(this.#n))this.#r(n,!0);this.#f(e,t)}onStyleElementChanged(e){this.#a&=-5,e!==null&&this.#o!==0&&e.classList.add(P),this.#h(e,super.styleElement)}onFunctionElementChanged(e){super.isFunctionElementStyle()||this.#h(e,super.functionElement)}onControllerCleanup(){this.isControllerDisposed||(this.#a|=16,this.#h(null,super.styleElement),super.isFunctionElementStyle()||this.#h(null,super.functionElement),super.onControllerCleanup())}}export{b as InteractableController};
|
|
1
|
+
import{DomController as K}from"../dom/client";import{assertDebug as O,checkArgument as F,checkState as g,consumeProps as U,deferAfterDelegatedCancellation as q,eventListenerOptionsOf as C}from"../util";import{isLeaveWithin as B}from"../util/event";import{DragState as l,FocusState as u,HoverState as f,PressState as s,highestInteractionStateOf as v,isInteractionState as H,isInteractionStateMask as A,nameOfInteractionState as X,streamInteractionStates as E}from"./state";import{applyRipple as j}from"./ripple";import{CSS_CLASS_FOCUS_INDICATOR as M,CSS_CLASS_INTERACTABLE as P,CSS_CLASS_STATE_LAYER as x,STATE_LAYER_PSEUDO_ELEMENT as $}from"./style";const z=150,J=350,Q=8,Z="button, input, select, textarea, a[href], [contenteditable]:not([contenteditable=false])",ee={click:s,contextmenu:l|s,focusin:u,focusout:u,keydown:s,keyup:s,lostpointercapture:l|s,pointercancel:l|s,pointerdown:l|s,pointerenter:f,pointerleave:l|f|s,pointermove:l|s,pointerup:l|s},V=Object.keys(ee),W=["click","focusin","keydown","pointerdown","pointerenter"],h=/* @__PURE__ */new WeakMap(),R=/* @__PURE__ */new WeakMap(),L=/* @__PURE__ */new WeakMap(),D=/* @__PURE__ */new WeakMap(),m=/* @__PURE__ */new WeakSet(),p=/* @__PURE__ */new Set();function I(o){return typeof o=="object"&&o!==null&&o.nodeType===1;}function N(o){return o.nodeType===11&&"host"in o;}function y(o,e){const t=e?.defaultView?.PointerEvent;return typeof t=="function"&&o instanceof t||o.type.startsWith("pointer")&&"pointerId"in o&&"pointerType"in o;}function te(o,e){const t=e?.defaultView?.MouseEvent;return typeof t=="function"&&o instanceof t||"clientX"in o;}function ne(o){const e=o.target,t=o.currentTarget;return I(e)?e.ownerDocument:typeof t=="object"&&t!==null&&t.nodeType===9?t:o.composedPath().find(I)?.ownerDocument;}function oe(o){const e=o.ownerDocument;return e.defaultView!==null?e:document;}function ie(o){const e=[];for(let t=o.getRootNode();N(t);t=t.host.getRootNode())t.mode==="closed"&&e.push(t);return e;}function c(o){return D.get(o)??null;}function w(o){let e=R.get(o);if(e===void 0){const t=r=>b._maybeHandleTriggerEvent(r),n=C({capture:!0,passive:!1}),i=C({capture:!0,passive:!0});e={handler:t,root:o,subscribers:0},R.set(o,e);for(const r of V)o.addEventListener(r,t,r==="click"?n:i);N(o)&&L.set(o.host,o);}return e.subscribers++,e;}function k(o){const e=o.root;if(o.subscribers--,o.subscribers===0){for(const t of V)e.removeEventListener(t,o.handler,!0);R.delete(e),N(e)&&L.delete(e.host);}}function _(o,e){const t=o.ownerDocument,n=e.document;n.root!==t&&(e.document=w(t),k(n)),e.closedRoots.length===0&&o.getRootNode()!==t&&(e.closedRoots=ie(o).map(w));}function re(o,e){const t=C({capture:!0,passive:!1}),n=i=>{o.isConnected&&(G(o,e),_(o,e)),b._maybeHandleTriggerEvent(i);};e.sentinel=n;for(const i of W)o.addEventListener(i,n,t);}function G(o,e){const t=e.sentinel;if(t!==void 0){e.sentinel=void 0;for(const n of W)o.removeEventListener(n,t,!0);}}function se(){for(const o of p){const e=h.get(o);e!==void 0&&(o.isConnected?_(o,e):re(o,e));}p.clear();}function le(o,e){const t=h.get(o);if(t?.controller===e)return;t!==void 0&&Y(o,t.controller);const n={closedRoots:[],controller:e,document:w(oe(o))};if(h.set(o,n),o.isConnected){_(o,n);return;}p.size===0&&queueMicrotask(se),p.add(o);}function Y(o,e){const t=h.get(o);if(t?.controller===e){h.delete(o),p.delete(o),G(o,t),k(t.document);for(const n of t.closedRoots)k(n);}}function ae(o,e){for(let t=0;t<o.length;t++){const n=o[t];if(!I(n))continue;const i=h.get(n),r=L.get(n);if(i!==void 0)return{controller:i.controller,element:n};if(!e)return;if(r!==void 0&&o[t-1]!==r)return null;if(n.matches(Z))return;}}function ue(o){return o.ownerDocument.defaultView?.matchMedia("(any-hover: hover)").matches===!0;}function S(o){const e=v(o)??0;return e===s?e|(v(o&~s)??0):e;}function ce(o){return"transitionProperty"in o&&o.transitionProperty==="color"&&o.effect?.pseudoElement===$;}class b extends K{#p;#E;#m;#y;#S;#I;#g;#P;#a;#o;#n;#s;#d;#u;#e;#l;constructor(e,t){super(e,t),{onClick:this.#p,onFocusIn:this.#E,onFocusOut:this.#m,onInteractionStateEntered:this.#I,onInteractionStateExited:this.#g,onPointerEnter:this.#y,onPointerLeave:this.#S}=U(e,[],["onClick","onFocusIn","onFocusOut","onInteractionStateEntered","onInteractionStateExited","onPointerEnter","onPointerLeave"]),this.#P=t?.baseInteractionCssClassName??"cw-interactable",this.#a=(t?.noPressRipple?1:0)|(t?.noFocusIndicator?2:0)|([this.#p,this.#E,this.#m,this.#y,this.#S].some(n=>n!==void 0)?8:0),this.#o=t?.enabledInteractionStates??0,this.#n=0,F(A(this.#o));}#c(e){return(this.#a&e)===e;}get isControllerDisposed(){return this.#c(16);}#w(e){const t=this.#c(e);return this.#a|=e,t;}isPressRippleDisabled(){return this.#c(1);}isFocusIndicatorDisabled(){return this.#c(2);}#C(e){return`${this.#P}-${X(e)}`;}get enabledInteractionStates(){return this.#o;}get enteredInteractionStates(){return this.#n;}isInteractionStateEnabled(e){return O(H(e)),(this.#o&e)===e;}isInteractionStateEntered(e){return O(H(e)),(this.#n&e)===e;}#f(e,t){const n=this;t!==null&&Y(t,n),!(e===null||this.isControllerDisposed||this.#o===0&&!this.#c(8))&&(le(e,n),e.isConnected&&queueMicrotask(()=>this.#v(this.#o)));}#k(e){const t=this.#c(8),n=super.styleElement?.classList;e?(n?.add(P),t||(this.#f(super.styleElement,null),this.#f(super.functionElement,null))):(n?.remove(P,x),this.#a&=-5,t||(this.#f(null,super.styleElement),this.#f(null,super.functionElement)));}setEnabledInteractionStates(e){const t=this.#o,n=this.#e;if(!(this.isControllerDisposed||t===e)){F(A(e)),this.#o=e,(e&s)===0&&(this.#l=void 0),n!==void 0&&(e&(n.dragStarted===!0?l:s))===0&&this.#t(!0);for(const i of E(this.#n&~e))this.#r(i,!0);t!==0!=(e!==0)&&this.#k(e!==0),this.#v(e&~t);}}#v(e){const t=super.styleElement,n=super.functionElement,i=(e&f)!==0&&t!==null&&t.matches(":hover")&&ue(t),r=(e&u)!==0&&I(n)&&n.matches(":focus-visible");if(!(this.isControllerDisposed||!i&&!r)){for(const a of this.#b())ce(a)&&a.finish();i&&this.#i(f),r&&this.#i(u);}}#b(){const e=super.styleElement;return e===null||typeof e.getAnimations!="function"?[]:e.getAnimations({subtree:!0}).filter(t=>{const n=t.effect;return n!==null&&n.target===e&&Number.isFinite(Number(n.getComputedTiming().endTime))&&t.playbackRate!==0&&t.playState!=="paused";});}#L(){this.#u?.cancel(),this.#u=void 0;}#R(e,t,n){for(const i of E(t&~n))e.classList.remove(this.#C(i));for(const i of E(n&~t))e.classList.add(this.#C(i));}#i(e,t){if(this.#s?.(),this.isControllerDisposed||(e&this.#o&~this.#n)!==e)return;const n=super.styleElement,i=S(this.#n),r=S(this.#n|e);let a;if(g(n!==null,"interaction state requires a style element"),this.#n|=e,e===u&&!this.isFocusIndicatorDisabled()&&n.classList.add(M),(r&e)===0){this.#I?.(e,this,t);return;}e===s&&(a=this.#b()),this.#w(4)||n.classList.add(x),this.#R(n,i,r),a!==void 0?(this.#d=Promise.allSettled(this.#b().filter(d=>!a.includes(d)).map(d=>d.finished)),this.isPressRippleDisabled()||(this.#u=j(n,this.#e?.position))):(i&~r&s)!==0&&(this.#d=void 0,this.#u?.finish()),this.#I?.(e,this,t);}#N(e,t,n){const i=()=>{this.#s===i&&(this.#s=void 0,this.#r(e,!0,n));};this.#d=void 0,this.#s?.(),this.#s=i,t.then(i);}#r(e,t,n){const i=this.#n,r=i&~e,a=(v(r)??0)<e,d=this.#d,T=super.styleElement;if(this.isInteractionStateEntered(e)){if(e===s&&this.#u?.finish(),a&&e===s&&d!==void 0){if(t!==!0){this.#N(e,d,n);return;}this.#d=void 0;}a&&this.#s!==void 0&&(this.#s(),!this.isInteractionStateEntered(e))||(g(T!==null,"interaction state requires a style element"),this.#n=r,e===u&&T.classList.remove(M),this.#R(T,S(i),S(r)),this.#g?.(e,this,n));}}#T(e,t){const n=y(e,t),i=c(t);let r=i;if(!this.isControllerDisposed){if(i!==null){if(n&&e.type==="pointerdown"&&i===this.#e&&i.pointerId===e.pointerId)return;i!==this.#e||i.touchTimeoutId===void 0?(i.controller.#t(!0,e),r=null):(t.defaultView?.clearTimeout(i.touchTimeoutId),i.touchTimeoutId=void 0);}if(!this.isControllerDisposed){if(r??=this.#_(e,t),r.position===void 0&&te(e,t)&&(e.type!=="click"||n&&e.pointerType!=="")&&(r.position=[e.clientX,e.clientY]),!n){this.#i(s,e);return;}if(r.pointerId=e.pointerId,r.pointerType=e.pointerType,e.type==="pointerdown"&&!this.isInteractionStateEnabled(s)){this.isInteractionStateEnabled(l)||this.#t(!0,e);return;}if(e.type==="click"||e.pointerType!=="touch"||t.defaultView===null){this.#i(s,e);return;}this.#O(r,e);}}}#_(e,t){const n=t.defaultView,i={controller:this,document:t,keyboard:e.type==="keydown"};if(D.set(t,i),this.#e=i,i.keyboard&&n!==null){const r=()=>{this.#e===i&&this.#t(!0);};n.addEventListener("blur",r),i.removeBlurListener=()=>n.removeEventListener("blur",r);}return i;}#O(e,t){const n=e.document.defaultView?.setTimeout(()=>{c(e.document)!==e||e.touchTimeoutId!==n||e.dragStarted===!0||(e.touchTimeoutId=void 0,this.#i(s,t));},z);e.touchTimeoutId=n;}#F(e,t){const n=super.styleElement,i=e.position;if(!(e.dragStarted===!0||i===void 0||!this.isInteractionStateEnabled(l)||(t.clientX-i[0])**2+(t.clientY-i[1])**2<Q**2)&&(e.touchTimeoutId!==void 0&&(e.document.defaultView?.clearTimeout(e.touchTimeoutId),e.touchTimeoutId=void 0),e.dragStarted=!0,this.#i(l,t),!(this.#e!==e||n===null||!n.isConnected)))try{n.setPointerCapture(t.pointerId),e.pointerCaptureElement=n;}catch{}}#H(e,t){if(this.#r(l,!1,t),!(this.isControllerDisposed||this.#e!==e)){if(!this.isInteractionStateEntered(s)){this.#t(!0,t);return;}this.#D(e,t);}}#A(e,t){(t.type!=="lostpointercapture"||e.releaseTimeoutId===void 0)&&this.#t(!0,t);}#D(e,t){const n=e.document.defaultView?.setTimeout(()=>{c(e.document)===e&&e.releaseTimeoutId===n&&(e.releaseTimeoutId=void 0,this.#t(!0,t));},e.pointerType==="touch"?J:0);this.#u?.finish(),n===void 0?this.#t(!0,t):e.releaseTimeoutId=n;}#t(e,t){const n=this.#e,i=n?.document.defaultView,r=n?.pointerCaptureElement;if(g(n!==void 0,"controller owns no press"),D.delete(n.document),this.#e=void 0,this.#l=void 0,n.removeBlurListener?.(),r!==void 0&&n.pointerId!==void 0)try{r.hasPointerCapture(n.pointerId)&&r.releasePointerCapture(n.pointerId);}catch{}n.releaseTimeoutId!==void 0&&i?.clearTimeout(n.releaseTimeoutId),this.#r(l,e??!0,t),n.touchTimeoutId!==void 0?i?.clearTimeout(n.touchTimeoutId):this.#r(s,e??!0,t);}onEvent(e){e.type==="click"?this.#p?.(e,this):e.type==="focusin"?this.#E?.(e,this):e.type==="focusout"?this.#m?.(e,this):e.type==="pointerenter"?this.#y?.(e,this):e.type==="pointerleave"&&this.#S?.(e,this);}#M(e,t,n){if(!this.isControllerDisposed){switch(e.type){case"click":this.#x(e,n);return;case"focusin":case"focusout":this.#V(e,t);return;case"keydown":case"keyup":this.#W(e,t);return;}y(e,n)&&e.isPrimary&&this.#G(e,t,n);}}#x(e,t){let n;this.onEvent(e),this.isInteractionStateEnabled(s)&&(n=c(t),(n===null||n===this.#e&&n.touchTimeoutId!==void 0)&&(this.#T(e,t),n=c(t)),n!==null&&n.controller.#t(!1,e));}#V(e,t){if(t===super.functionElement){if(e.type==="focusin"){this.onEvent(e),t.matches(":focus-visible")&&this.#i(u,e);return;}this.#l=void 0,this.#e?.keyboard===!0&&this.#t(!0,e),this.onEvent(e),this.#r(u,!1,e);}}#W(e,t){const n=this.#e;if(!(t!==super.functionElement||t.localName!=="button")){if(e.type==="keyup"){this.#l=void 0,n?.keyboard===!0&&this.#D(n,e);return;}e.repeat||e.isComposing||!this.isInteractionStateEnabled(s)||(this.#l=e,q(e,t,()=>{this.#l===e&&!this.isControllerDisposed&&!e.defaultPrevented&&t===super.functionElement&&t.matches(":focus:enabled")&&this.isInteractionStateEnabled(s)&&this.#T(e,t.ownerDocument);},!1));}}#G(e,t,n){const i=e.pointerType==="touch",r=this.#e;if(e.type==="pointerdown"){(this.isInteractionStateEnabled(s)||this.isInteractionStateEnabled(l))&&(i||e.buttons===1)&&this.#T(e,n);return;}if(!(i||t!==super.styleElement)&&!(e.type==="pointerleave"&&B(e,t))){if(this.onEvent(e),e.type==="pointerenter"){this.#i(f,e);return;}this.#r(f,!1,e),r!==void 0&&r.pointerId===e.pointerId&&r.dragStarted!==!0&&r.releaseTimeoutId===void 0&&this.#t(!0,e);}}static#Y(e,t){const n=c(t);if(n!==null){if(e.type==="contextmenu"){m.add(e),n.controller.#t(!0,e);return;}!y(e,t)||!e.isPrimary||e.pointerId!==n.pointerId||(m.add(e),e.type==="pointermove"?n.controller.#F(n,e):e.type==="pointerup"?n.controller.#H(n,e):n.controller.#A(n,e));}}static _maybeHandleTriggerEvent(e){const t=ne(e);if(t===void 0||m.has(e))return;switch(e.type){case"contextmenu":case"lostpointercapture":case"pointercancel":case"pointermove":case"pointerup":b.#Y(e,t);return;case"keydown":case"keyup":if(e.key!==" ")return;break;}const n=ae(e.composedPath(),e.type==="click"||e.type==="pointerdown"),i=c(t);if(n!=null){m.add(e),n.controller.#M(e,n.element,t);return;}n===void 0&&i!==null&&(e.type==="click"||e.type==="pointerdown")&&(!y(e,t)||i.pointerId===e.pointerId)&&i.controller.#t(!0,e);}#h(e,t){this.#l=void 0,this.#e!==void 0&&this.#t(!0),this.#L();for(const n of E(this.#n))this.#r(n,!0);this.#f(e,t);}onStyleElementChanged(e){this.#a&=-5,e!==null&&this.#o!==0&&e.classList.add(P),this.#h(e,super.styleElement);}onFunctionElementChanged(e){super.isFunctionElementStyle()||this.#h(e,super.functionElement);}onControllerCleanup(){this.isControllerDisposed||(this.#a|=16,this.#h(null,super.styleElement),super.isFunctionElementStyle()||this.#h(null,super.functionElement),super.onControllerCleanup());}}export{b as InteractableController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineInteractableComponent as a}from"./component";import{DragState as r,FocusState as o,HoverState as c,PressState as l,isInteractionState as p,isInteractionStateMask as I,nameOfInteractionState as i}from"./state";export{r as DragState,o as FocusState,c as HoverState,l as PressState,a as defineInteractableComponent,p as isInteractionState,I as isInteractionStateMask,i as nameOfInteractionState};
|
|
1
|
+
import{defineInteractableComponent as a}from"./component";import{DragState as r,FocusState as o,HoverState as c,PressState as l,isInteractionState as p,isInteractionStateMask as I,nameOfInteractionState as i}from"./state";export{r as DragState,o as FocusState,c as HoverState,l as PressState,a as defineInteractableComponent,p as isInteractionState,I as isInteractionStateMask,i as nameOfInteractionState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyMotion as p}from"../motion";import{checkState as x,printDebug as w}from"../util";import{CSS_CLASS_RIPPLE as I,STATE_LAYER_PSEUDO_ELEMENT as d}from"./style";const N=75,E=225,D=150,M="cubic-bezier(0.4, 0, 0.2, 1)",_
|
|
1
|
+
import{applyMotion as p}from"../motion";import{checkState as x,printDebug as w}from"../util";import{CSS_CLASS_RIPPLE as I,STATE_LAYER_PSEUDO_ELEMENT as d}from"./style";const N=75,E=225,D=150,M="cubic-bezier(0.4, 0, 0.2, 1)",_=0.3,b="calc(50% + 10px)",O="--cw-interactable-ripple-color",W="--cw-interactable-ripple-opacity",B="--cw-interactable-ripple-radius",g=[{color:"--_CW-INTERACTABLE-RIPPLE1_COLOR",radius:"--_CW-INTERACTABLE-RIPPLE1_RADIUS",x:"--_CW-INTERACTABLE-RIPPLE1_X",y:"--_CW-INTERACTABLE-RIPPLE1_Y"},{color:"--_CW-INTERACTABLE-RIPPLE2_COLOR",radius:"--_CW-INTERACTABLE-RIPPLE2_RADIUS",x:"--_CW-INTERACTABLE-RIPPLE2_X",y:"--_CW-INTERACTABLE-RIPPLE2_Y"}],u=/* @__PURE__ */new WeakMap();class v{#e;layer;#o;#i;#t;#n;constructor(t,n,o){this.#e=t,this.layer=n,this.#o=o.color,this.#i=y(t.ownerDocument),this.#t=[p(t,[{[n.radius]:`${o.radius}px`,offset:0},{[n.radius]:o.end,offset:1}],{duration:E,easing:M,fill:"forwards",pseudoElement:d}),p(t,[{[n.x]:o.x,[n.y]:o.y,offset:0},{[n.x]:"50%",[n.y]:"50%",offset:1}],{duration:E,fill:"forwards",pseudoElement:d}),p(t,[{[n.color]:"transparent",offset:0},{[n.color]:o.color,offset:1}],{duration:N,fill:"forwards",pseudoElement:d})],this.#n=!1;}finish(){if(this.#n)return;const t=p(this.#e,[{[this.layer.color]:this.#o,offset:0},{[this.layer.color]:"transparent",offset:1}],{duration:D,fill:"both",pseudoElement:d,startDelay:Math.max(0,E-(y(this.#e.ownerDocument)-this.#i))});this.#n=!0,this.#t.push(t),t.finished.then(()=>this.cancel(),()=>{});}cancel(){const t=u.get(this.#e);this.#n=!0;for(const n of this.#t)n.finished.catch(()=>{}),n.cancel();this.#t.length=0,t?.includes(this)===!0&&(t.splice(t.indexOf(this),1),t.length===0&&(u.delete(this.#e),this.#e.classList.remove(I)));}}function y(e){const t=e.timeline.currentTime;return typeof t=="number"?t:0;}function i(e,t=0){const n=Number.parseFloat(e);return Number.isFinite(n)?n:t;}function R(e,t){return e.boxSizing==="border-box"?[i(e.width,t[0]),i(e.height,t[1])]:[i(e.width,t[0])+i(e.paddingLeft)+i(e.paddingRight)+i(e.borderLeftWidth)+i(e.borderRightWidth),i(e.height,t[1])+i(e.paddingTop)+i(e.paddingBottom)+i(e.borderTopWidth)+i(e.borderBottomWidth)];}function U(e,t){const n=e.ownerDocument.defaultView;x(n!==null,"element owner document has no browsing context");const o=n.getComputedStyle(e),r=n.getComputedStyle(e,d),a=o.getPropertyValue(O).trim(),h=i(o.getPropertyValue(W)),m=`rgb(from ${a==="currentcolor"?o.color:a} r g b / calc(alpha * ${h}))`,f=i(o.getPropertyValue(B),NaN);if(t===void 0||Number.isFinite(f)){const[S,C]=R(r,[0,0]);return{color:m,end:Number.isFinite(f)?`${f}px`:b,radius:_*Math.max(S,C),x:"50%",y:"50%"};}const s=e.getBoundingClientRect(),[P,L]=R(o,[s.width,s.height]),[c,l]=R(r,[P,L]),T=(t[0]-s.left)*(s.width===0?1:P/s.width)-i(o.borderLeftWidth)-i(r.left),A=(t[1]-s.top)*(s.height===0?1:L/s.height)-i(o.borderTopWidth)-i(r.top);return{color:m,end:b,radius:_*Math.max(c,l),x:`${c===0?50:Math.max(0,Math.min(c,T))/c*100}%`,y:`${l===0?50:Math.max(0,Math.min(l,A))/l*100}%`};}function V(e,t){const n=u.get(e)??[];let o;try{const r=U(e,t);for(const a of n)a.finish();n.length===g.length&&n[0].cancel(),o=new v(e,g.find(a=>n.every(h=>h.layer!==a)),r);}catch(r){w("failed to enter ripple motion",r);return;}return n.push(o),u.set(e,n),e.classList.add(I),o;}export{V as applyRipple};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertDebug as i}from"../util";const c=1,u=2,f=4,S=8,n=S|u|c|f,s=["hover","focus","press","drag"];function r(t){return 31-Math.clz32(t>>>0)}function o(t){if(t<0)return;const e=1<<Math.min(t,31);return(e&n)===e?e:void 0}function d(t){return t!==0&&(t&n)===t&&(t&t-1)===0}function x(t){return(t&n)===t}function b(t){const e=r(t);return i(d(t)&&e>=0&&e<=3),s[e]}function a(t){return o(r(t>>>0&-(t>>>0)))}function m(t){return o(r(t))}function p(t,e){return a(t&~(e|e-1))}function*y(t){for(let e=a(t);e!==void 0&&!(yield e);e=p(t,e));}export{S as DragState,u as FocusState,c as HoverState,f as PressState,m as highestInteractionStateOf,d as isInteractionState,x as isInteractionStateMask,a as lowestInteractionStateOf,b as nameOfInteractionState,p as nextInteractionStateOf,y as streamInteractionStates};
|
|
1
|
+
import{assertDebug as i}from"../util";const c=1,u=2,f=4,S=8,n=S|u|c|f,s=["hover","focus","press","drag"];function r(t){return 31-Math.clz32(t>>>0);}function o(t){if(t<0)return;const e=1<<Math.min(t,31);return(e&n)===e?e:void 0;}function d(t){return t!==0&&(t&n)===t&&(t&t-1)===0;}function x(t){return(t&n)===t;}function b(t){const e=r(t);return i(d(t)&&e>=0&&e<=3),s[e];}function a(t){return o(r(t>>>0&-(t>>>0)));}function m(t){return o(r(t));}function p(t,e){return a(t&~(e|e-1));}function*y(t){for(let e=a(t);e!==void 0&&!(yield e);e=p(t,e));}export{S as DragState,u as FocusState,c as HoverState,f as PressState,m as highestInteractionStateOf,d as isInteractionState,x as isInteractionStateMask,a as lowestInteractionStateOf,b as nameOfInteractionState,p as nextInteractionStateOf,y as streamInteractionStates};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="::before",S="cw-interactable",e="_cw-interactable-stateLayer",_="_cw-interactable-focusIndicator",c="_cw-interactable-ripple";export{_ as CSS_CLASS_FOCUS_INDICATOR,S as CSS_CLASS_INTERACTABLE,c as CSS_CLASS_RIPPLE,e as CSS_CLASS_STATE_LAYER,t as STATE_LAYER_PSEUDO_ELEMENT};
|
|
1
|
+
const t="::before",S="cw-interactable",e="_cw-interactable-stateLayer",_="_cw-interactable-focusIndicator",c="_cw-interactable-ripple";export{_ as CSS_CLASS_FOCUS_INDICATOR,S as CSS_CLASS_INTERACTABLE,c as CSS_CLASS_RIPPLE,e as CSS_CLASS_STATE_LAYER,t as STATE_LAYER_PSEUDO_ELEMENT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function X(e,n,o){return Math.min(o,Math.max(n,e))}function M(e,n,o){return e+(n-e)*o}function C(e,n,o,t,r){return r<=o?e:r>=t?n:e+(n-e)*((r-o)/(t-o))}function x(e){if(e>=4294967296)throw new RangeError("invalid keyline count");return Math.max(0,Math.trunc(e)||0)}function N(e,n,o,t,r,u,i){return{size:e,offset:n,unadjustedOffset:o,focal:t,anchor:r,pivot:u,cutoff:i}}function L(e){for(let n=0;n<e.length;n++)if(e[n].focal)return n;return-1}function O(e){for(let n=e.length-1;n>=0;n--)if(e[n].focal)return n;return-1}function T(e,n,o,t){const r=t>0?e.length-1:0;let u=o;for(;u!==r&&e[u].size!==n;)u+=t;return u}function Z(e){let n=-1,o=0;for(let t=0;t<e.length;t++){const r=e[t];!r.anchor&&r.size>o&&(n=t,o=r.size)}return n}function H(e,n){let o=n;for(;n>=0&&o+1<e.length&&e[o+1].size===e[n].size;)o++;return o}function g(e,n,o,t,r){const u=Z(e),i=H(e,u),s=e[u].size,l=[],a=(c,d,_)=>{const{size:b,anchor:h}=e[c],y=d-b/2,S=d+b/2;return N(b,d,_,u<=c&&c<=i,h,c===t,y<0&&S>0?-y:y<n&&S>n?S-n:0)};let f=r-s/2-o,m=f;for(let c=t-1;c>=0;c--){const d=e[c].size;l.push(a(c,f-d/2,m-s/2)),f-=d+o,m-=s+o}l.reverse(),l.push(a(t,r,r)),f=r+s/2+o,m=f;for(let c=t+1;c<e.length;c++){const d=e[c].size;l.push(a(c,f+d/2,m+s/2)),f+=d+o,m+=s+o}return l}function P(e,n,o,t){const r=Z(e);if(r<0)return[];const u=e[r].size,i=H(e,r)-r,s=o===0||i%2===0?0:o/2;return g(e,n,o,r,t?n/2-u/2*i-s-Math.floor(i/2)*o:u/2)}function F(e,n,o){const t=[{size:e,anchor:!0}];for(let r=0;r<n.length;r+=2){const u=n[r+1];for(let i=x(n[r]);i>0;i--)t.push({size:u,anchor:!1})}return t.push({size:o,anchor:!0}),t}function w(e,n,o,t,r,u,i,s,l){const a=e-(s+u+t-1)*n,f=X(r,40,56),m=a-(l*s+i*u+f*t),c=t===0?0:m>0?f+Math.min(m/t,56-f):m<0?f+Math.max(m/t,40-f):f,d=(a-(t+u/2)*c)/(s+u/2),_=(d+c)/2;let b=_,h=d;if(u>0&&d!==l){const S=(l-d)*s,A=Math.min(Math.abs(S),_
|
|
1
|
+
function X(e,n,o){return Math.min(o,Math.max(n,e));}function M(e,n,o){return e+(n-e)*o;}function C(e,n,o,t,r){return r<=o?e:r>=t?n:e+(n-e)*((r-o)/(t-o));}function x(e){if(e>=4294967296)throw new RangeError("invalid keyline count");return Math.max(0,Math.trunc(e)||0);}function N(e,n,o,t,r,u,i){return{size:e,offset:n,unadjustedOffset:o,focal:t,anchor:r,pivot:u,cutoff:i};}function L(e){for(let n=0;n<e.length;n++)if(e[n].focal)return n;return-1;}function O(e){for(let n=e.length-1;n>=0;n--)if(e[n].focal)return n;return-1;}function T(e,n,o,t){const r=t>0?e.length-1:0;let u=o;for(;u!==r&&e[u].size!==n;)u+=t;return u;}function Z(e){let n=-1,o=0;for(let t=0;t<e.length;t++){const r=e[t];!r.anchor&&r.size>o&&(n=t,o=r.size);}return n;}function H(e,n){let o=n;for(;n>=0&&o+1<e.length&&e[o+1].size===e[n].size;)o++;return o;}function g(e,n,o,t,r){const u=Z(e),i=H(e,u),s=e[u].size,l=[],a=(c,d,_)=>{const{size:b,anchor:h}=e[c],y=d-b/2,S=d+b/2;return N(b,d,_,u<=c&&c<=i,h,c===t,y<0&&S>0?-y:y<n&&S>n?S-n:0);};let f=r-s/2-o,m=f;for(let c=t-1;c>=0;c--){const d=e[c].size;l.push(a(c,f-d/2,m-s/2)),f-=d+o,m-=s+o;}l.reverse(),l.push(a(t,r,r)),f=r+s/2+o,m=f;for(let c=t+1;c<e.length;c++){const d=e[c].size;l.push(a(c,f+d/2,m+s/2)),f+=d+o,m+=s+o;}return l;}function P(e,n,o,t){const r=Z(e);if(r<0)return[];const u=e[r].size,i=H(e,r)-r,s=o===0||i%2===0?0:o/2;return g(e,n,o,r,t?n/2-u/2*i-s-Math.floor(i/2)*o:u/2);}function F(e,n,o){const t=[{size:e,anchor:!0}];for(let r=0;r<n.length;r+=2){const u=n[r+1];for(let i=x(n[r]);i>0;i--)t.push({size:u,anchor:!1});}return t.push({size:o,anchor:!0}),t;}function w(e,n,o,t,r,u,i,s,l){const a=e-(s+u+t-1)*n,f=X(r,40,56),m=a-(l*s+i*u+f*t),c=t===0?0:m>0?f+Math.min(m/t,56-f):m<0?f+Math.max(m/t,40-f):f,d=(a-(t+u/2)*c)/(s+u/2),_=(d+c)/2;let b=_,h=d;if(u>0&&d!==l){const S=(l-d)*s,A=Math.min(Math.abs(S),_*0.1*u);S>0?(b-=A/u,h+=A/s):(b+=A/u,h-=A/s);}return{cost:!(s>0&&t>0)||(u>0?h>b&&b>c:h>c)?Math.abs(l-h)*o:1/0,small:c,smallCount:t,medium:b,mediumCount:u,large:h,largeCount:s};}function z(e,n,o,t,r,u,i,s,l){let a,f=0;for(let m=0;m<l;m++)for(const c of u)for(const d of t){const _=w(e,n,++f,d,o,c,r,s-m,i);if((a===void 0||!(_.cost>=a.cost))&&(a=_,a.cost===0))return a;}return a;}function j(e,n,o){const{small:t,smallCount:r,medium:u,mediumCount:i,large:s,largeCount:l}=e;return P(F(10,[l,s,i,u,r,t],10),n,o,!1);}function G(e,n,o,t){if(e===0||n===0)return[];const r=e<80?0:1,u=Math.min(n,e),i=X(u/3,40,56),s=(u+i)/2,l=Math.ceil(e/u),a=Math.max(1,Math.floor((e-s-56*r)/u)),f=x(l-a+1);let m=z(e,o,i,[r],s,[1,0],u,l,f);return m!==void 0&&m.largeCount+m.mediumCount+m.smallCount>t&&(m=z(e,o,i,[0],s,[m.mediumCount],u,l,f)),m===void 0?[]:j(m,e,o);}function D(e,n,o,t){if(e===0)return[];const r=t&&o>=3,u=o<=1?0:r?2:1,i=e<40*u+40*1.25?0:u,s=X(e/3,40,56),l=Math.max(1,Math.floor((e-40*i)/e)),a=x(1-l+1),f=z(e,n,s,[i],0,[0],e,1,a);if(f===void 0)return[];if(!r||o<f.largeCount+f.smallCount)return j(f,e,n);const m=f.smallCount/2,c=f.mediumCount/2;return P(F(10,[m,f.small,c,f.medium,f.largeCount,f.large,c,f.medium,m,f.small],10),e,n,!0);}function U(e,n,o){if(e===0||n===0)return[];const t=Math.min(n,e),r=Math.max(1,Math.floor(e/(t+o))),u=e-r*(t+o);let i=Math.max(u*1.5,10);return i>t*0.85&&(i=Math.min(Math.max(t*0.85,u*1.2),t)),P(F(Math.max(Math.min(10,n),i/2),[r,t,u>0?1:0,i],10),e,o,!1);}function v(e,n,o,t,r){switch(e){case"multi-browse":return G(n,o,t,r);case"hero":case"center-aligned-hero":return D(n,t,r,e==="center-aligned-hero");case"uncontained":return U(n,o,t);default:return[];}}function I(e,n,o,t,r){const u=n>o?1:-1,i=e[n],s=e.findIndex(a=>a.pivot),l=e.slice();return l.splice(n,1),l.splice(o,0,i),g(l,t,r,s+u,e[s].offset+(i.size-i.cutoff+r)*u);}function B(e,n,o){const t=L(e),r=e.findIndex(l=>!l.anchor),u=e[t],i=t-r,s=[e];if(u.offset-u.size/2>=0&&t===r)return s;if(i<=0&&u.cutoff>0)return[e,I(e,0,0,n,o)];for(let l=0,a=e;l<i;l++){const f=r+l,m=f>0?T(a,e[f-1].size,O(a),1)-1:e.length-1;a=I(a,r,m,n,o),s.push(a);}return s;}function p(e,n,o){const t=O(e);let r=e.length-1;for(;r>=0&&e[r].anchor;)r--;const u=e[t],i=r-t,s=[e];if(u.offset+u.size/2<=n&&t===r)return s;if(i<=0&&u.cutoff>0)return[e,I(e,0,0,n,o)];for(let l=0,a=e;l<i;l++){const f=r-l,m=f<e.length-1?T(a,e[f+1].size,L(a)-1,-1)+1:0;a=I(a,r,m,n,o),s.push(a);}return s;}function E(e){return e[0].unadjustedOffset;}function K(e){return-e[e.length-1].unadjustedOffset;}function R(e,n,o){const t=[0];if(n===0)return t;for(let r=1;r<e.length;r++)t.push(r===e.length-1?1:t[r-1]+(o(e[r])-o(e[r-1]))/n);return t;}function W(e,n,o){const t=[];for(let r=0;r<e.length;r++){const u=e[r],i=n[r],s=o<0.5?u:i;t.push(N(M(u.size,i.size,o),M(u.offset,i.offset,o),M(u.unadjustedOffset,i.unadjustedOffset,o),s.focal,s.anchor,s.pivot,M(u.cutoff,i.cutoff,o)));}return t;}function q(e,n,o,t,r){const u=v(e,n,o,t,r),i=L(u);if(r===0||i<0)return;const s=B(u,n,t),l=p(u,n,t),a=E(s[s.length-1])-E(u),f=K(l[l.length-1])-K(u);return{availableSpace:n,itemSize:u[i].size,itemSpacing:t,defaultKeylines:u,startSteps:s,endSteps:l,startShiftDistance:a,endShiftDistance:f,startShiftPoints:R(s,a,E),endShiftPoints:R(l,f,K)};}function J(e,n){return Math.max(0,e.itemSize*n+e.itemSpacing*(n-1)-e.availableSpace);}function Q(e,n,o){const t=Math.max(0,n),r=e.startShiftDistance,u=Math.max(0,o-e.endShiftDistance);let i,s,l,a;if(t>=r&&t<=u)return e.defaultKeylines;t>u?(i=C(0,1,u,o,t),s=e.endShiftPoints,l=e.endSteps,a=u<0.01&&e.startSteps.length===2&&l.length===2?e.startSteps[1]:l[0]):(i=C(1,0,0,r,t),s=e.startShiftPoints,l=e.startSteps,a=l[0]);const f=Math.min(l.length,s.length);for(let m=1;m<f;m++)if(i<=s[m])return W(m===1?a:l[m-1],l[m],C(0,1,s[m-1],s[m],i));return a;}function V(e,n,o,t){const r=e.itemSize,u=o*(r+e.itemSpacing)+r/2-t,i=n.length-1;let s=0,l=n[0];for(;!(l.unadjustedOffset>=u)&&s<i;)l=n[++s];const a=s===0||!(l.unadjustedOffset>=u)?l:n[s-1],f=a===l,m=f?1:(u-a.unadjustedOffset)/(l.unadjustedOffset-a.unadjustedOffset),c=M(a.offset,l.offset,m),d=M(a.size,l.size,m);return{translation:c-u+(f?(u-a.unadjustedOffset)/d:0),maskSize:d,visible:d>0&&c+d/2>0&&c-d/2<e.availableSpace};}function Y(e,n,o){const t=e.defaultKeylines,r=e.startSteps,u=e.endSteps,i=e.itemSize/2,s=L(t),l=r.length-1,a=u.length-1,f=o-1-n;let m=t[s].unadjustedOffset-i;if(n<=l){const c=r[Math.min(l,Math.max(0,l-n))];m=c[L(c)].unadjustedOffset-i;}if(n>=o-1-a&&o>O(t)-s+1){const c=u[Math.min(a,Math.max(0,a-f))];m=c[O(c)].unadjustedOffset-i;}return Math.round(m);}export{Q as carouselKeylinesAt,J as carouselMaxScroll,Y as carouselSnapOffset,q as carouselStrategy,V as placeCarouselItem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untrack as f,useContext as R}from"solid-js";import{defineDomComponent as S}from"..";import{DomController as E}from"../dom/client";import{deferAfterDelegatedCancellation as v}from"../util";import{carouselKeylinesAt as _,carouselMaxScroll as O,carouselSnapOffset as N,carouselStrategy as B,placeCarouselItem as F}from"./carousel-layout";import{hasNestedInteractive as $,isElementNode as V}from"./interactive";import"./carousel.css";const X=240,J=40,q=8,G=9/16,U=16/9,K=150,g
|
|
1
|
+
import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untrack as f,useContext as R}from"solid-js";import{defineDomComponent as S}from"..";import{DomController as E}from"../dom/client";import{deferAfterDelegatedCancellation as v}from"../util";import{carouselKeylinesAt as _,carouselMaxScroll as O,carouselSnapOffset as N,carouselStrategy as B,placeCarouselItem as F}from"./carousel-layout";import{hasNestedInteractive as $,isElementNode as V}from"./interactive";import"./carousel.css";const X=240,J=40,q=8,G=9/16,U=16/9,K=150,g=0.5,L="cw-carousel-label-change",W="data-cw-carousel-slide",p="data-cw-carousel-generated-label",A="cw-Carousel-controls",Z=`${A} cw-Carousel-controls-hidden`,M=k();function I(s){return s===void 0||!Number.isFinite(s)?void 0:Math.max(0,Math.trunc(s));}function C(s){return s!==void 0&&Number.isFinite(s)?Math.trunc(s):0;}function w(s){return f(()=>C("index"in s?s.index:"activeIndex"in s?s.activeIndex:s.defaultIndex));}function T(s){return s===void 0||!Number.isFinite(s)?1:Math.max(G,Math.min(U,s));}function j(s){return s==="multi-browse"||s==="hero"||s==="center-aligned-hero"||s==="uncontained";}function P(s,e){const t=I(e.itemCount),i=Math.max(0,w(e)),n=t===void 0?i:Math.min(i,Math.max(0,t-1)),o=e.loop===!0;return<div{...s}aria-label={s["aria-label"]??e.label??"Carousel"}aria-roledescription="carousel"classList={{...s.classList,"cw-Carousel":!0,[`_cw-Carousel-${e.orientation??"horizontal"}`]:!0}}data-cw-carousel-layout={e.layout??"full-screen"}data-cw-carousel-orientation={e.orientation??"horizontal"}data-cw-carousel-snap={e.snap===!0?"true":"false"}role="region">
|
|
2
2
|
<div class={e.showControls===!1?Z:A}>
|
|
3
3
|
<button aria-label={e.previousLabel??"Previous"}class="cw-Carousel-previous"data-cw-carousel-previous disabled={t!==void 0&&!o&&n<=0}type="button">{e.previousLabel??"Previous"}</button>
|
|
4
4
|
<button aria-label={e.nextLabel??"Next"}class="cw-Carousel-next"data-cw-carousel-next disabled={t!==void 0&&!o&&n>=t-1}type="button">{e.nextLabel??"Next"}</button>
|
|
@@ -7,4 +7,4 @@ import{createComponent as D,createContext as k,onCleanup as z,onMount as H,untra
|
|
|
7
7
|
<div class="cw-Carousel-viewport"data-cw-carousel-viewport tabIndex={0}>
|
|
8
8
|
<div class="cw-Carousel-track"data-cw-carousel-track>{s.children}</div>
|
|
9
9
|
</div>
|
|
10
|
-
</div>}class Y extends E{#o;#t;#f;#E;#a;#u;#m;#i;#e;#h;#n;#r;#c;#p;#w;#b;#l;#d;#v;#s;#L;#A;#y;#C;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o="index"in e||"activeIndex"in e,this.#t=null,this.#f=null,this.#E=null,this.#a=null,this.#u=null,this.#m=null,this.#i=[],this.#e=Math.max(0,w(e)),this.#h=void 0,this.#n=f(()=>e.orientation??"horizontal"),this.#r=!1,this.#c=void 0,this.#p=0,this.#w=[],this.#b=new Set,this.#l=void 0,this.#d=void 0,this.#v=!1,this.#s=void 0,this.#L=!1,this.#A=0,this.#y=void 0,this.#C=void 0,H(()=>this.#g()),z(()=>this.#ee())}#x(){return this.props.layout??"full-screen"}#M(){const e=this.#t;return e===null?0:this.#n==="vertical"?e.scrollTop:e.scrollLeft*(this.#r?-1:1)}#q(){const e=this.#f;this.#i=e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute(W)),this.#b.clear()}#g(){this.#t?.isConnected===!0&&(this.#C===void 0&&this.#Q(),this.#q(),this.#I(),this.#O(),this.#$())}#I(){const e=this.#t,t=this.#x(),i=this.#n==="vertical",n=this.#i;if(e===null)return;const o=e.ownerDocument.defaultView,r=i?e.clientHeight:e.clientWidth,d=Math.max(J,this.props.itemSize??X),h=Math.max(0,this.props.itemGap??q),m=i?"scroll-margin-block-start":"scroll-margin-inline-start",b=i?"scroll-margin-inline-start":"scroll-margin-block-start";this.#A=r,this.#r=!i&&o?.getComputedStyle(e).direction==="rtl",this.#c=!j(t)||r<=0?void 0:B(t,r,d,h,n.length),e.style.setProperty("--cw-carousel-item-gap",`${h}px`),e.style.setProperty("--cw-carousel-item-size",`${this.#c?.itemSize??d}px`);const c=this.#c;if(c!==void 0){const l=c.itemSize+c.itemSpacing;this.#p=O(c,n.length),this.#w=n.map((u,y)=>{const x=N(c,y,n.length);return u.style.setProperty(m,`${x}px`),u.style.removeProperty(b),Math.min(this.#p,Math.max(0,y*l-x))});for(const u of n)u.style.visibility="hidden",u.inert=!0;this.#T();return}this.#p=0;for(const l of n)l.style.removeProperty(m),l.style.removeProperty(b),l.style.removeProperty("--cw-carousel-item-offset"),l.style.removeProperty("--cw-carousel-item-inset"),l.style.removeProperty("visibility");const a=this.#f?.getBoundingClientRect();this.#w=a===void 0?[]:n.map(l=>{const u=l.getBoundingClientRect();return i?u.top-a.top:this.#r?a.right-u.right:u.left-a.left})}#T(){const e=this.#c,t=this.#i;if(e===void 0)return;const i=Math.max(0,Math.min(this.#p,this.#M())),n=_(e,i,this.#p),o=e.itemSize+e.itemSpacing,r=n.length,d=Math.max(0,Math.floor(i/o)-r),h=Math.ceil((i+e.availableSpace)/o),m=Math.min(t.length-1,h+r),b=this.#r?-1:1,c=new Set;for(let a=d;a<=m;a++){const l=F(e,n,a,i),u=t[a];l.visible&&(u.style.setProperty("--cw-carousel-item-offset",`${l.translation*b}px`),u.style.setProperty("--cw-carousel-item-inset",`${Math.max(0,(e.itemSize-l.maskSize)/2)}px`),this.#b.has(a)||(u.style.removeProperty("visibility"),u.inert=!1),c.add(a))}for(const a of this.#b){const l=t[a];l!==void 0&&!c.has(a)&&(l.style.visibility="hidden",l.inert=!0)}this.#b=c}#_(){const e=this.#w,t=this.#M();let i=0,n=e.length-1;for(;i<n;){const o=Math.floor((i+n)/2);e[o]<t?i=o+1:n=o}return i>0&&t-e[i-1]<e[i]-t?i-1:i}#O(){const e=this.#i,t=this.#x(),i=this.#c!==void 0;this.#o&&(this.#e=C(this.props.index??this.props.activeIndex)),this.#e=Math.max(0,Math.min(this.#e,e.length-1));for(const[n,o]of e.entries())(!o.hasAttribute("aria-label")||o.hasAttribute(p))&&(o.setAttribute("aria-label",`Slide ${n+1} of ${e.length}`),o.setAttribute(p,"true")),o.setAttribute("aria-current",n===this.#e?"true":"false"),t==="full-screen"?o.inert=n!==this.#e:i||(o.inert=!1);this.#D()}#P(e,t){const i=this.#x()==="full-screen";for(const[n,o]of[[e,!1],[t,!0]]){const r=this.#i[n];r!==void 0&&(r.setAttribute("aria-current",o?"true":"false"),i&&(r.inert=!o))}this.#D()}#D(){const e=this.props.loop===!0,t=this.#i.length;this.#a!==null&&(this.#a.disabled=t===0||!e&&this.#e<=0),this.#u!==null&&(this.#u.disabled=t===0||!e&&this.#e>=t-1)}#k(e,t,i){const n=this.#i.length,o=this.props.loop===!0?(e%n+n)%n:Math.max(0,Math.min(e,n-1)),r=this.#e;if(!(n===0||o===r)){if(this.#o){this.#S(o,t);return}this.#e=o,this.#P(r,o),this.#z(i),this.#S(o,t)}}#S(e,t){f(()=>this.props.onIndexChange?.(e,t))}#z(e){const t=this.#t,i=this.#i[this.#e],n=t?.ownerDocument.defaultView;if(t===null||i===void 0||n==null)return;const o=n.matchMedia("(prefers-reduced-motion: reduce)").matches;this.#N(o?"auto":"smooth"),e&&(i.inert=!1,i.style.removeProperty("visibility"),i.focus({preventScroll:!0}))}#N(e){const t=this.#t,i=this.#i[this.#e],n=this.#n==="vertical";if(t===null||i===void 0)return;if(this.#c!==void 0){const h=this.#w[this.#e]??0,m=this.#r?-h:h;if(Math.abs(h-this.#M())<g)return;this.#B(),t.scrollTo(n?{behavior:e,top:h}:{behavior:e,left:m});return}const o=t.getBoundingClientRect(),r=i.getBoundingClientRect(),d=n?r.top-o.top:this.#r?r.right-o.right:r.left-o.left;!Number.isFinite(d)||Math.abs(d)<g||(this.#B(),t.scrollBy({behavior:e,left:n?0:d,top:n?d:0}))}#B(){this.#v=!0,this.#F()}#F(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=e?.setTimeout(this.#J,K)}#$(){const e=this.#t?.ownerDocument.defaultView;e!=null&&(this.#d!==void 0&&e.cancelAnimationFrame(this.#d),this.#d=e.requestAnimationFrame(()=>{this.#d=void 0,this.#N("auto"),this.#T()}))}#V(){this.#l=void 0,this.#T(),this.#v||this.#X()}#X(){const e=this.#i.length===0?this.#e:this.#_(),t=this.#e;if(!(e===t&&this.#h===void 0)){if(this.#o){e!==(this.#h??t)&&(this.#h=e===t?void 0:e,e!==t&&this.#S(e));return}this.#e=e,this.#P(t,e),this.#S(e)}}#G=()=>{const e=this.#t?.ownerDocument.defaultView;(this.#v||!this.#L)&&this.#F(),!(this.#l!==void 0||e==null)&&(this.#l=e.requestAnimationFrame(()=>this.#V()))};#J=()=>{const e=this.#t?.ownerDocument.defaultView;if(this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=void 0,this.#l!==void 0&&(e?.cancelAnimationFrame(this.#l),this.#V()),this.#v){this.#v=!1,this.#X();return}!this.#o||this.#i.length===0||(this.#h=void 0,this.#_()!==this.#e&&this.#z(!1))};#U=e=>v(e,this.#t,()=>this.#k(this.#e-1,e,!1),!1);#K=e=>v(e,this.#t,()=>this.#k(this.#e+1,e,!1),!1);#W=e=>{f(()=>this.props.onShowAll?.(e))};#Z=()=>{this.#x()==="uncontained-multi-aspect-ratio"&&this.#I(),this.#O()};#j=e=>{const t=this.#t,i=this.#n==="horizontal",n=i?this.#r?"ArrowLeft":"ArrowRight":"ArrowDown",o=i?this.#r?"ArrowRight":"ArrowLeft":"ArrowUp";if(e.defaultPrevented||t===null||e.target!==t&&V(e.target)&&$(e.target,t,e.composedPath()))return;const r=e.key==="Home"?0:e.key==="End"?this.#i.length-1:e.key===n?this.#e+1:e.key===o?this.#e-1:void 0;r!==void 0&&v(e,t,()=>this.#k(r,e,!0))};applyComponentProps(){const e=super.readProps(["activeIndex","index","itemGap","itemSize","label","layout","loop","nextLabel","onShowAll","orientation","previousLabel","showAllLabel","showControls","snap","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Carousel";let i=e.layoutChanged||e.itemSizeChanged||e.itemGapChanged;e.snapChanged&&super.setAttribute("data-cw-carousel-snap",e.snap===!0?"true":"false"),e.layoutChanged&&super.setAttribute("data-cw-carousel-layout",e.layout??"full-screen"),e.orientationChanged&&(this.#n=e.orientation??"horizontal",super.setAttribute("data-cw-carousel-orientation",this.#n),super.setClass("orientation",`_cw-Carousel-${this.#n}`),i=!0),super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),this.#m!==null&&(e.onShowAllChanged||e.showAllLabelChanged)&&(this.#m.hidden=e.onShowAll===void 0,this.#m.textContent=e.showAllLabel??"Show all"),e.previousLabelChanged&&this.#a!==null&&(this.#a.setAttribute("aria-label",e.previousLabel??"Previous"),this.#a.textContent=e.previousLabel??"Previous"),e.nextLabelChanged&&this.#u!==null&&(this.#u.setAttribute("aria-label",e.nextLabel??"Next"),this.#u.textContent=e.nextLabel??"Next"),e.showControlsChanged&&this.#E?.classList.toggle("cw-Carousel-controls-hidden",e.showControls===!1),i?this.#g():e.loopChanged&&this.#D(),this.#o&&(e.indexChanged||e.activeIndexChanged)&&this.#Y(C("index"in this.props?e.index:e.activeIndex))}#Y(e){const t=Math.max(0,Math.min(e,this.#i.length-1)),i=this.#e,n=t===this.#h;this.#h=void 0,!(this.#i.length===0||t===i)&&(this.#e=t,this.#P(i,t),n||this.#z(!1))}#H(e,t){const i=t?"addEventListener":"removeEventListener",n=this.#t;n?.[i]("scroll",this.#G,{passive:!0}),n?.[i]("scrollend",this.#J),n?.[i]("keydown",this.#j),this.#a?.[i]("click",this.#U),this.#u?.[i]("click",this.#K),this.#m?.[i]("click",this.#W),e?.[i](L,this.#Z)}#R(){this.#y?.disconnect(),this.#C?.disconnect(),this.#y=void 0,this.#C=void 0}#Q(){const e=this.#t,t=e?.ownerDocument.defaultView;this.#R(),!(t==null||e===null||this.#f===null)&&(this.#y=new t.MutationObserver(()=>this.#g()),this.#y.observe(this.#f,{childList:!0}),this.#C=new t.ResizeObserver(()=>{(this.#n==="vertical"?e.clientHeight:e.clientWidth)!==this.#A&&(this.#I(),this.#$())}),this.#C.observe(e))}onStyleElementChanged(e){this.#H(super.styleElement,!1),super.onStyleElementChanged(e),this.#t=e?.querySelector("[data-cw-carousel-viewport]")??null,this.#f=this.#t?.querySelector(":scope > [data-cw-carousel-track]")??null,this.#E=e?.querySelector(".cw-Carousel-controls")??null,this.#a=e?.querySelector("[data-cw-carousel-previous]")??null,this.#u=e?.querySelector("[data-cw-carousel-next]")??null,this.#m=e?.querySelector(".cw-Carousel-showAll")??null,this.#L=this.#t!==null&&"onscrollend"in this.#t,this.#H(e,!0),this.#R(),this.#g()}render(e){return f(()=>P({children:e},{index:this.#e,itemCount:this.props.itemCount,label:this.props["attr:aria-label"]??this.props.label,layout:this.props.layout,loop:this.props.loop,nextLabel:this.props.nextLabel,onShowAll:this.props.onShowAll,orientation:this.#n,previousLabel:this.props.previousLabel,showAllLabel:this.props.showAllLabel,showControls:this.props.showControls,snap:this.props.snap}))}#ee(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#l!==void 0&&e?.cancelAnimationFrame(this.#l),this.#d!==void 0&&e?.cancelAnimationFrame(this.#d),this.#s=void 0,this.#l=void 0,this.#d=void 0,this.#R(),this.#H(super.styleElement,!1),this.#i=[],this.#b.clear()}}const Q=S(()=>P,()=>Y),de=s=>D(M.Provider,{value:f(()=>{const e=I(s.itemCount),t=Math.max(0,w(s));let i=0;return{layout:s.layout??"full-screen",currentIndex:e===void 0?t:Math.min(t,Math.max(0,e-1)),itemCount:e,nextItemIndex:()=>i++}}),get children(){return f(()=>Q(s))}});function ee(s,e){const t=R(M),i=t?.nextItemIndex()??0,n=s["aria-label"]??e.label,o=t===void 0?void 0:i===t.currentIndex?"true":"false",r=t?.itemCount===void 0?`Slide ${i+1}`:`Slide ${i+1} of ${t.itemCount}`;return<div{...s}aria-current={o}aria-label={n??r}aria-roledescription="slide"classList={{...s.classList,"cw-Carousel-slide":!0}}data-cw-carousel-generated-label={n===void 0?"true":void 0}data-cw-carousel-slide="true"inert={t?.layout==="full-screen"&&i!==t.currentIndex}role="group"style={{...s.style,"--cw-carousel-aspect-ratio":T(e.aspectRatio)}}tabIndex={-1}><div class="cw-Carousel-mask">{s.children}</div></div>}class te extends E{constructor(e){super(e,{styleElementIsFunction:!0})}#o(){super.styleElement?.dispatchEvent(new Event(L,{bubbles:!0}))}applyComponentProps(){const e=super.readProps(["aspectRatio","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label,i=super.styleElement,n=i?.hasAttribute(p)===!0,o=t===void 0?n&&i?.hasAttribute("aria-label")===!0:!n&&i?.getAttribute("aria-label")===t;e.aspectRatioChanged&&(super.setStyle("--cw-carousel-aspect-ratio",T(e.aspectRatio)),this.#o()),!o&&(t===void 0?(super.setAttribute("aria-label",void 0),i?.setAttribute(p,"true")):(i?.removeAttribute(p),super.setAttribute("aria-label",t)),this.#o())}render(e){return<div aria-roledescription="slide"class="cw-Carousel-slide"data-cw-carousel-slide="true"role="group"tabIndex={-1}><div class="cw-Carousel-mask">{e}</div></div>}}const ie=S(()=>ee,()=>te),he=ie;export{de as Carousel,Y as CarouselController,ie as CarouselItem,he as CarouselSlide};
|
|
10
|
+
</div>;}class Y extends E{#o;#t;#f;#E;#a;#u;#m;#i;#e;#h;#n;#r;#c;#p;#w;#b;#l;#d;#v;#s;#L;#A;#y;#C;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o="index"in e||"activeIndex"in e,this.#t=null,this.#f=null,this.#E=null,this.#a=null,this.#u=null,this.#m=null,this.#i=[],this.#e=Math.max(0,w(e)),this.#h=void 0,this.#n=f(()=>e.orientation??"horizontal"),this.#r=!1,this.#c=void 0,this.#p=0,this.#w=[],this.#b=/* @__PURE__ */new Set(),this.#l=void 0,this.#d=void 0,this.#v=!1,this.#s=void 0,this.#L=!1,this.#A=0,this.#y=void 0,this.#C=void 0,H(()=>this.#g()),z(()=>this.#ee());}#x(){return this.props.layout??"full-screen";}#M(){const e=this.#t;return e===null?0:this.#n==="vertical"?e.scrollTop:e.scrollLeft*(this.#r?-1:1);}#q(){const e=this.#f;this.#i=e===null?[]:Array.from(e.children).filter(t=>t.hasAttribute(W)),this.#b.clear();}#g(){this.#t?.isConnected===!0&&(this.#C===void 0&&this.#Q(),this.#q(),this.#I(),this.#O(),this.#$());}#I(){const e=this.#t,t=this.#x(),i=this.#n==="vertical",n=this.#i;if(e===null)return;const o=e.ownerDocument.defaultView,r=i?e.clientHeight:e.clientWidth,d=Math.max(J,this.props.itemSize??X),h=Math.max(0,this.props.itemGap??q),m=i?"scroll-margin-block-start":"scroll-margin-inline-start",b=i?"scroll-margin-inline-start":"scroll-margin-block-start";this.#A=r,this.#r=!i&&o?.getComputedStyle(e).direction==="rtl",this.#c=!j(t)||r<=0?void 0:B(t,r,d,h,n.length),e.style.setProperty("--cw-carousel-item-gap",`${h}px`),e.style.setProperty("--cw-carousel-item-size",`${this.#c?.itemSize??d}px`);const c=this.#c;if(c!==void 0){const l=c.itemSize+c.itemSpacing;this.#p=O(c,n.length),this.#w=n.map((u,y)=>{const x=N(c,y,n.length);return u.style.setProperty(m,`${x}px`),u.style.removeProperty(b),Math.min(this.#p,Math.max(0,y*l-x));});for(const u of n)u.style.visibility="hidden",u.inert=!0;this.#T();return;}this.#p=0;for(const l of n)l.style.removeProperty(m),l.style.removeProperty(b),l.style.removeProperty("--cw-carousel-item-offset"),l.style.removeProperty("--cw-carousel-item-inset"),l.style.removeProperty("visibility");const a=this.#f?.getBoundingClientRect();this.#w=a===void 0?[]:n.map(l=>{const u=l.getBoundingClientRect();return i?u.top-a.top:this.#r?a.right-u.right:u.left-a.left;});}#T(){const e=this.#c,t=this.#i;if(e===void 0)return;const i=Math.max(0,Math.min(this.#p,this.#M())),n=_(e,i,this.#p),o=e.itemSize+e.itemSpacing,r=n.length,d=Math.max(0,Math.floor(i/o)-r),h=Math.ceil((i+e.availableSpace)/o),m=Math.min(t.length-1,h+r),b=this.#r?-1:1,c=/* @__PURE__ */new Set();for(let a=d;a<=m;a++){const l=F(e,n,a,i),u=t[a];l.visible&&(u.style.setProperty("--cw-carousel-item-offset",`${l.translation*b}px`),u.style.setProperty("--cw-carousel-item-inset",`${Math.max(0,(e.itemSize-l.maskSize)/2)}px`),this.#b.has(a)||(u.style.removeProperty("visibility"),u.inert=!1),c.add(a));}for(const a of this.#b){const l=t[a];l!==void 0&&!c.has(a)&&(l.style.visibility="hidden",l.inert=!0);}this.#b=c;}#_(){const e=this.#w,t=this.#M();let i=0,n=e.length-1;for(;i<n;){const o=Math.floor((i+n)/2);e[o]<t?i=o+1:n=o;}return i>0&&t-e[i-1]<e[i]-t?i-1:i;}#O(){const e=this.#i,t=this.#x(),i=this.#c!==void 0;this.#o&&(this.#e=C(this.props.index??this.props.activeIndex)),this.#e=Math.max(0,Math.min(this.#e,e.length-1));for(const[n,o]of e.entries())(!o.hasAttribute("aria-label")||o.hasAttribute(p))&&(o.setAttribute("aria-label",`Slide ${n+1} of ${e.length}`),o.setAttribute(p,"true")),o.setAttribute("aria-current",n===this.#e?"true":"false"),t==="full-screen"?o.inert=n!==this.#e:i||(o.inert=!1);this.#D();}#P(e,t){const i=this.#x()==="full-screen";for(const[n,o]of[[e,!1],[t,!0]]){const r=this.#i[n];r!==void 0&&(r.setAttribute("aria-current",o?"true":"false"),i&&(r.inert=!o));}this.#D();}#D(){const e=this.props.loop===!0,t=this.#i.length;this.#a!==null&&(this.#a.disabled=t===0||!e&&this.#e<=0),this.#u!==null&&(this.#u.disabled=t===0||!e&&this.#e>=t-1);}#k(e,t,i){const n=this.#i.length,o=this.props.loop===!0?(e%n+n)%n:Math.max(0,Math.min(e,n-1)),r=this.#e;if(!(n===0||o===r)){if(this.#o){this.#S(o,t);return;}this.#e=o,this.#P(r,o),this.#z(i),this.#S(o,t);}}#S(e,t){f(()=>this.props.onIndexChange?.(e,t));}#z(e){const t=this.#t,i=this.#i[this.#e],n=t?.ownerDocument.defaultView;if(t===null||i===void 0||n==null)return;const o=n.matchMedia("(prefers-reduced-motion: reduce)").matches;this.#N(o?"auto":"smooth"),e&&(i.inert=!1,i.style.removeProperty("visibility"),i.focus({preventScroll:!0}));}#N(e){const t=this.#t,i=this.#i[this.#e],n=this.#n==="vertical";if(t===null||i===void 0)return;if(this.#c!==void 0){const h=this.#w[this.#e]??0,m=this.#r?-h:h;if(Math.abs(h-this.#M())<g)return;this.#B(),t.scrollTo(n?{behavior:e,top:h}:{behavior:e,left:m});return;}const o=t.getBoundingClientRect(),r=i.getBoundingClientRect(),d=n?r.top-o.top:this.#r?r.right-o.right:r.left-o.left;!Number.isFinite(d)||Math.abs(d)<g||(this.#B(),t.scrollBy({behavior:e,left:n?0:d,top:n?d:0}));}#B(){this.#v=!0,this.#F();}#F(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=e?.setTimeout(this.#J,K);}#$(){const e=this.#t?.ownerDocument.defaultView;e!=null&&(this.#d!==void 0&&e.cancelAnimationFrame(this.#d),this.#d=e.requestAnimationFrame(()=>{this.#d=void 0,this.#N("auto"),this.#T();}));}#V(){this.#l=void 0,this.#T(),this.#v||this.#X();}#X(){const e=this.#i.length===0?this.#e:this.#_(),t=this.#e;if(!(e===t&&this.#h===void 0)){if(this.#o){e!==(this.#h??t)&&(this.#h=e===t?void 0:e,e!==t&&this.#S(e));return;}this.#e=e,this.#P(t,e),this.#S(e);}}#G=()=>{const e=this.#t?.ownerDocument.defaultView;(this.#v||!this.#L)&&this.#F(),!(this.#l!==void 0||e==null)&&(this.#l=e.requestAnimationFrame(()=>this.#V()));};#J=()=>{const e=this.#t?.ownerDocument.defaultView;if(this.#s!==void 0&&e?.clearTimeout(this.#s),this.#s=void 0,this.#l!==void 0&&(e?.cancelAnimationFrame(this.#l),this.#V()),this.#v){this.#v=!1,this.#X();return;}!this.#o||this.#i.length===0||(this.#h=void 0,this.#_()!==this.#e&&this.#z(!1));};#U=e=>v(e,this.#t,()=>this.#k(this.#e-1,e,!1),!1);#K=e=>v(e,this.#t,()=>this.#k(this.#e+1,e,!1),!1);#W=e=>{f(()=>this.props.onShowAll?.(e));};#Z=()=>{this.#x()==="uncontained-multi-aspect-ratio"&&this.#I(),this.#O();};#j=e=>{const t=this.#t,i=this.#n==="horizontal",n=i?this.#r?"ArrowLeft":"ArrowRight":"ArrowDown",o=i?this.#r?"ArrowRight":"ArrowLeft":"ArrowUp";if(e.defaultPrevented||t===null||e.target!==t&&V(e.target)&&$(e.target,t,e.composedPath()))return;const r=e.key==="Home"?0:e.key==="End"?this.#i.length-1:e.key===n?this.#e+1:e.key===o?this.#e-1:void 0;r!==void 0&&v(e,t,()=>this.#k(r,e,!0));};applyComponentProps(){const e=super.readProps(["activeIndex","index","itemGap","itemSize","label","layout","loop","nextLabel","onShowAll","orientation","previousLabel","showAllLabel","showControls","snap","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Carousel";let i=e.layoutChanged||e.itemSizeChanged||e.itemGapChanged;e.snapChanged&&super.setAttribute("data-cw-carousel-snap",e.snap===!0?"true":"false"),e.layoutChanged&&super.setAttribute("data-cw-carousel-layout",e.layout??"full-screen"),e.orientationChanged&&(this.#n=e.orientation??"horizontal",super.setAttribute("data-cw-carousel-orientation",this.#n),super.setClass("orientation",`_cw-Carousel-${this.#n}`),i=!0),super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),this.#m!==null&&(e.onShowAllChanged||e.showAllLabelChanged)&&(this.#m.hidden=e.onShowAll===void 0,this.#m.textContent=e.showAllLabel??"Show all"),e.previousLabelChanged&&this.#a!==null&&(this.#a.setAttribute("aria-label",e.previousLabel??"Previous"),this.#a.textContent=e.previousLabel??"Previous"),e.nextLabelChanged&&this.#u!==null&&(this.#u.setAttribute("aria-label",e.nextLabel??"Next"),this.#u.textContent=e.nextLabel??"Next"),e.showControlsChanged&&this.#E?.classList.toggle("cw-Carousel-controls-hidden",e.showControls===!1),i?this.#g():e.loopChanged&&this.#D(),this.#o&&(e.indexChanged||e.activeIndexChanged)&&this.#Y(C("index"in this.props?e.index:e.activeIndex));}#Y(e){const t=Math.max(0,Math.min(e,this.#i.length-1)),i=this.#e,n=t===this.#h;this.#h=void 0,!(this.#i.length===0||t===i)&&(this.#e=t,this.#P(i,t),n||this.#z(!1));}#H(e,t){const i=t?"addEventListener":"removeEventListener",n=this.#t;n?.[i]("scroll",this.#G,{passive:!0}),n?.[i]("scrollend",this.#J),n?.[i]("keydown",this.#j),this.#a?.[i]("click",this.#U),this.#u?.[i]("click",this.#K),this.#m?.[i]("click",this.#W),e?.[i](L,this.#Z);}#R(){this.#y?.disconnect(),this.#C?.disconnect(),this.#y=void 0,this.#C=void 0;}#Q(){const e=this.#t,t=e?.ownerDocument.defaultView;this.#R(),!(t==null||e===null||this.#f===null)&&(this.#y=new t.MutationObserver(()=>this.#g()),this.#y.observe(this.#f,{childList:!0}),this.#C=new t.ResizeObserver(()=>{(this.#n==="vertical"?e.clientHeight:e.clientWidth)!==this.#A&&(this.#I(),this.#$());}),this.#C.observe(e));}onStyleElementChanged(e){this.#H(super.styleElement,!1),super.onStyleElementChanged(e),this.#t=e?.querySelector("[data-cw-carousel-viewport]")??null,this.#f=this.#t?.querySelector(":scope > [data-cw-carousel-track]")??null,this.#E=e?.querySelector(".cw-Carousel-controls")??null,this.#a=e?.querySelector("[data-cw-carousel-previous]")??null,this.#u=e?.querySelector("[data-cw-carousel-next]")??null,this.#m=e?.querySelector(".cw-Carousel-showAll")??null,this.#L=this.#t!==null&&"onscrollend"in this.#t,this.#H(e,!0),this.#R(),this.#g();}render(e){return f(()=>P({children:e},{index:this.#e,itemCount:this.props.itemCount,label:this.props["attr:aria-label"]??this.props.label,layout:this.props.layout,loop:this.props.loop,nextLabel:this.props.nextLabel,onShowAll:this.props.onShowAll,orientation:this.#n,previousLabel:this.props.previousLabel,showAllLabel:this.props.showAllLabel,showControls:this.props.showControls,snap:this.props.snap}));}#ee(){const e=this.#t?.ownerDocument.defaultView;this.#s!==void 0&&e?.clearTimeout(this.#s),this.#l!==void 0&&e?.cancelAnimationFrame(this.#l),this.#d!==void 0&&e?.cancelAnimationFrame(this.#d),this.#s=void 0,this.#l=void 0,this.#d=void 0,this.#R(),this.#H(super.styleElement,!1),this.#i=[],this.#b.clear();}}const Q=/* @__PURE__ */S(()=>P,()=>Y),de=s=>D(M.Provider,{value:f(()=>{const e=I(s.itemCount),t=Math.max(0,w(s));let i=0;return{layout:s.layout??"full-screen",currentIndex:e===void 0?t:Math.min(t,Math.max(0,e-1)),itemCount:e,nextItemIndex:()=>i++};}),get children(){return f(()=>Q(s));}});function ee(s,e){const t=R(M),i=t?.nextItemIndex()??0,n=s["aria-label"]??e.label,o=t===void 0?void 0:i===t.currentIndex?"true":"false",r=t?.itemCount===void 0?`Slide ${i+1}`:`Slide ${i+1} of ${t.itemCount}`;return<div{...s}aria-current={o}aria-label={n??r}aria-roledescription="slide"classList={{...s.classList,"cw-Carousel-slide":!0}}data-cw-carousel-generated-label={n===void 0?"true":void 0}data-cw-carousel-slide="true"inert={t?.layout==="full-screen"&&i!==t.currentIndex}role="group"style={{...s.style,"--cw-carousel-aspect-ratio":T(e.aspectRatio)}}tabIndex={-1}><div class="cw-Carousel-mask">{s.children}</div></div>;}class te extends E{constructor(e){super(e,{styleElementIsFunction:!0});}#o(){super.styleElement?.dispatchEvent(new Event(L,{bubbles:!0}));}applyComponentProps(){const e=super.readProps(["aspectRatio","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label,i=super.styleElement,n=i?.hasAttribute(p)===!0,o=t===void 0?n&&i?.hasAttribute("aria-label")===!0:!n&&i?.getAttribute("aria-label")===t;e.aspectRatioChanged&&(super.setStyle("--cw-carousel-aspect-ratio",T(e.aspectRatio)),this.#o()),!o&&(t===void 0?(super.setAttribute("aria-label",void 0),i?.setAttribute(p,"true")):(i?.removeAttribute(p),super.setAttribute("aria-label",t)),this.#o());}render(e){return<div aria-roledescription="slide"class="cw-Carousel-slide"data-cw-carousel-slide="true"role="group"tabIndex={-1}><div class="cw-Carousel-mask">{e}</div></div>;}}const ie=/* @__PURE__ */S(()=>ee,()=>te),he=ie;export{de as Carousel,Y as CarouselController,ie as CarouselItem,he as CarouselSlide};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"solid-js/web";import{defineDomComponent as w}from"..";import{Button as D}from"../action/button";import{IconButton as T}from"../action/icon-button";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as H}from"../dom/client";import{isElementNode as y,isTopModalLayer as R,registerModalLayer as X,transitionTimeOf as J}from"../navigation/base";import{deferAfterDelegatedCancellation as q}from"../util/event";import{resolveSurfaceSlots as P}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const N="a[href], area[href], button, input:not([type=hidden]), select, textarea, summary, iframe, [contenteditable]:not([contenteditable=false]), [tabindex]",k="data-cw-dialog-action",M="cw-AlertDialog-noDismiss",I="cw-FullScreenDialog-noConfirm",$="cw-FullScreenDialog-scrolled";let O;function z(){return O??=typeof CSS<"u"&&CSS.supports("overlay","auto"),O}function E(n){const e=n.getRootNode().activeElement;return y(e)?e:null}function L(n,e){return!n.hidden&&!n.matches(":disabled")&&n.getAttribute("aria-disabled")!=="true"&&(!e||!n.hasAttribute("tabindex")||n.tabIndex>=0)&&n.closest("[hidden], [inert], [aria-hidden='true']")===null&&n.checkVisibility({visibilityProperty:!0})}function S(n,e){const t=Array.from(n.querySelectorAll(N));return e&&t.reverse(),t.find(i=>L(i,!0))}function B(n,e){const t=e.target,i=y(t)?t.closest(`[${k}]`):null;return n===null||i?.closest("dialog")!==n?null:i.getAttribute(k)}function K(n){const e=n,t={};for(const i of Object.keys(e))["children","aria-describedby","aria-label","aria-labelledby","aria-modal"].includes(i)||(t[i]=e[i]);return t}function C(n){return("open"in n?n.open:n.defaultOpen)===!0}function A(n,e,t){const i=n,s=i["aria-label"],o=i["aria-labelledby"]??(s===void 0?t.labelledBy:void 0);return{...K(n),"aria-describedby":i["aria-describedby"]??t.describedBy,"aria-label":s??(o===void 0?e.label??t.label:void 0),"aria-labelledby":o,"aria-modal":"aria-modal"in i?i["aria-modal"]:e.modal!==!1?"true":void 0,classList:{...n.classList,...t.classes},open:C(e),role:e.role??t.role,tabIndex:e.tabIndex}}function V(n,e){return<dialog{...A(n,e,{classes:{[v]:!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},label:"Dialog",role:"dialog"})}>{n.children}</dialog
|
|
1
|
+
import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"solid-js/web";import{defineDomComponent as w}from"..";import{Button as D}from"../action/button";import{IconButton as T}from"../action/icon-button";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as H}from"../dom/client";import{isElementNode as y,isTopModalLayer as R,registerModalLayer as X,transitionTimeOf as J}from"../navigation/base";import{deferAfterDelegatedCancellation as q}from"../util/event";import{resolveSurfaceSlots as P}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const N="a[href], area[href], button, input:not([type=hidden]), select, textarea, summary, iframe, [contenteditable]:not([contenteditable=false]), [tabindex]",k="data-cw-dialog-action",M="cw-AlertDialog-noDismiss",I="cw-FullScreenDialog-noConfirm",$="cw-FullScreenDialog-scrolled";let O;function z(){return O??=typeof CSS<"u"&&CSS.supports("overlay","auto"),O;}function E(n){const e=n.getRootNode().activeElement;return y(e)?e:null;}function L(n,e){return!n.hidden&&!n.matches(":disabled")&&n.getAttribute("aria-disabled")!=="true"&&(!e||!n.hasAttribute("tabindex")||n.tabIndex>=0)&&n.closest("[hidden], [inert], [aria-hidden='true']")===null&&n.checkVisibility({visibilityProperty:!0});}function S(n,e){const t=Array.from(n.querySelectorAll(N));return e&&t.reverse(),t.find(i=>L(i,!0));}function B(n,e){const t=e.target,i=y(t)?t.closest(`[${k}]`):null;return n===null||i?.closest("dialog")!==n?null:i.getAttribute(k);}function K(n){const e=n,t={};for(const i of Object.keys(e))["children","aria-describedby","aria-label","aria-labelledby","aria-modal"].includes(i)||(t[i]=e[i]);return t;}function C(n){return("open"in n?n.open:n.defaultOpen)===!0;}function A(n,e,t){const i=n,s=i["aria-label"],o=i["aria-labelledby"]??(s===void 0?t.labelledBy:void 0);return{...K(n),"aria-describedby":i["aria-describedby"]??t.describedBy,"aria-label":s??(o===void 0?e.label??t.label:void 0),"aria-labelledby":o,"aria-modal":"aria-modal"in i?i["aria-modal"]:e.modal!==!1?"true":void 0,classList:{...n.classList,...t.classes},open:C(e),role:e.role??t.role,tabIndex:e.tabIndex};}function V(n,e){return<dialog{...A(n,e,{classes:{[v]:!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},label:"Dialog",role:"dialog"})}>{n.children}</dialog>;}class x extends H{#n;#o;#l;#t;#r;#u;#e;#i;#s;#a;#h;#b;#D;#f;#m;#v;#d;#c;#y;constructor(e,t="cw-Dialog"){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#o="open"in e,this.#l="attr:aria-modal"in e,this.#e=null,this.#i=F(()=>(this.#o?e.open:e.defaultOpen)===!0),this.#s=F(()=>e.modal!==!1),this.#a=!1,this.#h=null,this.#b=0,this.#D=!1,this.#f=!1,this.#m=void 0,this.#v=!1,this.#d=void 0,this.#c=void 0,this.#y=!1;const i=super.consumeProps([],["onOpenChange","onClose","onCancel"]);this.#t=i.onOpenChange,this.#r=i.onClose,this.#u=i.onCancel;}defaultRole(){return"dialog";}defaultLabel(){return this.props.label??"Dialog";}defaultLabelledBy(){}defaultDescribedBy(){}allowDismiss(e,t){return!0;}requestDismiss(e,t){this.allowDismiss(e,t)&&this.close(e,t);}onOpenStateChanged(e){}onShown(){}isOpen(){return this.#i;}open(){this.#C(!0,!0,"programmatic");}close(e="programmatic",t){this.#C(!1,!0,e,t);}toggle(){this.#i?this.close():this.open();}#E(e,t,i){this.#t?.(e,t,i);}#T(e){this.#i=e,super.setClass(`${this.#n}-open`,e),this.onOpenStateChanged(e);}#C(e,t,i,s){const o=e!==this.#i;if(t&&this.#o){o&&this.#E(e,s,i);return;}!o&&(this.#e===null||(this.#e.open&&this.#c===void 0)===e)||(this.#T(e),e?this.#p():this.#_(),t&&o&&this.#E(e,s,i));}#p(){const e=this.#e;if(!(e===null||!this.#i)){if(!e.isConnected){this.#H(e);return;}if(this.#S(),this.#M()&&this.#a===this.#s){this.#P(e);return;}if(this.#h===null){const t=E(e);t!==null&&!e.contains(t)&&(this.#h=t);}if(e.open){if(this.#a===this.#s)return;this.#a?(this.#b++,e.close()):e.removeAttribute("open");}this.#s&&this.props.returnFocus===!1&&E(e)?.blur();try{this.#s?e.showModal():e.show(),this.#a=this.#s;}catch{e.setAttribute("open",""),this.#a=!1;}this.#P(e);}}#P(e){this.#R(),this.#d?.(),this.#d=this.#s?X(e):void 0,this.onShown();}#_(){const e=this.#e;if(this.#S(),this.#d?.(),this.#d=void 0,e!==null){if(e.open&&!z()){super.setClass(`_${this.#n}-closing`,!0);const t=J(e,["display"]),i=e.ownerDocument.defaultView;if(t>0&&i!==null){this.#c=i.setTimeout(()=>this.#g(e),t);return;}super.setClass(`_${this.#n}-closing`,!1);}this.#g(e);}}#g(e){const t=this.#L(e);if(this.#M(),e.open)try{e.close();}catch{e.removeAttribute("open");}this.#a=!1,this.#I(t);}#M(){const e=this.#c;return e===void 0?!1:(this.#c=void 0,this.#e?.ownerDocument.defaultView?.clearTimeout(e),super.setClass(`_${this.#n}-closing`,!1),!0);}#H(e){const t=()=>{const i=e.ownerDocument.defaultView;this.#m=void 0,!(!this.#f||this.#e!==e)&&(e.isConnected?(this.#f=!1,this.#p()):i!==null&&(this.#m=i.requestAnimationFrame(t)));};this.#f||(this.#f=!0,queueMicrotask(t));}#S(){const e=this.#m;this.#f=!1,this.#m=void 0,e!==void 0&&this.#e?.ownerDocument.defaultView?.cancelAnimationFrame(e);}#L(e){const t=E(e);return t===null||t===e.ownerDocument.body||e.contains(t);}#I(e){const t=this.#h;this.#h=null,!(t===null||!e||this.props.returnFocus===!1)&&queueMicrotask(()=>{const i=this.#e;t.isConnected&&(i===null||this.#L(i))&&t.focus();});}#R(){this.#D||(this.#D=!0,queueMicrotask(()=>{const e=this.#e,t=this.props.initialFocus;let i=null;if(this.#D=!1,!this.#i||e===null)return;if(typeof t=="string")try{i=e.querySelector(t);}catch{}else y(t)&&e.contains(t)&&(i=t);(i!==null&&L(i,!1)?i:Array.from(e.querySelectorAll("[autofocus]")).find(o=>L(o,!1))??S(e,!1)??e).focus();}));}#X(e,t){const i=S(e,!1),s=S(e,!0),o=E(e);i===void 0||s===void 0?(t.preventDefault(),e.focus()):(t.shiftKey?o===i||o===e:o===s)&&(t.preventDefault(),(t.shiftKey?s:i).focus());}#B(e){const t=this.#e,i=t?.getBoundingClientRect();return t!==null&&e.target===t&&i!==void 0&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom);}#w=e=>{const t=this.#e;if(this.#c!==void 0){e.preventDefault();return;}t!==null&&this.#s&&!R(t)||(this.#u?.(e),!e.defaultPrevented&&(this.requestDismiss("cancel",e),e.preventDefault()));};#A=e=>{const t=this.#e;if(this.#b>0){this.#b--;return;}if(this.#r?.(e),t!==null&&!t.open&&this.#c!==void 0&&this.#g(t),!(t===null||t.open||!this.#i)){if(this.#d?.(),this.#d=void 0,this.#a=!1,this.#o){this.#E(!1,e,"close"),queueMicrotask(()=>this.#p());return;}this.#T(!1),this.#E(!1,e,"close"),this.#I(this.#L(t));}};#x=e=>{this.#v=this.#B(e);};#F=e=>{const t=this.#v;this.#v=!1,t&&this.#i&&this.props.closeOnBackdrop!==!1&&this.#B(e)&&this.requestDismiss("backdrop",e);};#k=e=>{const t=this.#e;if(!(t===null||e.defaultPrevented||!this.#i||!y(e.target)||e.target.closest("dialog")!==t))if(e.key==="Escape"){if(e.isTrusted&&this.#a)return;q(e,t,()=>{const i=t.ownerDocument.defaultView?.Event??Event;this.#e===t&&this.#i&&t.dispatchEvent(new i("cancel",{cancelable:!0}));});}else e.key==="Tab"&&this.#s&&this.#X(t,e);};#O(e,t){this.#e?.getAttribute(e)!==(t??null)&&super.setAttribute(e,t);}applyComponentProps(){const e=super.readProps(["attr:aria-describedby","attr:aria-label","attr:aria-labelledby","label","modal","open","role","tabIndex"]),t=e["attr:aria-label"],i=e["attr:aria-labelledby"]??(t===void 0?this.defaultLabelledBy():void 0);e.modalChanged&&(this.#s=e.modal!==!1,this.#l||super.setAttribute("aria-modal",this.#s?"true":void 0),this.#p()),e.roleChanged&&super.setAttribute("role",e.role??this.defaultRole()),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex),this.#O("aria-label",t??(i===void 0?this.defaultLabel():void 0)),this.#O("aria-labelledby",i),this.#O("aria-describedby",e["attr:aria-describedby"]??this.defaultDescribedBy()),this.#y||(this.#y=!0,super.setClass(`${this.#n}-open`,this.#i)),e.openChanged&&this.#o&&this.#C(e.open===!0,!1,"programmatic");}onStyleElementChanged(e){const t=this.#e;super.onStyleElementChanged(e),t!==null&&(this.#c!==void 0&&this.#g(t),t.removeEventListener("cancel",this.#w),t.removeEventListener("close",this.#A),t.removeEventListener("click",this.#F),t.removeEventListener("keydown",this.#k),t.removeEventListener("pointerdown",this.#x)),this.#e=e,this.#e!==null&&(this.#e.addEventListener("cancel",this.#w),this.#e.addEventListener("close",this.#A),this.#e.addEventListener("click",this.#F),this.#e.addEventListener("keydown",this.#k),this.#e.addEventListener("pointerdown",this.#x),this.#p());}render(e){const t=<dialog class={`cw-Dialog ${v}`}/>;return _(t,e),t;}onControllerCleanup(){const e=this.#e;if(this.#i=!1,this.#S(),this.#d?.(),this.#d=void 0,e!==null&&(this.#c!==void 0&&this.#g(e),e.removeEventListener("cancel",this.#w),e.removeEventListener("close",this.#A),e.removeEventListener("click",this.#F),e.removeEventListener("keydown",this.#k),e.removeEventListener("pointerdown",this.#x),e.open))try{e.close();}catch{e.removeAttribute("open");}super.onControllerCleanup();}}const he=/* @__PURE__ */w(()=>V,()=>x),U=["children","confirmLabel","dismissLabel","icon","supportingText","text","title"];function j(n,e){const t=l(),i=l();return<dialog{...A(n,e,{classes:{[v]:!0,[M]:e.showDismiss===!1,"cw-AlertDialog":!0,"cw-Dialog":!0,"cw-Dialog-open":C(e)},describedBy:i,label:e.title===void 0?"Alert dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"alertdialog"})}>
|
|
2
2
|
<div class="cw-AlertDialog-icon">{e.icon}</div>
|
|
3
3
|
<h2 class="cw-AlertDialog-title"id={t}>{e.title}</h2>
|
|
4
4
|
<div class="cw-AlertDialog-text"id={i}>
|
|
@@ -8,7 +8,7 @@ import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"s
|
|
|
8
8
|
<D attr:data-cw-dialog-action="dismiss"class="cw-AlertDialog-dismiss"size="sm"variant="text">{e.dismissLabel??"Cancel"}</D>
|
|
9
9
|
<D attr:data-cw-dialog-action="confirm"class="cw-AlertDialog-confirm"size="sm"variant="text">{e.confirmLabel??"OK"}</D>
|
|
10
10
|
</div>
|
|
11
|
-
</dialog
|
|
11
|
+
</dialog>;}class G extends x{#n;#o;#l;#t;constructor(e){super(e),this.#l=l(),this.#t=l();const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss;}defaultRole(){return"alertdialog";}defaultLabel(){return this.props.label??(this.props.title===void 0?"Alert dialog":void 0);}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0;}defaultDescribedBy(){return this.#t;}#r=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e));};applyComponentProps(){const e=super.readProps(["showDismiss"]);super.applyComponentProps(),e.showDismissChanged&&super.setClass(M,e.showDismiss===!1);}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#r),super.onStyleElementChanged(e),e?.addEventListener("click",this.#r);}render(e){const t=this.props,i=this.#l,s=this.#t;return<dialog class={`cw-Dialog cw-AlertDialog ${v}`}>
|
|
12
12
|
<div class="cw-AlertDialog-icon">{t.icon}</div>
|
|
13
13
|
<h2 class="cw-AlertDialog-title"id={i}>{t.title}</h2>
|
|
14
14
|
<div class="cw-AlertDialog-text"id={s}>
|
|
@@ -18,18 +18,18 @@ import{createUniqueId as l,untrack as F}from"solid-js";import{insert as _}from"s
|
|
|
18
18
|
<D attr:data-cw-dialog-action="dismiss"class="cw-AlertDialog-dismiss"size="sm"variant="text">{t.dismissLabel??"Cancel"}</D>
|
|
19
19
|
<D attr:data-cw-dialog-action="confirm"class="cw-AlertDialog-confirm"size="sm"variant="text">{t.confirmLabel??"OK"}</D>
|
|
20
20
|
</div>
|
|
21
|
-
</dialog
|
|
21
|
+
</dialog>;}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#r),super.onControllerCleanup();}}const Y=/* @__PURE__ */w(()=>j,()=>G),me=n=>Y(P(n,U)),Q=["children","closeIcon","confirmLabel","title"];function W(n,e){const t=l();return<dialog{...A(n,e,{classes:{[I]:e.confirmLabel===void 0,"cw-FullScreenDialog":!0,"cw-FullScreenDialog-open":C(e)},label:e.title===void 0?"Dialog":void 0,labelledBy:e.label===void 0&&e.title!==void 0?t:void 0,role:"dialog"})}>
|
|
22
22
|
<div class={`cw-FullScreenDialog-header ${v}`}>
|
|
23
23
|
<T attr:aria-label={e.closeLabel??"Close"}attr:data-cw-dialog-action="dismiss"class="cw-FullScreenDialog-close"size="sm">{e.closeIcon??"close"}</T>
|
|
24
24
|
<h2 class="cw-FullScreenDialog-title"id={t}>{e.title}</h2>
|
|
25
25
|
<D attr:data-cw-dialog-action="confirm"class="cw-FullScreenDialog-confirm"size="sm"variant="text">{e.confirmLabel}</D>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="cw-FullScreenDialog-content">{n.children}</div>
|
|
28
|
-
</dialog
|
|
28
|
+
</dialog>;}class Z extends x{#n;#o;#l;#t;#r;constructor(e){super(e,"cw-FullScreenDialog"),this.#l=l(),this.#t=null,this.#r=!1;const t=super.consumeProps([],["onConfirm","onDismiss"]);this.#n=t.onConfirm,this.#o=t.onDismiss;}defaultLabel(){return this.props.label??(this.props.title===void 0?"Dialog":void 0);}defaultLabelledBy(){return this.props.label===void 0&&this.props.title!==void 0?this.#l:void 0;}#u=e=>{const t=B(this.styleElement,e);t==="confirm"?(this.#n?.(e),e.defaultPrevented||this.close("confirm",e)):t==="dismiss"&&(this.#o?.(e),e.defaultPrevented||this.close("dismiss",e));};#e=()=>{const e=(this.#t?.scrollTop??0)>0;e!==this.#r&&(this.#r=e,super.setClass($,e));};applyComponentProps(){const e=super.readProps(["confirmLabel"]);super.applyComponentProps(),e.confirmLabelChanged&&super.setClass(I,e.confirmLabel===void 0);}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onStyleElementChanged(e),this.#t=e?.querySelector(".cw-FullScreenDialog-content")??null,e?.addEventListener("click",this.#u),this.#t?.addEventListener("scroll",this.#e,{passive:!0});}render(e){const t=this.props,i=this.#l;return<dialog class="cw-FullScreenDialog">
|
|
29
29
|
<div class={`cw-FullScreenDialog-header ${v}`}>
|
|
30
30
|
<T attr:aria-label={t.closeLabel??"Close"}attr:data-cw-dialog-action="dismiss"class="cw-FullScreenDialog-close"size="sm">{t.closeIcon??"close"}</T>
|
|
31
31
|
<h2 class="cw-FullScreenDialog-title"id={i}>{t.title}</h2>
|
|
32
32
|
<D attr:data-cw-dialog-action="confirm"class="cw-FullScreenDialog-confirm"size="sm"variant="text">{t.confirmLabel}</D>
|
|
33
33
|
</div>
|
|
34
34
|
<div class="cw-FullScreenDialog-content">{e}</div>
|
|
35
|
-
</dialog
|
|
35
|
+
</dialog>;}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#u),this.#t?.removeEventListener("scroll",this.#e),super.onControllerCleanup();}}const ee=/* @__PURE__ */w(()=>W,()=>Z),pe=n=>ee(P(n,Q));export{me as AlertDialog,G as AlertDialogController,he as Dialog,x as DialogController,pe as FullScreenDialog,Z as FullScreenDialogController,B as actionOf,E as activeElementOf,A as dialogAttributesOf,C as isInitiallyOpen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import{DomController as d}from"../dom/client";import"./surface.css";function r(i,e){return i===!0?"vertical":e??"horizontal"}function o(i){return typeof i!="number"?i:Number.isFinite(i)?`${Math.max(0,i)}px`:void 0}function c(i,e){const t=r(e.vertical,e.orientation),n=e.semantic!==!1;return<div aria-orientation={n&&t==="vertical"?"vertical":void 0}{...i}classList={{...i.classList,[`_cw-Divider-${t}`]:!0,[`_cw-Divider-inset-${e.inset??"none"}`]:!0,"cw-Divider":!0}}role={n?"separator":void 0}style={{...i.style,"--_cw-Divider-thickness":o(e.thickness)}}
|
|
1
|
+
import{insert as s}from"solid-js/web";import{defineDomComponent as a}from"..";import{DomController as d}from"../dom/client";import"./surface.css";function r(i,e){return i===!0?"vertical":e??"horizontal";}function o(i){return typeof i!="number"?i:Number.isFinite(i)?`${Math.max(0,i)}px`:void 0;}function c(i,e){const t=r(e.vertical,e.orientation),n=e.semantic!==!1;return<div aria-orientation={n&&t==="vertical"?"vertical":void 0}{...i}classList={{...i.classList,[`_cw-Divider-${t}`]:!0,[`_cw-Divider-inset-${e.inset??"none"}`]:!0,"cw-Divider":!0}}role={n?"separator":void 0}style={{...i.style,"--_cw-Divider-thickness":o(e.thickness)}}/>;}class m extends d{#e;constructor(e){super(e,{styleElementIsFunction:!0}),this.#e="attr:aria-orientation"in e;}applyComponentProps(){const e=super.readProps(["inset","orientation","semantic","thickness","vertical"]),t=r(e.vertical,e.orientation),n=e.semantic!==!1;(e.orientationChanged||e.verticalChanged)&&super.setClass("orientation",`_cw-Divider-${t}`),e.insetChanged&&super.setClass("inset",`_cw-Divider-inset-${e.inset??"none"}`),e.semanticChanged&&super.setAttribute("role",n?"separator":void 0),!this.#e&&(e.semanticChanged||e.orientationChanged||e.verticalChanged)&&super.setAttribute("aria-orientation",n&&t==="vertical"?"vertical":void 0),e.thicknessChanged&&super.setStyle("--_cw-Divider-thickness",o(e.thickness));}render(e){const t=<div class="cw-Divider"/>;return s(t,e),t;}}const f=/* @__PURE__ */a(()=>c,()=>m);export{f as Divider,m as DividerController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VelocityTracker as l}from"../motion";const u=125,m=8e3,b=40;function i(t,e,n){let r=e,o=1/0;for(const a of t){const s=n===!1?e-a:a-e,c=n===void 0?Math.abs(s):s<0?1/0:s;c<=o&&(r=a,o=c)}return r}function E(t,e,n,r){if(n===0)return i(t,e);const o=n>0;if(Math.abs(n)>=u)return i(t,e,o);const a=i(t,e,!1),s=i(t,e,!0);return Math.abs((o?a:s)-e)>=r===o?s:a}function d(t){const e=typeof t.getCoalescedEvents=="function"?t.getCoalescedEvents():[];return e.length>0?e:[t]}class p{#e;#t;constructor(){this.#e=new l,this.#t=0}reset(){this.#e.resetTracking()}track(e,n){for(const r of d(e))this.#e.addDataPoint(r.timeStamp,n(r));this.#t=e.timeStamp}release(e){return e.timeStamp-this.#t>b?0:this.#e.calculateVelocity(m)}}export{p as DragVelocity,u as FLING_VELOCITY_THRESHOLD,m as MAX_FLING_VELOCITY,b as POINTER_STOPPED_MSEC,i as closestAnchorOf,d as coalescedEventsOf,E as settleTargetOf};
|
|
1
|
+
import{VelocityTracker as l}from"../motion";const u=125,m=8e3,b=40;function i(t,e,n){let r=e,o=1/0;for(const a of t){const s=n===!1?e-a:a-e,c=n===void 0?Math.abs(s):s<0?1/0:s;c<=o&&(r=a,o=c);}return r;}function E(t,e,n,r){if(n===0)return i(t,e);const o=n>0;if(Math.abs(n)>=u)return i(t,e,o);const a=i(t,e,!1),s=i(t,e,!0);return Math.abs((o?a:s)-e)>=r===o?s:a;}function d(t){const e=typeof t.getCoalescedEvents=="function"?t.getCoalescedEvents():[];return e.length>0?e:[t];}class p{#e;#t;constructor(){this.#e=new l(),this.#t=0;}reset(){this.#e.resetTracking();}track(e,n){for(const r of d(e))this.#e.addDataPoint(r.timeStamp,n(r));this.#t=e.timeStamp;}release(e){return e.timeStamp-this.#t>b?0:this.#e.calculateVelocity(m);}}export{p as DragVelocity,u as FLING_VELOCITY_THRESHOLD,m as MAX_FLING_VELOCITY,b as POINTER_STOPPED_MSEC,i as closestAnchorOf,d as coalescedEventsOf,E as settleTargetOf};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{createSignal as u,onCleanup as f,untrack as h}from"solid-js";import{defineDomComponent as c}from"..";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as p}from"../dom/client";import{CircularProgressIndicator as E}from"../feedback/progress";import{applySpringMotion as y,subscribeMotionFrames as g}from"../motion";import{DragVelocity as T,settleTargetOf as P}from"./drag";import"../container/elevation-shadow.css";import"./gestures.css";import{Carousel as $,CarouselController as G,CarouselItem as j,CarouselSlide as B}from"./carousel";const l=8,S=56,w
|
|
1
|
+
import{createSignal as u,onCleanup as f,untrack as h}from"solid-js";import{defineDomComponent as c}from"..";import{ELEVATION_SHADOW_CSS_CLASS as v}from"../container/elevation-shadow";import{DomController as p}from"../dom/client";import{CircularProgressIndicator as E}from"../feedback/progress";import{applySpringMotion as y,subscribeMotionFrames as g}from"../motion";import{DragVelocity as T,settleTargetOf as P}from"./drag";import"../container/elevation-shadow.css";import"./gestures.css";import{Carousel as $,CarouselController as G,CarouselItem as j,CarouselSlide as B}from"./carousel";const l=8,S=56,w=0.05,d="--cw-swipe-offset",D=160,L=24,C=80,R=40,I=2,M="a[href], area[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1'])";function x(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&n.matches("input, textarea, select, [contenteditable]:not([contenteditable=false])");}function m(n,e){return<div{...n}classList={{...n.classList,"cw-SwipeToDismiss":!0,"cw-SwipeToDismiss-disabled":e.disabled===!0,[`_cw-SwipeToDismiss-${e.axis??"horizontal"}`]:!0}}data-cw-swipe-axis={e.axis??"horizontal"}>
|
|
2
2
|
<div aria-hidden="true"class="cw-SwipeToDismiss-background"inert>{e.background}</div>
|
|
3
3
|
<div class="cw-SwipeToDismiss-content">{n.children}</div>
|
|
4
|
-
</div
|
|
4
|
+
</div>;}class O extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=null,this.#u=null,this.#a=h(()=>e.axis??"horizontal"),this.#h=void 0,this.#p=!1,this.#i=0,this.#b=0,this.#e=0,this.#n=0,this.#o=new T(),this.#s=void 0,this.#m=0,this.#f=void 0,this.#d=void 0,this.#l=!1,f(()=>{this.#w(),this.#y(),this.#R(this.#t,!1);});}offset(){return this.#s?.value??this.#e;}dismiss(e){this.#C(e??(this.#a==="horizontal"?"start":"up"));}reset(){this.#w(),this.#y(),this.#l=!1,this.#e=0,this.#t?.classList.remove("cw-SwipeToDismiss-dismissed"),this.#t?.removeAttribute("aria-hidden"),this.#T(void 0),this.#u!==null&&(this.#u.inert=!1);}#r=(e,t=!1)=>this.#a==="horizontal"!==t?e.clientX:e.clientY;#v(e){const t=e.getBoundingClientRect();return this.#a==="horizontal"?t.width:t.height;}#T(e){e===void 0?this.#u?.style.removeProperty(d):this.#u?.style.setProperty(d,`${e}px`);}#L(){const e=this.#t;return e?.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl";}#P(e){return this.#a==="vertical"?e<0?"up":"down":e<0!==this.#L()?"start":"end";}#E(e,t,i){const s=this.#u,o=s?.ownerDocument.defaultView,a=this.#s?.playState==="running"?this.#s:void 0;if(s===null)return;if(this.#m=e,this.#f=i,a!==void 0){a.retarget(e);return;}const r=y(s,d,this.#e,e,{role:"spatial",speed:"default",unit:"px",velocity:t});this.#s=r,o!=null&&r.playState==="running"&&this.props.onOffsetChange!==void 0&&(this.#d=g(o,this.#S)),r.finished.then(()=>this.#I(r),()=>{});}#S=()=>{const e=this.#s;e!==void 0&&h(()=>this.props.onOffsetChange?.(e.value));};#I(e){const t=this.#m,i=this.#f;e===this.#s&&(this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,this.#e=t,h(()=>this.props.onOffsetChange?.(t)),t!==0&&this.#M(this.#P(t),i));}#w(){const e=this.#s;this.#d?.(),this.#d=void 0,this.#s=void 0,this.#f=void 0,e!==void 0&&(e.cancel(),this.#e=e.value);}#C(e,t){const i=this.#t,s=this.#L();if(i===null||this.#l||this.props.disabled===!0)return;const o=e==="up"||e==="start"&&!s||e==="end"&&s;this.#y(),this.#n=this.#v(i),this.#E(o?-this.#n:this.#n,0,t);}#M(e,t){const i=this.#t,s=this.#u;i===null||s===null||(this.#l=!0,this.#D(),i.classList.add("cw-SwipeToDismiss-dismissed"),i.setAttribute("aria-hidden","true"),s.inert=!0,h(()=>this.props.onDismiss?.(e,t)));}#D(){const e=this.#t,t=e?.ownerDocument,i=t?.activeElement;if(e===null||t===void 0||i==null||!e.contains(i))return;const s=Array.from(t.querySelectorAll(M)).filter(r=>!e.contains(r)&&r.closest("[inert]")===null&&r.checkVisibility({visibilityProperty:!0})),o=s.findIndex(r=>(e.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)!==0),a=o<0?s[s.length-1]:s[o];a===void 0?i.blur():a.focus();}#c(e){try{this.#t?.setPointerCapture(e);}catch{return this.#g(),!1;}return this.#p=!0,this.#t?.classList.add("cw-SwipeToDismiss-dragging"),!0;}#y(){const e=this.#h;if(this.#h=void 0,e!==void 0&&this.#p)try{this.#t?.releasePointerCapture(e);}catch{}this.#p=!1,this.#t?.classList.remove("cw-SwipeToDismiss-dragging");}#g(){this.#l||(this.#w(),this.#y(),this.#e=0,this.#T(void 0));}#H=e=>{const t=this.#t,i=this.#s?.playState==="running";t===null||this.props.disabled===!0||this.#l||this.#h!==void 0||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0||(this.#w(),this.#h=e.pointerId,this.#n=this.#v(t),this.#i=this.#r(e)-this.#e,this.#b=this.#r(e,!0),this.#o.reset(),this.#o.track(e,this.#r),i&&this.#c(e.pointerId));};#x=e=>{if(this.#h!==e.pointerId)return;const t=this.#r(e)-this.#i;if(this.#o.track(e,this.#r),!this.#p){const i=this.#r(e,!0)-this.#b;if(Math.abs(i)>l&&Math.abs(i)>Math.abs(t)){this.#g();return;}if(Math.abs(t)<=l||!this.#c(e.pointerId))return;}this.#e=Math.max(-this.#n,Math.min(this.#n,t)),this.#T(this.#e),h(()=>this.props.onOffsetChange?.(this.#e,e));};#O(e,t){const i=this.props.threshold,s=this.#n,a=i!==void 0&&Number.isFinite(i)?Math.min(1,Math.max(w,i))*s:Math.min(S,s);if(this.#h!==e.pointerId)return;if(!this.#p){this.#h=void 0;return;}const r=t?0:this.#o.release(e);this.#y(),t?this.#E(0,r):this.#E(P([-s,0,s],this.#e,r,a),r,e);}#_=e=>this.#O(e,!1);#A=e=>this.#O(e,!0);#X=e=>{!this.#p&&this.#h===e.pointerId&&(this.#h=void 0);};#k=e=>{e.key!=="Delete"||e.defaultPrevented||e.repeat||x(e.target)||this.props.disabled===!0||this.#l||(e.preventDefault(),this.#C(this.#a==="horizontal"?"start":"up",e));};#R(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("pointerdown",this.#H),e?.[i]("pointermove",this.#x),e?.[i]("pointerup",this.#_),e?.[i]("pointercancel",this.#A),e?.[i]("lostpointercapture",this.#A),e?.[i]("pointerleave",this.#X),e?.[i]("keydown",this.#k);}applyComponentProps(){const e=super.readProps(["axis","disabled"]);e.axisChanged&&(this.#g(),this.#a=e.axis??"horizontal",super.setClass("axis",`_cw-SwipeToDismiss-${this.#a}`),super.setAttribute("data-cw-swipe-axis",this.#a)),e.disabledChanged&&(e.disabled===!0&&this.#g(),super.setClass("cw-SwipeToDismiss-disabled",e.disabled===!0));}onStyleElementChanged(e){this.#g(),this.#R(this.#t,!1),super.onStyleElementChanged(e),this.#t=e,this.#u=e?.querySelector(":scope > .cw-SwipeToDismiss-content")??null,this.#R(this.#t,!0);}render(e){const t=this.props;return h(()=>m({children:e},{axis:t.axis,get background(){return t.background;},disabled:t.disabled}));}}const V=/* @__PURE__ */c(()=>m,()=>O);function A(n,e){return<E attr:aria-hidden="true"indeterminate={e()}size={24}strokeWidth={2.5}value={Math.min(1,n())}/>;}function b(n,e,t,i){const s=("refreshing"in e?e.refreshing:e.defaultRefreshing)===!0;return<div{...n}aria-busy={s?"true":"false"}aria-disabled={e.disabled===!0?"true":void 0}aria-keyshortcuts="Enter"aria-label={n["aria-label"]??e.label??"Pull to refresh"}classList={{...n.classList,"cw-PullToRefresh":!0,"cw-PullToRefresh-at-start":!0,"cw-PullToRefresh-disabled":e.disabled===!0,"cw-PullToRefresh-refreshing":s}}data-cw-pull-to-refresh="true"role="region"tabIndex={e.tabIndex??0}>
|
|
5
5
|
<div class={`cw-PullToRefresh-indicator ${v}`}>{e.indicator??A(t??(()=>s?1:0),i??(()=>s))}</div>
|
|
6
6
|
<div class="cw-PullToRefresh-content">{n.children}</div>
|
|
7
|
-
</div
|
|
7
|
+
</div>;}class H extends p{#t;#u;#a;#h;#p;#i;#b;#e;#n;#o;#s;#m;#f;#d;#l;#r;#v;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="refreshing"in e,this.#e=h(()=>(this.#t?e.refreshing:e.defaultRefreshing)===!0);const[t,i]=u(this.#e?1:0),[s,o]=u(this.#e);this.#u=t,this.#a=i,this.#h=s,this.#p=o,this.#i=null,this.#b=null,this.#n=void 0,this.#o=void 0,this.#s=!1,this.#m=0,this.#f=0,this.#d=0,this.#l=0,this.#r=!1,this.#v=!1,f(()=>{this.#l++,this.#r=!1,this.#c(),this.#F(this.#i,!1);});}complete(e){!this.#t&&this.#e&&this.#P(!1,e);}#T(){const e=this.props.threshold;return e===void 0||!Number.isFinite(e)?D:Math.max(L,e);}#L(e){const t=this.#b;if(this.#a(e??(this.#e?1:0)),t===null)return;if(e===void 0){t.style.removeProperty("transform");return;}const i=Math.min(I,Math.max(0,e-1)),s=Math.min(1,e)+i-i*i/4;t.style.transform=`translateY(${s*C-R}px)`;}#P(e,t,i=!0){this.#e=e,this.#p(e),this.#a(e?1:0),super.setClass("cw-PullToRefresh-refreshing",e),super.setAttribute("aria-busy",e?"true":"false"),i&&this.#E(e,t);}#E(e,t){h(()=>this.props.onRefreshingChange?.(e,t));}#S(e,t){e===this.#l&&(this.#r=!1,this.#t?this.#e&&this.#v&&this.#E(!1,t):this.#P(!1),this.#v=!1);}#I(e){if(this.props.disabled===!0||this.#e||this.#r)return;const t=++this.#l;let i;this.#r=!0,this.#t?this.#E(!0,e):this.#P(!0,e);try{i=h(()=>this.props.onRefresh?.(e));}catch(s){throw this.#S(t,e),s;}i instanceof Promise?i.then(()=>this.#S(t,e),()=>this.#S(t,e)):queueMicrotask(()=>this.#S(t,e));}#w(){return this.#b?.getAnimations().some(e=>"transitionProperty"in e&&e.transitionProperty==="transform"&&e.playState==="running")===!0;}#C(){return this.props.disabled!==!0&&!this.#e&&!this.#r&&this.#n===void 0&&this.#o===void 0&&this.#i!==null&&this.#i.scrollTop<=0&&!this.#w();}#M(e,t,i){const s=t-this.#m,o=e-this.#f;if(!this.#s){const a=Math.abs(o);if(s<-l||a>l&&a>Math.abs(s))return this.#c(),!1;if(s<=l)return!1;if(!i())return this.#c(),!1;this.#s=!0,this.#i?.classList.add("cw-PullToRefresh-dragging");}return this.#d=Math.max(0,s),this.#L(this.#d/this.#T()),!0;}#D(e,t){const i=this.#d,s=this.#s;this.#c(),s&&!t&&i>=this.#T()&&this.#I(e);}#c(){const e=this.#n;if(e!==void 0&&this.#s)try{this.#i?.releasePointerCapture(e);}catch{}this.#n=void 0,this.#o=void 0,this.#s=!1,this.#d=0,this.#i?.classList.remove("cw-PullToRefresh-dragging"),this.#L(void 0);}#y=e=>{e.pointerType==="touch"||!e.isPrimary||e.button!==0||!this.#C()||(this.#n=e.pointerId,this.#m=e.clientY,this.#f=e.clientX);};#g=e=>{const t=this.#i;e.pointerId!==this.#n||t===null||this.#M(e.clientX,e.clientY,()=>{try{return t.setPointerCapture(e.pointerId),!0;}catch{return!1;}});};#H=e=>{e.pointerId===this.#n&&this.#D(e,!1);};#x=e=>{e.pointerId===this.#n&&this.#D(e,!0);};#O=e=>{!this.#s&&e.pointerId===this.#n&&this.#c();};#_(e){return Array.from(e.touches).find(t=>t.identifier===this.#o)??Array.from(e.changedTouches).find(t=>t.identifier===this.#o);}#A=e=>{const t=e.touches[0];e.touches.length!==1||t===void 0||!this.#C()||(this.#o=t.identifier,this.#m=t.clientY,this.#f=t.clientX);};#X=e=>{const t=this.#o===void 0?void 0:this.#_(e);if(t===void 0||this.#i===null)return;const i=t.clientY-this.#m,s=t.clientX-this.#f;i>0&&i>=Math.abs(s)&&e.cancelable&&e.preventDefault(),this.#M(t.clientX,t.clientY,()=>!0)&&e.cancelable&&e.preventDefault();};#k=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!1);};#R=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#o)&&this.#D(e,!0);};#z=e=>{e.key!=="Enter"||e.defaultPrevented||e.repeat||e.target!==this.#i||this.props.disabled===!0||this.#e||this.#r||(e.preventDefault(),this.#I(e));};#N=()=>{this.#i?.classList.toggle("cw-PullToRefresh-at-start",this.#i.scrollTop<=0);};#F(e,t){const i=t?"addEventListener":"removeEventListener";e?.[i]("scroll",this.#N,{passive:!0}),e?.[i]("pointerdown",this.#y),e?.[i]("pointermove",this.#g),e?.[i]("pointerup",this.#H),e?.[i]("pointercancel",this.#x),e?.[i]("lostpointercapture",this.#x),e?.[i]("pointerleave",this.#O),e?.[i]("touchstart",this.#A,{passive:!0}),e?.[i]("touchmove",this.#X,{passive:!1}),e?.[i]("touchend",this.#k),e?.[i]("touchcancel",this.#R),e?.[i]("keydown",this.#z);}applyComponentProps(){const e=super.readProps(["disabled","label","refreshing","tabIndex","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Pull to refresh";if(super.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),e.tabIndexChanged&&super.setAttribute("tabindex",e.tabIndex??0),e.disabledChanged&&(e.disabled===!0&&this.#c(),super.setAttribute("aria-disabled",e.disabled===!0?"true":void 0),super.setClass("cw-PullToRefresh-disabled",e.disabled===!0)),!this.#t||!e.refreshingChanged)return;const i=e.refreshing===!0;this.#P(i,void 0,!1),i&&this.#c(),this.#r&&(i?this.#v=!0:(this.#r=!1,this.#v=!1,this.#l++));}onStyleElementChanged(e){this.#c(),this.#F(this.#i,!1),super.onStyleElementChanged(e),this.#i=e,this.#b=e?.querySelector(":scope > .cw-PullToRefresh-indicator")??null,this.#F(this.#i,!0),this.#N();}render(e){const t=this.props;return h(()=>b({children:e},{defaultRefreshing:this.#e,disabled:t.disabled,get indicator(){return t.indicator;},label:t["attr:aria-label"]??t.label,tabIndex:t.tabIndex},this.#u,this.#h));}}const q=/* @__PURE__ */c(()=>b,()=>H);export{$ as Carousel,G as CarouselController,j as CarouselItem,B as CarouselSlide,q as PullToRefresh,H as PullToRefreshController,V as SwipeToDismiss,O as SwipeToDismissController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./surface.css";import{Surface as t,SurfaceController as l}from"./surface";import{Divider as i,DividerController as p}from"./divider";import{List as n,ListController as m,ListItem as f,ListItemController as d}from"./list";import{ExpandedListItem as u,ExpandedListItemController as P,RevealListItem as C,RevealListItemController as x,ReorderableList as c,ReorderableListController as M,ReorderHandle as h}from"./list-patterns";import{AlertDialog as L,AlertDialogController as D,Dialog as g,DialogController as R,FullScreenDialog as B,FullScreenDialogController as y}from"./dialog";import{Menu as w,MenuCheckboxItem as v,MenuCheckboxItemController as T,MenuController as A,MenuGroup as E,MenuGroupController as F,MenuItem as H,MenuItemController as k,MenuRadioItem as z,MenuRadioItemController as G,SubMenu as O}from"./menu";import{BottomSheet as j,BottomSheetController as q,ModalBottomSheet as J,ModalBottomSheetController as K}from"./sheet";import{BottomSheetScaffold as Q,ListDetailPaneScaffold as U,ListDetailPaneScaffoldController as V,Scaffold as X,ScaffoldController as Y,SupportingPaneScaffold as Z,SupportingPaneScaffoldController as _,createWindowSizeClass as $,windowSizeClassOf as ee}from"./scaffold";import{ModalSideSheet as re,SideSheetController as te,StandardSideSheet as le}from"./side-sheet";import{Carousel as ie,CarouselController as pe,CarouselItem as ae,CarouselSlide as ne}from"./carousel";import{PullToRefresh as fe,PullToRefreshController as de,SwipeToDismiss as Se,SwipeToDismissController as ue}from"./gestures";export{L as AlertDialog,D as AlertDialogController,j as BottomSheet,q as BottomSheetController,Q as BottomSheetScaffold,ie as Carousel,pe as CarouselController,ae as CarouselItem,ne as CarouselSlide,g as Dialog,R as DialogController,i as Divider,p as DividerController,u as ExpandedListItem,P as ExpandedListItemController,B as FullScreenDialog,y as FullScreenDialogController,n as List,m as ListController,U as ListDetailPaneScaffold,V as ListDetailPaneScaffoldController,f as ListItem,d as ListItemController,w as Menu,v as MenuCheckboxItem,T as MenuCheckboxItemController,A as MenuController,E as MenuGroup,F as MenuGroupController,H as MenuItem,k as MenuItemController,z as MenuRadioItem,G as MenuRadioItemController,J as ModalBottomSheet,K as ModalBottomSheetController,re as ModalSideSheet,fe as PullToRefresh,de as PullToRefreshController,h as ReorderHandle,c as ReorderableList,M as ReorderableListController,C as RevealListItem,x as RevealListItemController,X as Scaffold,Y as ScaffoldController,te as SideSheetController,le as StandardSideSheet,O as SubMenu,Z as SupportingPaneScaffold,_ as SupportingPaneScaffoldController,t as Surface,l as SurfaceController,Se as SwipeToDismiss,ue as SwipeToDismissController,$ as createWindowSizeClass,ee as windowSizeClassOf};
|
|
1
|
+
import"./surface.css";import{Surface as t,SurfaceController as l}from"./surface";import{Divider as i,DividerController as p}from"./divider";import{List as n,ListController as m,ListItem as f,ListItemController as d}from"./list";import{ExpandedListItem as u,ExpandedListItemController as P,RevealListItem as C,RevealListItemController as x,ReorderableList as c,ReorderableListController as M,ReorderHandle as h}from"./list-patterns";import{AlertDialog as L,AlertDialogController as D,Dialog as g,DialogController as R,FullScreenDialog as B,FullScreenDialogController as y}from"./dialog";import{Menu as w,MenuCheckboxItem as v,MenuCheckboxItemController as T,MenuController as A,MenuGroup as E,MenuGroupController as F,MenuItem as H,MenuItemController as k,MenuRadioItem as z,MenuRadioItemController as G,SubMenu as O}from"./menu";import{BottomSheet as j,BottomSheetController as q,ModalBottomSheet as J,ModalBottomSheetController as K}from"./sheet";import{BottomSheetScaffold as Q,ListDetailPaneScaffold as U,ListDetailPaneScaffoldController as V,Scaffold as X,ScaffoldController as Y,SupportingPaneScaffold as Z,SupportingPaneScaffoldController as _,createWindowSizeClass as $,windowSizeClassOf as ee}from"./scaffold";import{ModalSideSheet as re,SideSheetController as te,StandardSideSheet as le}from"./side-sheet";import{Carousel as ie,CarouselController as pe,CarouselItem as ae,CarouselSlide as ne}from"./carousel";import{PullToRefresh as fe,PullToRefreshController as de,SwipeToDismiss as Se,SwipeToDismissController as ue}from"./gestures";export{L as AlertDialog,D as AlertDialogController,j as BottomSheet,q as BottomSheetController,Q as BottomSheetScaffold,ie as Carousel,pe as CarouselController,ae as CarouselItem,ne as CarouselSlide,g as Dialog,R as DialogController,i as Divider,p as DividerController,u as ExpandedListItem,P as ExpandedListItemController,B as FullScreenDialog,y as FullScreenDialogController,n as List,m as ListController,U as ListDetailPaneScaffold,V as ListDetailPaneScaffoldController,f as ListItem,d as ListItemController,w as Menu,v as MenuCheckboxItem,T as MenuCheckboxItemController,A as MenuController,E as MenuGroup,F as MenuGroupController,H as MenuItem,k as MenuItemController,z as MenuRadioItem,G as MenuRadioItemController,J as ModalBottomSheet,K as ModalBottomSheetController,re as ModalSideSheet,fe as PullToRefresh,de as PullToRefreshController,h as ReorderHandle,c as ReorderableList,M as ReorderableListController,C as RevealListItem,x as RevealListItemController,X as Scaffold,Y as ScaffoldController,te as SideSheetController,le as StandardSideSheet,O as SubMenu,Z as SupportingPaneScaffold,_ as SupportingPaneScaffoldController,t as Surface,l as SurfaceController,Se as SwipeToDismiss,ue as SwipeToDismissController,$ as createWindowSizeClass,ee as windowSizeClassOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const l="button, a[href], area[href], input, select, textarea, label, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1']), [role=button], [role=link], [role=checkbox], [role=radio], [role=switch], [role=slider], [role=scrollbar], [role=spinbutton], [role=textbox], [role=combobox], [role=menuitem], [role=menuitemcheckbox], [role=menuitemradio], [role=tab], [role=option], [role=treeitem], [role=gridcell], [role=listbox], [aria-controls], [aria-haspopup]";function i(e){return e!==null&&typeof e=="object"&&e.nodeType===1}function a(e,r,n){let t=e;if(n!==void 0)for(const o of n){if(o===r)break;if(i(o)&&o.matches(l))return!0}for(;t!==null&&t!==r;){if(t.matches(l))return!0;t=t.parentElement}return!1}export{a as hasNestedInteractive,i as isElementNode};
|
|
1
|
+
const l="button, a[href], area[href], input, select, textarea, label, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable=false]), [tabindex]:not([tabindex='-1']), [role=button], [role=link], [role=checkbox], [role=radio], [role=switch], [role=slider], [role=scrollbar], [role=spinbutton], [role=textbox], [role=combobox], [role=menuitem], [role=menuitemcheckbox], [role=menuitemradio], [role=tab], [role=option], [role=treeitem], [role=gridcell], [role=listbox], [aria-controls], [aria-haspopup]";function i(e){return e!==null&&typeof e=="object"&&e.nodeType===1;}function a(e,r,n){let t=e;if(n!==void 0)for(const o of n){if(o===r)break;if(i(o)&&o.matches(l))return!0;}for(;t!==null&&t!==r;){if(t.matches(l))return!0;t=t.parentElement;}return!1;}export{a as hasNestedInteractive,i as isElementNode};
|
|
@@ -10,7 +10,7 @@ import{createUniqueId as P,mergeProps as C,onCleanup as L,onMount as J,untrack a
|
|
|
10
10
|
</summary>
|
|
11
11
|
<div class="cw-ExpandedListItem-body">{r.children}</div>
|
|
12
12
|
</details>
|
|
13
|
-
</li
|
|
13
|
+
</li>;}class K extends g{#t;#i;#s;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="open"in e,this.#i=null,this.#s=l(()=>(this.#t?e.open:e.defaultOpen)===!0),L(()=>this.#n(this.styleElement,!1));}#e=e=>{const t=this.#i,n=l(()=>this.props.disabled===!0);t===null||t.open===this.#s||(n||l(()=>this.props.onOpenChange?.(t.open,e)),!this.#t&&!n?this.#s=t.open:this.#s=l(()=>this.#t?this.props.open===!0:this.#s),t.open=this.#s);};#r=e=>{e.type==="keydown"&&!["Enter"," "].includes(e.key)||l(()=>this.props.disabled===!0)&&c(e.target)&&e.target.closest("summary")?.parentElement===this.#i&&e.preventDefault();};#n(e,t){const n=t?"addEventListener":"removeEventListener";this.#i?.[n]("toggle",this.#e),e?.[n]("click",this.#r),e?.[n]("keydown",this.#r);}applyComponentProps(){const e=super.readProps(["disabled","open","supportingText"]),t=this.#i?.querySelector(":scope > summary");this.#t&&e.openChanged&&(this.#s=e.open===!0),this.#i!==null&&this.#i.open!==this.#s&&(this.#i.open=this.#s),e.disabledChanged&&e.disabled===!0?(t?.setAttribute("aria-disabled","true"),t?.setAttribute("tabindex","-1")):e.disabledChanged&&(t?.removeAttribute("aria-disabled"),t?.removeAttribute("tabindex")),e.supportingTextChanged&&t?.querySelector(".cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0);}onStyleElementChanged(e){this.#n(super.styleElement,!1),super.onStyleElementChanged(e),this.#i=e?.querySelector(":scope > details")??null,this.#n(e,!0);}render(e){const t=this.props;return l(()=>H({children:e},{defaultOpen:this.#s,disabled:t.disabled,get headline(){return t.headline;},get leading(){return t.leading;},get supportingText(){return t.supportingText;}}));}}const G=/* @__PURE__ */f(()=>H,()=>K),Le=r=>G(x(r,["children","headline","leading","supportingText"]));function A(r,e,t){const n=("expanded"in e?e.expanded:e.defaultExpanded)===!0,s=l(()=>e.supportingText===void 0),i=e.hideLabel??"Hide actions",o=e.revealLabel??"Show actions";return<li{...r}classList={{...r.classList,"cw-RevealListItem":!0,"cw-RevealListItem-expanded":n}}>
|
|
14
14
|
<div class="cw-RevealListItem-row">
|
|
15
15
|
<span class="cw-ListItem-leading">{e.leading}</span>
|
|
16
16
|
<span class="cw-ListItem-content">
|
|
@@ -20,7 +20,7 @@ import{createUniqueId as P,mergeProps as C,onCleanup as L,onMount as J,untrack a
|
|
|
20
20
|
<button aria-controls={t}aria-expanded={n?"true":"false"}aria-label={n?i:o}class="cw-RevealListItem-toggle"disabled={e.disabled===!0}type="button"><R autoMirror name={z}/></button>
|
|
21
21
|
</div>
|
|
22
22
|
<div aria-hidden={n?void 0:"true"}class="cw-RevealListItem-actions"id={t}inert={!n}>{e.actions}</div>
|
|
23
|
-
</li
|
|
23
|
+
</li>;}class W extends g{#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;#L;#v;#b;#a;#m;#w;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t=`cw-reveal-${P()}`,this.#i="expanded"in e,this.#s=new M(),this.#e=l(()=>(this.#i?e.expanded:e.defaultExpanded)===!0),this.#r=null,this.#n=null,this.#l=0,this.#d=this.#e?1:0,this.#u=0,this.#o=void 0,this.#p=!1,this.#L=0,this.#v=0,this.#b=!1,this.#a=void 0,this.#m=void 0,this.#w=!1,J(()=>this.#M()),L(()=>{this.#w=!0,this.#c(),this.#a?.cancel(),this.#m?.disconnect(),this.#g(this.styleElement,!1);});}#E(e,t,n=0){!this.#w&&e!==this.#e&&l(()=>this.props.disabled!==!0)&&(l(()=>this.props.onExpandedChange?.(e,t)),this.#i||(this.#e=e),this.#y()),this.#f(n);}#y(){const e=this.#r,t=this.#n,n=this.#e,s=l(()=>this.props.hideLabel??"Hide actions"),i=l(()=>this.props.revealLabel??"Show actions");super.setClass("cw-RevealListItem-expanded",n),e?.setAttribute("aria-expanded",n?"true":"false"),e?.setAttribute("aria-label",n?s:i),t!==null&&(!n&&t.contains(t.ownerDocument.activeElement)&&e?.focus(),t.inert=!n,t.toggleAttribute("aria-hidden",!n));}#R(e){this.#d=e,super.setStyle(I,`${e}`);}#f(e){const t=this.styleElement,n=this.#e?1:0,s=this.#a?.playState==="running"?this.#a:void 0;if(t===null)return;if(s!==void 0){s.retarget(n);return;}if(this.#d===n&&e===0){this.#R(n);return;}const i=T(t,I,this.#d,n,{role:"spatial",speed:"default",velocity:e});this.#a=i,super.setClass("cw-RevealListItem-settling",!0),i.finished.then(()=>{i===this.#a&&(this.#a=void 0,this.#d=i.value,super.setClass("cw-RevealListItem-settling",!1));},()=>{});}#x(){const e=this.#a;this.#a=void 0,e!==void 0&&(e.cancel(),this.#d=e.value,super.setClass("cw-RevealListItem-settling",!1));}#c(){const e=this.#o;if(this.#o=void 0,e!==void 0&&this.#p)try{this.styleElement?.releasePointerCapture(e);}catch{}this.#p=!1,super.setClass("cw-RevealListItem-dragging",!1);}#h=e=>{e.defaultPrevented||!c(e.target)||e.target.closest(".cw-RevealListItem-toggle")!==this.#r||m(e,this.styleElement,()=>this.#E(!this.#e,e),!1);};#P=e=>{e.key==="Escape"&&this.#e&&m(e,this.styleElement,()=>this.#E(!1,e));};#C=e=>{const t=this.styleElement;t===null||l(()=>this.props.disabled===!0)||this.#o!==void 0||!e.isPrimary||e.button!==0||!c(e.target)||V(e.target,t,e.composedPath())||(this.#x(),this.#o=e.pointerId,this.#L=e.clientX,this.#v=e.clientY,this.#u=this.#d,this.#b=t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl",this.#s.reset(),this.#s.track(e,this.#I));};#I=e=>this.#b?e.clientX:-e.clientX;#D=e=>{const t=this.styleElement,n=(e.clientX-this.#L)*(this.#b?1:-1);if(!(this.#o!==e.pointerId||t===null)){if(this.#s.track(e,this.#I),!this.#p){if(Math.abs(e.clientY-this.#v)>Math.max(E,Math.abs(n))){this.#c(),this.#f(0);return;}if(Math.abs(n)<E||this.#l===0)return;try{t.setPointerCapture(e.pointerId);}catch{this.#c(),this.#f(0);return;}this.#p=!0,super.setClass("cw-RevealListItem-dragging",!0);}this.#R(Math.max(0,Math.min(1,this.#u+n/this.#l)));}};#T=e=>{const t=this.#l,n=this.#p,s=this.#s.release(e);if(this.#o===e.pointerId){if(this.#c(),!n){this.#f(0);return;}this.#E(_([0,t],this.#d*t,s,t/2)>0,e,s/t);}};#S=e=>{this.#o===e.pointerId&&(this.#c(),this.#f(0));};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#h),e?.[n]("keydown",this.#P),e?.[n]("pointerdown",this.#C),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S);}#M(){const e=this.#n,t=e?.isConnected===!0?e.ownerDocument.defaultView:null;this.#m?.disconnect(),this.#m=void 0,!(e===null||t==null)&&(this.#m=new t.ResizeObserver(()=>{this.#l=e.offsetWidth,super.setStyle(N,`${this.#l}px`);}),this.#m.observe(e));}applyComponentProps(){const e=super.readProps(["disabled","expanded","hideLabel","revealLabel","supportingText"]);e.disabledChanged&&(e.disabled===!0&&this.#o!==void 0&&(this.#c(),this.#f(0)),this.#r!==null&&(this.#r.disabled=e.disabled===!0)),e.supportingTextChanged&&this.styleElement?.querySelector(".cw-RevealListItem-row .cw-ListItem-supporting")?.toggleAttribute("hidden",e.supportingText===void 0),this.#i&&e.expandedChanged&&this.#e!==(e.expanded===!0)?(this.#e=e.expanded===!0,this.#y(),this.#o===void 0&&this.#f(0)):(e.hideLabelChanged||e.revealLabelChanged)&&this.#y();}onStyleElementChanged(e){this.#c(),this.#x(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#r=e?.querySelector(".cw-RevealListItem-toggle")??null,this.#n=e?.querySelector(":scope > .cw-RevealListItem-actions")??null,this.#g(e,!0),this.#M(),this.#n!==null&&(this.#n.id===""&&(this.#n.id=this.#t),this.#r?.setAttribute("aria-controls",this.#n.id),this.#y());}render(e){const t=this.props;return l(()=>A({children:e},{get actions(){return t.actions;},defaultExpanded:this.#e,disabled:t.disabled,get headline(){return t.headline;},hideLabel:t.hideLabel,get leading(){return t.leading;},revealLabel:t.revealLabel,get supportingText(){return t.supportingText;}},this.#t));}}const j=/* @__PURE__ */f(()=>(r,e)=>A(r,e,`cw-reveal-${P()}`),()=>W),ge=r=>j(x(r,["actions","children","headline","leading","supportingText"]));function k(r){let e=r;for(;typeof e=="function";)e=e();return e??<R name={F}/>;}function Z(r,e){return<button{...r}aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-label={r["aria-label"]??e.label??"Reorder item"}aria-pressed="false"classList={{...r.classList,"cw-ReorderHandle":!0}}data-cw-reorder-handle="true"disabled={e.disabled===!0}type="button">{k(r.children)}</button>;}class Q extends g{constructor(e){super(e,{styleElementIsFunction:!0});}applyComponentProps(){const e=super.readProps(["disabled","label","attr:aria-label"]),t=e["attr:aria-label"]??e.label??"Reorder item";e.disabledChanged&&super.setAttribute("disabled",e.disabled===!0),this.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t);}render(e){const t=<button aria-keyshortcuts="Space ArrowUp ArrowDown Home End Escape"aria-pressed="false"class="cw-ReorderHandle"data-cw-reorder-handle="true"type="button"/>;return D(t,()=>k(e)),t;}}const ve=/* @__PURE__ */f(()=>Z,()=>Q);function ee(r,e){return<>
|
|
24
24
|
<div aria-atomic="true"aria-live="polite"class="cw-ReorderableList-status"role="status"/>
|
|
25
25
|
<ul{...r}aria-disabled={e.disabled===!0?"true":void 0}classList={{...r.classList,"cw-List":!0,"cw-ReorderableList":!0}}data-cw-list-selection-mode="none"data-cw-list-variant={e.variant??"standard"}role="list">{r.children}</ul>
|
|
26
|
-
|
|
26
|
+
</>;}class te extends ${#t;#i;#s;#e;#r;#n;#l;#d;#u;#o;#p;constructor(e){const t=C(e,{selectionMode:"none"});super(t),this.#t=l(()=>e),this.#i=new M(),this.#s=null,this.#e=void 0,this.#r=void 0,this.#n=void 0,this.#l=null,this.#d=0,this.#u=void 0,this.#o=void 0,this.#p=!1,L(()=>{this.#p=!0,this.#h(),this.#o?.cancel(),this.#g(this.styleElement,!1);});}#L(){return Array.from(this.styleElement?.children??[]).filter(e=>e.hasAttribute("data-cw-list-value"));}#v(e){return this.#L().find(t=>t.dataset.cwListValue===e);}#b(e){const n=(c(e)?e:null)?.closest("[data-cw-reorder-handle]")??null,s=n?.closest("[data-cw-list-value]");if(!(n===null||n.disabled||s?.parentElement!==this.styleElement))return s.dataset.cwListValue;}#a(e,t=!1){const n=this.#e,s=this.#t.values;if(n===void 0||this.#s===null)return;const i=s.indexOf(n)+1;this.#s.textContent=l(()=>this.#t.announcement?.(n,i,s.length,e,t))??(t?"Cancelled. Restored the original order.":e?`${n}, position ${i} of ${s.length}. ${q}`:`${n}, dropped at position ${i} of ${s.length}.`);}#m(e,t,n){const s=this.#t.values,i=s.indexOf(e),o=Math.max(0,Math.min(s.length-1,t)),a=s.slice();return this.#p||i<0||i===o||new Set(s).size!==s.length?!1:(a.splice(i,1),a.splice(o,0,e),l(()=>this.#t.onReorder(a,n)),!0);}#w(e){this.#h(),this.#e=e,this.#r=this.#t.values.slice(),this.#E(),this.#a(!0);}#E(){for(const e of this.#L()){const t=e.dataset.cwListValue===this.#e;e.classList.toggle("cw-ReorderableList-moving",t),e.classList.toggle(B,t),e.querySelector("[data-cw-reorder-handle]")?.setAttribute("aria-pressed",t?"true":"false");}}#y(e){const t=this.styleElement,n=this.#L(),s=n.indexOf(e),i=t.ownerDocument.defaultView,o=Number.parseFloat(i?.getComputedStyle(t).rowGap??"")||0,a=t.getBoundingClientRect().top,u=n.map(d=>d.getBoundingClientRect()),h=u[s],O=n.filter(d=>d!==e),S=u.filter((d,X)=>X!==s),b={row:e,from:s,others:O,centers:S.map(d=>d.top+d.height/2),extents:S.map(d=>d.height+o),extent:h.height+o,center:h.top+h.height/2,start:h.top-a,size:h.height,pointerStart:this.#d,insertion:s,offset:0};return t.classList.add("cw-ReorderableList-dragging"),t.style.setProperty("--cw-reorder-shift",`${b.extent}px`),this.#R(b),b;}#R(e){const t=this.styleElement;let n=e.start;for(let s=e.from;s<e.insertion;s++)n+=e.extents[s];for(let s=e.insertion;s<e.from;s++)n-=e.extents[s];t?.style.setProperty("--cw-reorder-slot-start",`${n}px`),t?.style.setProperty("--cw-reorder-slot-size",`${e.size}px`);}#f(e,t){const n=e.center+t-e.pointerStart,s=e.insertion;let i=0;for(;i<e.centers.length&&e.centers[i]<n;)i++;if(e.offset=t-e.pointerStart,e.row.style.setProperty(p,`${e.offset}px`),i!==s){e.insertion=i;for(let o=Math.min(s,i);o<Math.max(s,i);o++){const a=e.others[o],u=o>=e.from&&o<i,h=o<e.from&&o>=i;a.classList.toggle("cw-ReorderableList-shiftedUp",u),a.classList.toggle("cw-ReorderableList-shiftedDown",h);}this.#R(e);}}#x(e){const t=this.styleElement;t?.classList.remove("cw-ReorderableList-dragging");for(const n of e.others)n.classList.remove("cw-ReorderableList-shiftedUp","cw-ReorderableList-shiftedDown");t?.style.removeProperty("--cw-reorder-shift"),t?.style.removeProperty("--cw-reorder-slot-start"),t?.style.removeProperty("--cw-reorder-slot-size");}#c(e,t,n){const s=Number.parseFloat(e.style.getPropertyValue(p))||0,i=t-(e.getBoundingClientRect().top-s);this.#o?.cancel(),e.classList.add("cw-ReorderableList-settling"),e.style.setProperty(p,`${i}px`);const o=T(e,p,i,0,{role:"spatial",speed:"fast",unit:"px",velocity:n});this.#o=o,o.finished.then(()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p);},()=>{e.classList.remove("cw-ReorderableList-settling"),e.style.removeProperty(p);});}#h(){const e=this.#n,t=this.#u;if(this.#n=void 0,e!==void 0&&t!==void 0)try{this.#l?.releasePointerCapture(e);}catch{}t!==void 0&&this.#x(t),this.#u=void 0,this.#e=void 0,this.#r=void 0,this.#l=null,this.#E();}#P=e=>{const t=this.#b(e.target);e.defaultPrevented||t===void 0||this.#t.disabled===!0||m(e,this.styleElement,()=>{if(!(this.#p||this.#t.disabled===!0)){if(this.#e!==t){this.#w(t);return;}this.#a(!1),this.#h();}},!1);};#C=e=>{const t=this.#e;this.#t.disabled===!0||t===void 0||this.#b(e.target)!==t||!Y.includes(e.key)||m(e,this.styleElement,()=>{const n=this.#t.values,s=n.indexOf(t);if(this.#e===t){if(e.key==="Escape"){this.#r!==void 0&&l(()=>this.#t.onReorder(this.#r,e)),this.#a(!1,!0),this.#h();return;}this.#m(t,e.key==="Home"?0:e.key==="End"?n.length-1:s+(e.key==="ArrowDown"?1:-1),e),queueMicrotask(()=>{this.#v(t)?.querySelector("[data-cw-reorder-handle]")?.focus(),this.#E(),this.#a(this.#e===t);});}});};#I=e=>{const t=this.#b(e.target);this.#t.disabled===!0||this.#n!==void 0||!e.isPrimary||e.button!==0||t===void 0||!c(e.target)||(this.#e!==t&&(this.#h(),this.#e=t),this.#n=e.pointerId,this.#l=e.target.closest("[data-cw-reorder-handle]"),this.#d=e.clientY,this.#i.reset(),this.#i.track(e,n=>n.clientY));};#D=e=>{const t=this.#e,n=t===void 0?void 0:this.#v(t);if(!(e.pointerId!==this.#n||this.#l===null||n===void 0)){if(this.#i.track(e,s=>s.clientY),this.#u===void 0){if(Math.abs(e.clientY-this.#d)<E)return;try{this.#l.setPointerCapture(e.pointerId);}catch{this.#h();return;}this.#o?.cancel(),this.#E(),this.#u=this.#y(n);}this.#f(this.#u,e.clientY);}};#T=e=>{const t=this.#u,n=this.#e,s=this.#l,i=u=>{u.preventDefault(),u.stopImmediatePropagation();};if(e.pointerId!==this.#n)return;if(t===void 0||n===void 0){this.#n=void 0,this.#l=null,t===void 0&&this.#r===void 0&&(this.#e=void 0);return;}const o=t.row.getBoundingClientRect().top,a=this.#i.release(e);this.#x(t),this.#u=void 0,this.#m(n,t.insertion,e),this.#a(!1),this.#h(),this.#c(t.row,o,a),s?.addEventListener("click",i,{capture:!0,once:!0}),s?.ownerDocument.defaultView?.setTimeout(()=>s.removeEventListener("click",i,!0),0);};#S=e=>{const t=this.#u;if(e.pointerId!==this.#n)return;if(t===void 0){this.#h();return;}const n=t.row.getBoundingClientRect().top;this.#h(),this.#c(t.row,n,0);};#g(e,t){const n=t?"addEventListener":"removeEventListener";e?.[n]("click",this.#P),e?.[n]("keydown",this.#C),e?.[n]("pointerdown",this.#I),e?.[n]("pointermove",this.#D),e?.[n]("pointerup",this.#T),e?.[n]("pointercancel",this.#S),e?.[n]("lostpointercapture",this.#S);}applyComponentProps(){const e=this.#t.disabled===!0,t=this.#t.values;super.applyComponentProps(),super.setClass("cw-ReorderableList",!0),super.setAttribute("aria-disabled",e?"true":void 0),(e||this.#e!==void 0&&!t.includes(this.#e))&&l(()=>this.#h());}onStyleElementChanged(e){this.#h(),this.#g(super.styleElement,!1),super.onStyleElementChanged(e),this.#g(e,!0);}render(e){const t=<div aria-atomic="true"aria-live="polite"class="cw-ReorderableList-status"role="status"/>,n=<ul class="cw-List cw-ReorderableList"data-cw-list-selection-mode="none"role="list"/>;return this.#s=t,D(n,e),[t,n];}}const ne=/* @__PURE__ */f(()=>ee,()=>te),ye=r=>{const e=C({variant:"standard"},x(r,["children"]));return ne(e);};export{Le as ExpandedListItem,K as ExpandedListItemController,ve as ReorderHandle,ye as ReorderableList,te as ReorderableListController,ge as RevealListItem,W as RevealListItemController};
|