@m3e/core 1.0.1 → 1.0.3
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/dist/custom-elements.json +3748 -3733
- package/dist/index.js +36 -31
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +91 -95
- package/dist/index.min.js.map +1 -1
- package/dist/src/shared/controllers/PressedController.d.ts.map +1 -1
- package/dist/src/shared/primitives/SlideElement.d.ts +2 -3
- package/dist/src/shared/primitives/SlideElement.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -543,13 +543,15 @@ _PressedController_capture = new WeakMap(), _PressedController_callback = new We
|
|
|
543
543
|
if (e.target !== e.currentTarget)
|
|
544
544
|
return;
|
|
545
545
|
const target = e.currentTarget;
|
|
546
|
-
if (
|
|
546
|
+
if (__classPrivateFieldGet(this, _PressedController_isPressedKey, "f")?.call(this, e.key)) {
|
|
547
547
|
if (e.key === " ") {
|
|
548
548
|
e.preventDefault();
|
|
549
549
|
}
|
|
550
|
-
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").
|
|
551
|
-
|
|
552
|
-
|
|
550
|
+
if (!__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").has(target)) {
|
|
551
|
+
__classPrivateFieldGet(this, _PressedController_pressedTargets, "f").set(target, performance.now());
|
|
552
|
+
const bounds = target.getBoundingClientRect();
|
|
553
|
+
__classPrivateFieldGet(this, _PressedController_callback, "f").call(this, true, { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 }, target);
|
|
554
|
+
}
|
|
553
555
|
}
|
|
554
556
|
}, _PressedController_handleKeyUp = function _PressedController_handleKeyUp(e) {
|
|
555
557
|
const target = e.target;
|
|
@@ -858,19 +860,19 @@ const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,
|
|
|
858
860
|
* Copyright 2019 Google LLC
|
|
859
861
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
860
862
|
*/
|
|
861
|
-
const t$1=globalThis,e$4=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$
|
|
863
|
+
const t$1=globalThis,e$4=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$3("string"==typeof t?t:t+"",void 0,s$1),S$1=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
862
864
|
|
|
863
865
|
/**
|
|
864
866
|
* @license
|
|
865
867
|
* Copyright 2017 Google LLC
|
|
866
868
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
867
|
-
*/const{is:i$1,defineProperty:e$3,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$2,getOwnPropertySymbols:o$
|
|
869
|
+
*/const{is:i$1,defineProperty:e$3,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$2,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$1(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$2(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d$1("elementProperties")]=new Map,y[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y}),(a$1.reactiveElementVersions??=[]).push("2.1.1");
|
|
868
870
|
|
|
869
871
|
/**
|
|
870
872
|
* @license
|
|
871
873
|
* Copyright 2017 Google LLC
|
|
872
874
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
873
|
-
*/const o$
|
|
875
|
+
*/const o$2={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n$1(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
874
876
|
|
|
875
877
|
/**
|
|
876
878
|
* @license
|
|
@@ -885,12 +887,6 @@ const e$2=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"obj
|
|
|
885
887
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
886
888
|
*/function e$1(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$2(n,s,{get(){return o(this)}})}}
|
|
887
889
|
|
|
888
|
-
/**
|
|
889
|
-
* @license
|
|
890
|
-
* Copyright 2021 Google LLC
|
|
891
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
892
|
-
*/function o$2(o){return (e,n)=>{const{slot:r,selector:s}=o??{},c="slot"+(r?`[name=${r}]`:":not([name])");return e$2(e,n,{get(){const t=this.renderRoot?.querySelector(c),e=t?.assignedElements(o)??[];return void 0===s?e:e.filter((t=>t.matches(s)))}})}}
|
|
893
|
-
|
|
894
890
|
/**
|
|
895
891
|
* Determines whether a value is a `CheckedMixin`.
|
|
896
892
|
* @param {unknown} value The value to test.
|
|
@@ -4180,7 +4176,7 @@ M3eScrollContainerElement = __decorate([
|
|
|
4180
4176
|
t$2("m3e-scroll-container")
|
|
4181
4177
|
], M3eScrollContainerElement);
|
|
4182
4178
|
|
|
4183
|
-
var
|
|
4179
|
+
var _M3eSlideElement_instances, _M3eSlideElement_items, _M3eSlideElement_handleSlotChange, _M3eSlideElement_updateItems;
|
|
4184
4180
|
/**
|
|
4185
4181
|
* A carousel-like container used to horizontally cycle through slotted items.
|
|
4186
4182
|
*
|
|
@@ -4203,10 +4199,11 @@ var _M3eSlide_instances, _M3eSlide_updateItems;
|
|
|
4203
4199
|
*
|
|
4204
4200
|
* @cssprop --m3e-slide-animation-duration - The duration of transitions between slotted items.
|
|
4205
4201
|
*/
|
|
4206
|
-
let
|
|
4202
|
+
let M3eSlideElement = class M3eSlideElement extends LitElement {
|
|
4207
4203
|
constructor() {
|
|
4208
4204
|
super(...arguments);
|
|
4209
|
-
|
|
4205
|
+
_M3eSlideElement_instances.add(this);
|
|
4206
|
+
/** @private */ _M3eSlideElement_items.set(this, new Array());
|
|
4210
4207
|
/**
|
|
4211
4208
|
* The zero-based index of the visible item.
|
|
4212
4209
|
* @default null
|
|
@@ -4225,7 +4222,7 @@ let M3eSlide = class M3eSlide extends LitElement {
|
|
|
4225
4222
|
if (this.selectedIndex === null) {
|
|
4226
4223
|
this.classList.toggle("-no-animate", true);
|
|
4227
4224
|
}
|
|
4228
|
-
__classPrivateFieldGet(this,
|
|
4225
|
+
__classPrivateFieldGet(this, _M3eSlideElement_instances, "m", _M3eSlideElement_updateItems).call(this);
|
|
4229
4226
|
if (this.selectedIndex !== null && this.classList.contains("-no-animate")) {
|
|
4230
4227
|
requestAnimationFrame(() => {
|
|
4231
4228
|
if (this.selectedIndex !== null) {
|
|
@@ -4237,21 +4234,32 @@ let M3eSlide = class M3eSlide extends LitElement {
|
|
|
4237
4234
|
}
|
|
4238
4235
|
/** @inheritdoc */
|
|
4239
4236
|
render() {
|
|
4240
|
-
return html `<slot @slotchange="${__classPrivateFieldGet(this,
|
|
4237
|
+
return html `<slot @slotchange="${__classPrivateFieldGet(this, _M3eSlideElement_instances, "m", _M3eSlideElement_handleSlotChange)}"></slot>`;
|
|
4241
4238
|
}
|
|
4242
4239
|
};
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4240
|
+
_M3eSlideElement_items = new WeakMap();
|
|
4241
|
+
_M3eSlideElement_instances = new WeakSet();
|
|
4242
|
+
_M3eSlideElement_handleSlotChange = function _M3eSlideElement_handleSlotChange(e) {
|
|
4243
|
+
const items = [...e.target.assignedElements({ flatten: true })];
|
|
4244
|
+
for (const removed of __classPrivateFieldGet(this, _M3eSlideElement_items, "f").filter((x) => !items.includes(x))) {
|
|
4245
|
+
removed.classList.remove("-before");
|
|
4246
|
+
removed.classList.remove("-after");
|
|
4247
|
+
removed.removeAttribute("inert");
|
|
4248
|
+
}
|
|
4249
|
+
__classPrivateFieldSet(this, _M3eSlideElement_items, items, "f");
|
|
4250
|
+
__classPrivateFieldGet(this, _M3eSlideElement_instances, "m", _M3eSlideElement_updateItems).call(this);
|
|
4251
|
+
};
|
|
4252
|
+
_M3eSlideElement_updateItems = function _M3eSlideElement_updateItems() {
|
|
4253
|
+
const selectedIndex = this.selectedIndex ?? __classPrivateFieldGet(this, _M3eSlideElement_items, "f").length;
|
|
4254
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _M3eSlideElement_items, "f").length; i++) {
|
|
4255
|
+
const item = __classPrivateFieldGet(this, _M3eSlideElement_items, "f")[i];
|
|
4248
4256
|
item.classList.toggle("-before", i < selectedIndex);
|
|
4249
4257
|
item.classList.toggle("-after", i > selectedIndex);
|
|
4250
4258
|
item.toggleAttribute("inert", i !== selectedIndex);
|
|
4251
4259
|
}
|
|
4252
4260
|
};
|
|
4253
4261
|
/** The styles of the element. */
|
|
4254
|
-
|
|
4262
|
+
M3eSlideElement.styles = css `
|
|
4255
4263
|
:host {
|
|
4256
4264
|
display: flex;
|
|
4257
4265
|
position: relative;
|
|
@@ -4288,15 +4296,12 @@ M3eSlide.styles = css `
|
|
|
4288
4296
|
}
|
|
4289
4297
|
}
|
|
4290
4298
|
`;
|
|
4291
|
-
__decorate([
|
|
4292
|
-
o$2({ flatten: true })
|
|
4293
|
-
], M3eSlide.prototype, "_items", void 0);
|
|
4294
4299
|
__decorate([
|
|
4295
4300
|
n$1({ attribute: "selected-index", type: Number, reflect: true })
|
|
4296
|
-
],
|
|
4297
|
-
|
|
4301
|
+
], M3eSlideElement.prototype, "selectedIndex", void 0);
|
|
4302
|
+
M3eSlideElement = __decorate([
|
|
4298
4303
|
t$2("m3e-slide")
|
|
4299
|
-
],
|
|
4304
|
+
], M3eSlideElement);
|
|
4300
4305
|
|
|
4301
4306
|
/**
|
|
4302
4307
|
* Component design tokens that control the `M3eStateLayerElement`.
|
|
@@ -4745,5 +4750,5 @@ M3eTextHighlightElement = M3eTextHighlightElement_1 = __decorate([
|
|
|
4745
4750
|
t$2("m3e-text-highlight")
|
|
4746
4751
|
], M3eTextHighlightElement);
|
|
4747
4752
|
|
|
4748
|
-
export { AttachInternals, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eCollapsibleElement, M3eElevationElement, M3eFocusRingElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRippleElement, M3eScrollContainerElement,
|
|
4753
|
+
export { AttachInternals, Checked, CheckedIndeterminate, ConstraintValidation, DesignToken, Dirty, Disabled, DisabledInteractive, EventAttribute, FocusController, Focusable, FormAssociated, FormSubmitter, HoverController, HtmlFor, IntersectionController, KeyboardClick, Labelled, LinkButton, LongPressController, M3eCollapsibleElement, M3eElevationElement, M3eFocusRingElement, M3ePseudoCheckboxElement, M3ePseudoRadioElement, M3eRippleElement, M3eScrollContainerElement, M3eSlideElement, M3eStateLayerElement, M3eTextHighlightElement, M3eTextOverflowElement, MutationController, PressedController, ReadOnly, Required, RequiredConstraintValidation, ResizeController, Role, ScrollController, Selected, Touched, Vertical, checkOrSelect, debounce, defaultValue, formValue, getTextContent, guid, hasAssignedNodes, hasKeys, internals, isAttachInternalsMixin, isCheckedIndeterminateMixin, isCheckedMixin, isCheckedOrSelected, isCheckedOrSelectedMixin, isConstraintValidationMixin, isDirtyMixin, isDisabledInteractiveMixin, isDisabledMixin, isFormAssociatedMixin, isFormSubmitterMixin, isHtmlForMixin, isLabelledMixin, isLinkButtonMixin, isReadOnlyMixin, isRequiredConstraintValidationMixin, isRequiredMixin, isSelectedMixin, isTouchedMixin, isVerticalMixin, prefersReducedMotion, renderPseudoLink, safeStyleMap, scrollIntoViewIfNeeded, updateLabels, validate };
|
|
4749
4754
|
//# sourceMappingURL=index.js.map
|