@alwatr/element
Advanced tools
Comparing version 0.30.0 to 0.31.0
@@ -6,2 +6,28 @@ # Change Log | ||
# [0.31.0](https://github.com/AliMD/alwatr/compare/v0.30.0...v0.31.0) (2023-05-08) | ||
### Bug Fixes | ||
- compatible with new \_addSignalListener signal mixin ([e2be863](https://github.com/AliMD/alwatr/commit/e2be863acd9b99c4fc8f0a81c4efe2ac6db50c39)) | ||
- **element/fsmc:** all render state must defined ([93f8ea3](https://github.com/AliMD/alwatr/commit/93f8ea31b8fa4f8845871a795eb2de107797f669)) | ||
- **element/fsm:** compatible old mixins ([fe4427e](https://github.com/AliMD/alwatr/commit/fe4427ef62c2fd1680bcb3212feed681add4c2d4)) | ||
- **element:** build issue ([224799c](https://github.com/AliMD/alwatr/commit/224799c5c664bcc11dac8061048c85708b3ba5ef)) | ||
- **element:** check type of `actions` ([f39d617](https://github.com/AliMD/alwatr/commit/f39d617f106e03748d8ed9f539a77f4e810765b5)) | ||
- **element:** remove old fsm mixin ([23efdf2](https://github.com/AliMD/alwatr/commit/23efdf25d2bbb768b70fd65f45f9fed3affcbd15)) | ||
- **fsm:** cleanup old ([aa43264](https://github.com/AliMD/alwatr/commit/aa432644d76a0f81ea6e5c3b93da63f998ab159c)) | ||
- new logger api ([9d83a7d](https://github.com/AliMD/alwatr/commit/9d83a7dc5c103bc3bb4282dacfd85fa998915300)) | ||
### Features | ||
- **element/fsm:** rewrite state machine for lit ([592fc8d](https://github.com/AliMD/alwatr/commit/592fc8dd586255e719a31785d3989a348f63cce8)) | ||
- **element/logger:** log remove ([f6dc4c6](https://github.com/AliMD/alwatr/commit/f6dc4c65292f7a491007f445749b798c4551ebfc)) | ||
- **element/mixins/signal:** \_addSignalListener ([fc987b3](https://github.com/AliMD/alwatr/commit/fc987b32db20975354e406ae89d4b4c006bf798d)) | ||
- **element:** add reactive controller ([7d7d6cb](https://github.com/AliMD/alwatr/commit/7d7d6cb6e473177aa2062d5a57490a57e6b027ff)) | ||
- **element:** export from `ref` ([bbaaca4](https://github.com/AliMD/alwatr/commit/bbaaca4bb19efa29f80c4206eff5985a2d86f62c)) | ||
- **element:** export lit guard ([b51627f](https://github.com/AliMD/alwatr/commit/b51627fbd63f401aa4404ebb1d59281216247d80)) | ||
- **element:** refactor fsm controller with new fsm api ([e51aaa2](https://github.com/AliMD/alwatr/commit/e51aaa241ea21a91df4e7399a4c7801be41ded49)) | ||
- **element:** register and remove necessary listeners ([833e9cc](https://github.com/AliMD/alwatr/commit/833e9cc58a5515edcc1c1c72b2761c124557201d)) | ||
- **element:** ScheduleUpdateToFrameMixin ([8a4307d](https://github.com/AliMD/alwatr/commit/8a4307dd3a6cc58f826e6faaa261cb3cb9e13d22)) | ||
- **element:** use the new logger functions(time & timeEnd) ([2c4d919](https://github.com/AliMD/alwatr/commit/2c4d9191e2b296e17e86f20eebcf61523f1e0e3b)) | ||
# [0.30.0](https://github.com/AliMD/alwatr/compare/v0.29.0...v0.30.0) (2023-03-06) | ||
@@ -8,0 +34,0 @@ |
@@ -9,5 +9,5 @@ export * from './base-element.js'; | ||
export * from './mixins/unresolved.js'; | ||
export * from './mixins/state-machine.js'; | ||
export * from './mixins/schedule-update-to-frame.js'; | ||
export * from './directives/map.js'; | ||
export * from './lit.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,3 @@ import { globalAlwatr } from '@alwatr/logger'; | ||
export * from './mixins/unresolved.js'; | ||
export * from './mixins/state-machine.js'; | ||
export * from './mixins/schedule-update-to-frame.js'; | ||
export * from './directives/map.js'; | ||
@@ -13,0 +13,0 @@ export * from './lit.js'; |
@@ -6,2 +6,3 @@ export * from 'lit'; | ||
export { live } from 'lit/directives/live.js'; | ||
export { guard } from 'lit/directives/guard.js'; | ||
export { repeat } from 'lit/directives/repeat.js'; | ||
@@ -12,2 +13,3 @@ export { ifDefined } from 'lit/directives/if-defined.js'; | ||
export { cache } from 'lit/directives/cache.js'; | ||
export { ref, createRef, type Ref } from 'lit/directives/ref.js'; | ||
//# sourceMappingURL=lit.d.ts.map |
@@ -6,2 +6,3 @@ export * from 'lit'; | ||
export { live } from 'lit/directives/live.js'; | ||
export { guard } from 'lit/directives/guard.js'; | ||
export { repeat } from 'lit/directives/repeat.js'; | ||
@@ -12,2 +13,3 @@ export { ifDefined } from 'lit/directives/if-defined.js'; | ||
export { cache } from 'lit/directives/cache.js'; | ||
export { ref, createRef } from 'lit/directives/ref.js'; | ||
//# sourceMappingURL=lit.js.map |
@@ -14,3 +14,3 @@ import { localeContextConsumer } from '@alwatr/i18n'; | ||
super.connectedCallback(); | ||
this._signalListenerList.push(localeContextConsumer.subscribe(() => this._updateDir())); | ||
this._addSignalListeners(localeContextConsumer.subscribe(() => this._updateDir())); | ||
} | ||
@@ -21,4 +21,4 @@ /** | ||
_updateDir(dir) { | ||
var _a, _b; | ||
this._logger.logMethodArgs('_updateDir', { dir, computeMode }); | ||
var _a, _b, _c, _d; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, '_updateDir', { dir, computeMode }); | ||
if (typeof dir === 'string') { | ||
@@ -31,3 +31,3 @@ // console.timeEnd('_updateDir'); | ||
if (computeMode === 'locale') { | ||
return this._updateDir((_b = (_a = localeContextConsumer.getValue()) === null || _a === void 0 ? void 0 : _a.direction) !== null && _b !== void 0 ? _b : document.documentElement.dir); | ||
return this._updateDir((_d = (_c = localeContextConsumer.getValue()) === null || _c === void 0 ? void 0 : _c.direction) !== null && _d !== void 0 ? _d : document.documentElement.dir); | ||
} | ||
@@ -34,0 +34,0 @@ // else |
@@ -6,3 +6,3 @@ import { l18eContextConsumer } from '@alwatr/i18n'; | ||
super.connectedCallback(); | ||
this._signalListenerList.push(l18eContextConsumer.subscribe(this._l18eContextUpdated.bind(this))); | ||
this._addSignalListeners(l18eContextConsumer.subscribe(this._l18eContextUpdated.bind(this))); | ||
} | ||
@@ -13,3 +13,4 @@ /** | ||
_l18eContextUpdated(l18eContext) { | ||
this._logger.logMethodArgs('_l18eContextUpdated', l18eContext.meta); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, '_l18eContextUpdated', l18eContext.meta); | ||
this.requestUpdate(); | ||
@@ -16,0 +17,0 @@ } |
@@ -7,29 +7,51 @@ import { createLogger } from '@alwatr/logger'; | ||
constructor(...args) { | ||
var _a, _b; | ||
super(...args); | ||
this.ali = ++_lastAli; | ||
this._logger = createLogger(`<${this.tagName.toLowerCase()}-${this.ali}>`); | ||
this._logger.logMethod('constructor'); | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, 'constructor'); | ||
} | ||
connectedCallback() { | ||
this._logger.logMethod('connectedCallback'); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, 'connectedCallback'); | ||
super.connectedCallback(); | ||
} | ||
disconnectedCallback() { | ||
this._logger.logMethod('disconnectedCallback'); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, 'disconnectedCallback'); | ||
super.disconnectedCallback(); | ||
} | ||
update(changedProperties) { | ||
this._logger.logMethodArgs('update', { changedProperties }); | ||
var _a, _b, _c, _d; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, 'update', { changedProperties }); | ||
(_d = (_c = this._logger).time) === null || _d === void 0 ? void 0 : _d.call(_c, this._$firstUpdated ? 'update-time' : 'first-update-time'); | ||
super.update(changedProperties); | ||
} | ||
firstUpdated(changedProperties) { | ||
this._logger.logMethodArgs('firstUpdated', { changedProperties }); | ||
var _a, _b, _c, _d; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, 'firstUpdated', { changedProperties }); | ||
(_d = (_c = this._logger).timeEnd) === null || _d === void 0 ? void 0 : _d.call(_c, 'first-update-time'); | ||
super.firstUpdated(changedProperties); | ||
} | ||
updated(changedProperties) { | ||
var _a, _b; | ||
// this._logger.logMethodArgs('updated', {changedProperties}); | ||
if (this._logger.devMode) { | ||
if (this._$firstUpdated) { | ||
(_b = (_a = this._logger).timeEnd) === null || _b === void 0 ? void 0 : _b.call(_a, 'update-time'); | ||
} | ||
else { | ||
this._$firstUpdated = true; | ||
} | ||
} | ||
super.updated(changedProperties); | ||
} | ||
render() { | ||
this._logger.logMethod('render'); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, 'render'); | ||
return; | ||
} | ||
dispatchEvent(event) { | ||
this._logger.logMethodArgs('dispatchEvent', { | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, 'dispatchEvent', { | ||
type: event.type, | ||
@@ -40,2 +62,7 @@ detail: event.detail, | ||
} | ||
remove() { | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, 'remove'); | ||
super.remove(); | ||
} | ||
} | ||
@@ -42,0 +69,0 @@ return LoggerMixinClass; |
@@ -6,3 +6,3 @@ import { routeContextConsumer } from '@alwatr/router'; | ||
super.connectedCallback(); | ||
this._signalListenerList.push(routeContextConsumer.subscribe((routeContext) => this._routeContextUpdated(routeContext), { | ||
this._addSignalListeners(routeContextConsumer.subscribe((routeContext) => this._routeContextUpdated(routeContext), { | ||
receivePrevious: 'No', | ||
@@ -15,3 +15,4 @@ })); | ||
_routeContextUpdated(routeContext) { | ||
this._logger.logMethodArgs('_routeContextUpdated', routeContext); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethodArgs) === null || _b === void 0 ? void 0 : _b.call(_a, '_routeContextUpdated', routeContext); | ||
this.requestUpdate(); | ||
@@ -18,0 +19,0 @@ } |
import type { LoggerMixinInterface } from './logging.js'; | ||
import type { ListenerSpec } from '@alwatr/signal/type.js'; | ||
import type { Constructor } from '@alwatr/type'; | ||
import type { Constructor, SingleOrArray } from '@alwatr/type'; | ||
export declare class SignalMixinInterface extends LoggerMixinInterface { | ||
protected _signalListenerList: Array<ListenerSpec>; | ||
private _signalListenerList; | ||
protected _addSignalListeners(listeners: SingleOrArray<ListenerSpec>): void; | ||
} | ||
export declare function SignalMixin<T extends Constructor<LoggerMixinInterface>>(superClass: T): Constructor<SignalMixinInterface> & T; | ||
//# sourceMappingURL=signal.d.ts.map |
@@ -8,2 +8,10 @@ import { unsubscribe } from '@alwatr/signal/core.js'; | ||
} | ||
_addSignalListeners(listeners) { | ||
if (Array.isArray(listeners)) { | ||
this._signalListenerList = this._signalListenerList.concat(listeners); | ||
} | ||
else { | ||
this._signalListenerList.push(listeners); | ||
} | ||
} | ||
disconnectedCallback() { | ||
@@ -10,0 +18,0 @@ for (const listener of this._signalListenerList) { |
@@ -21,3 +21,4 @@ import { __decorate, __metadata } from "tslib"; | ||
_click(event) { | ||
this._logger.logMethod('_click'); | ||
var _a, _b; | ||
(_b = (_a = this._logger).logMethod) === null || _b === void 0 ? void 0 : _b.call(_a, '_click'); | ||
if (event.metaKey || event.altKey || event.shiftKey) | ||
@@ -24,0 +25,0 @@ return; |
{ | ||
"name": "@alwatr/element", | ||
"version": "0.30.0", | ||
"version": "0.31.0", | ||
"description": "Elegant powerful web component (lit-element) helper mixins written in tiny TypeScript module.", | ||
@@ -36,13 +36,13 @@ "keywords": [ | ||
"dependencies": { | ||
"@alwatr/fsm": "^0.30.0", | ||
"@alwatr/i18n": "^0.30.0", | ||
"@alwatr/logger": "^0.30.0", | ||
"@alwatr/router": "^0.30.0", | ||
"lit": "^2.6.1", | ||
"@alwatr/fsm": "^0.31.0", | ||
"@alwatr/i18n": "^0.31.0", | ||
"@alwatr/logger": "^0.31.0", | ||
"@alwatr/router": "^0.31.0", | ||
"lit": "^2.7.4", | ||
"tslib": "^2.5.0" | ||
}, | ||
"devDependencies": { | ||
"@alwatr/type": "^0.30.0" | ||
"@alwatr/type": "^0.31.0" | ||
}, | ||
"gitHead": "36f55780ccdcb1acc07400b0cdb3fe7b0df56cca" | ||
"gitHead": "896e64b58eed6e9048e870557ecf399d42705612" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63683
451
+ Added@alwatr/fsm@0.31.0(transitive)
+ Added@alwatr/i18n@0.31.0(transitive)
+ Added@alwatr/logger@0.31.0(transitive)
+ Added@alwatr/math@0.31.0(transitive)
+ Added@alwatr/router@0.31.0(transitive)
+ Added@alwatr/signal@0.31.0(transitive)
+ Added@alwatr/type@0.31.0(transitive)
+ Added@alwatr/util@0.31.0(transitive)
- Removed@alwatr/fsm@0.30.0(transitive)
- Removed@alwatr/i18n@0.30.0(transitive)
- Removed@alwatr/logger@0.30.0(transitive)
- Removed@alwatr/math@0.30.0(transitive)
- Removed@alwatr/router@0.30.0(transitive)
- Removed@alwatr/signal@0.30.0(transitive)
- Removed@alwatr/type@0.30.0(transitive)
- Removed@alwatr/util@0.30.0(transitive)
Updated@alwatr/fsm@^0.31.0
Updated@alwatr/i18n@^0.31.0
Updated@alwatr/logger@^0.31.0
Updated@alwatr/router@^0.31.0
Updatedlit@^2.7.4