@lion/form-core
Advanced tools
Comparing version 0.7.0 to 0.7.1
# Change Log | ||
## 0.7.1 | ||
### Patch Changes | ||
- 8fb7e7a1: Fix type issues where base constructors would not have the same return type. This allows us to remove a LOT of @ts-expect-errors/@ts-ignores across lion. | ||
- 9112d243: Fix missing types and update to latest scoped elements to fix constructor type. | ||
- Updated dependencies [8fb7e7a1] | ||
- Updated dependencies [9112d243] | ||
- @lion/core@0.13.8 | ||
- @lion/localize@0.15.5 | ||
## 0.7.0 | ||
@@ -4,0 +15,0 @@ |
{ | ||
"name": "@lion/form-core", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Form-core contains all essential building blocks for creating form fields and fieldsets", | ||
@@ -37,4 +37,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@lion/core": "0.13.7", | ||
"@lion/localize": "0.15.4" | ||
"@lion/core": "0.13.8", | ||
"@lion/localize": "0.15.5" | ||
}, | ||
@@ -41,0 +41,0 @@ "keywords": [ |
@@ -247,8 +247,11 @@ /* eslint-disable class-methods-use-this */ | ||
* @param {{ modelValue:unknown }} newV | ||
* @param {{ modelValue:unknown }} [oldV] | ||
* @param {{ modelValue:unknown }} [old] | ||
*/ | ||
// @ts-expect-error | ||
_onModelValueChanged({ modelValue }, { modelValue: old }) { | ||
// @ts-expect-error | ||
if (this.constructor._classProperties.get('modelValue').hasChanged(modelValue, old)) { | ||
_onModelValueChanged({ modelValue }, old) { | ||
let _old; | ||
if (old && old.modelValue) { | ||
_old = old.modelValue; | ||
} | ||
// @ts-expect-error lit private property | ||
if (this.constructor._classProperties.get('modelValue').hasChanged(modelValue, _old)) { | ||
super._onModelValueChanged({ modelValue }); | ||
@@ -255,0 +258,0 @@ } |
@@ -307,3 +307,2 @@ /* eslint-disable class-methods-use-this */ | ||
this._calculateValues({ source: 'model' }); | ||
// @ts-expect-error only passing this so a subclasser can use it, but we do not use it ourselves | ||
this._dispatchModelValueChangedEvent(...args); | ||
@@ -313,6 +312,8 @@ } | ||
/** | ||
* @param {{ modelValue: unknown; }[]} args | ||
* This is wrapped in a distinct method, so that parents can control when the changed event | ||
* is fired. For objects, a deep comparison might be needed. | ||
*/ | ||
_dispatchModelValueChangedEvent() { | ||
// eslint-disable-next-line no-unused-vars | ||
_dispatchModelValueChangedEvent(...args) { | ||
/** @event model-value-changed */ | ||
@@ -319,0 +320,0 @@ this.dispatchEvent( |
@@ -9,3 +9,2 @@ export type FormControlMixin = typeof import("../types/FormControlMixinTypes.js").FormControlImplementation; | ||
}; | ||
export type FormControlHost = import("../types/FormControlMixinTypes.js").FormControlHost; | ||
export type ModelValueEventDetails = { | ||
@@ -12,0 +11,0 @@ formPath: HTMLElement[]; |
@@ -12,3 +12,2 @@ import { css, dedupeMixin, html, nothing, SlotMixin } from '@lion/core'; | ||
* @typedef {import('@lion/core/types/SlotMixinTypes').SlotsMap} SlotsMap | ||
* @typedef {import('../types/FormControlMixinTypes.js').FormControlHost} FormControlHost | ||
* @typedef {import('../types/FormControlMixinTypes.js').FormControlMixin} FormControlMixin | ||
@@ -526,11 +525,9 @@ * @typedef {import('../types/FormControlMixinTypes.js').ModelValueEventDetails} ModelValueEventDetails | ||
* @return {boolean} | ||
* | ||
* FIXME: Move to FormatMixin? Since there we have access to modelValue prop | ||
*/ | ||
// @ts-expect-error | ||
// @ts-ignore FIXME: Move to FormatMixin? Since there we have access to modelValue prop | ||
_isEmpty(modelValue = this.modelValue) { | ||
let value = modelValue; | ||
// @ts-expect-error | ||
// @ts-ignore | ||
if (this.modelValue instanceof Unparseable) { | ||
// @ts-expect-error | ||
// @ts-ignore | ||
value = this.modelValue.viewValue; | ||
@@ -537,0 +534,0 @@ } |
@@ -1,2 +0,2 @@ | ||
declare const LionField_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@lion/core/types/SlotMixinTypes").SlotHost> & import("@open-wc/dedupe-mixin").Constructor<import("../types/validate/ValidateMixinTypes.js").ValidateHost> & typeof import("../types/validate/ValidateMixinTypes.js").ValidateHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FormControlMixinTypes.js").FormControlHost> & typeof import("../types/FormControlMixinTypes.js").FormControlHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/utils/SyncUpdatableMixinTypes.js").SyncUpdatableHost> & typeof import("../types/utils/SyncUpdatableMixinTypes.js").SyncUpdatableHost & import("@open-wc/dedupe-mixin").Constructor<import("@lion/core/types/DisabledMixinTypes").DisabledHost> & typeof import("@lion/core/types/DisabledMixinTypes").DisabledHost & typeof import("@lion/core/types/SlotMixinTypes").SlotHost & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost> & typeof import("@open-wc/scoped-elements/src/types").ScopedElementsHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FormatMixinTypes.js").FormatHost> & import("../types/FormatMixinTypes.js").FormatHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FocusMixinTypes.js").FocusHost> & import("../types/FocusMixinTypes.js").FocusHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/InteractionStateMixinTypes.js").InteractionStateHost> & import("../types/InteractionStateMixinTypes.js").InteractionStateHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/registration/FormRegisteringMixinTypes.js").FormRegisteringHost> & typeof import("../types/registration/FormRegisteringMixinTypes.js").FormRegisteringHost; | ||
declare const LionField_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@lion/core/types/SlotMixinTypes").SlotHost> & typeof import("@lion/core/types/SlotMixinTypes").SlotHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/validate/ValidateMixinTypes.js").ValidateHost> & typeof import("../types/validate/ValidateMixinTypes.js").ValidateHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FormControlMixinTypes.js").FormControlHost> & typeof import("../types/FormControlMixinTypes.js").FormControlHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/utils/SyncUpdatableMixinTypes.js").SyncUpdatableHost> & typeof import("../types/utils/SyncUpdatableMixinTypes.js").SyncUpdatableHost & import("@open-wc/dedupe-mixin").Constructor<import("@lion/core/types/DisabledMixinTypes").DisabledHost> & typeof import("@lion/core/types/DisabledMixinTypes").DisabledHost & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost> & typeof import("@open-wc/scoped-elements/src/types").ScopedElementsHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FormatMixinTypes.js").FormatHost> & import("../types/FormatMixinTypes.js").FormatHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/FocusMixinTypes.js").FocusHost> & import("../types/FocusMixinTypes.js").FocusHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/InteractionStateMixinTypes.js").InteractionStateHost> & typeof import("../types/InteractionStateMixinTypes.js").InteractionStateHost & import("@open-wc/dedupe-mixin").Constructor<import("../types/registration/FormRegisteringMixinTypes.js").FormRegisteringHost> & typeof import("../types/registration/FormRegisteringMixinTypes.js").FormRegisteringHost; | ||
/** | ||
@@ -3,0 +3,0 @@ * `LionField`: wraps <input>, <textarea>, <select> and other interactable elements. |
@@ -25,3 +25,3 @@ import { LitElement, SlotMixin } from '@lion/core'; | ||
*/ | ||
// @ts-expect-error base constructors same return type | ||
// @ts-expect-error lit properties false positive | ||
export class LionField extends FormControlMixin( | ||
@@ -28,0 +28,0 @@ InteractionStateMixin(FocusMixin(FormatMixin(ValidateMixin(SlotMixin(LitElement))))), |
@@ -96,3 +96,3 @@ // eslint-disable-next-line max-classes-per-file | ||
} | ||
// @ts-expect-error | ||
// @ts-expect-error this._isFormOrFieldset true means we can assume `this.name` exists | ||
if (name === this.name) { | ||
@@ -99,0 +99,0 @@ console.info('Error Node:', child); // eslint-disable-line no-console |
@@ -56,3 +56,3 @@ import { dedupeMixin } from '@lion/core'; | ||
static __syncUpdatableHasChanged(name, newValue, oldValue) { | ||
// @ts-expect-error FIXME: Typescript bug, superclass static method not availabe from static context | ||
// @ts-expect-error accessing private lit property | ||
const properties = this._classProperties; | ||
@@ -59,0 +59,0 @@ if (properties.get(name) && properties.get(name).hasChanged) { |
@@ -6,3 +6,2 @@ import { LitElement } from '@lion/core'; | ||
describe('FocusMixin', () => { | ||
// @ts-expect-error base constructors same return type | ||
class Focusable extends FocusMixin(LitElement) { | ||
@@ -9,0 +8,0 @@ render() { |
@@ -10,3 +10,2 @@ import { expect, html, defineCE, unsafeStatic, fixture } from '@open-wc/testing'; | ||
// @ts-expect-error base constructor same return type | ||
class FormControlMixinClass extends FormControlMixin(LitElement) {} | ||
@@ -217,3 +216,2 @@ | ||
describe('Model-value-changed event propagation', () => { | ||
// @ts-expect-error base constructor same return type | ||
const FormControlWithRegistrarMixinClass = class extends FormControlMixin( | ||
@@ -220,0 +218,0 @@ FormRegistrarMixin(LitElement), |
@@ -1,2 +0,2 @@ | ||
import { LitElement, UpdatingElement } from '@lion/core'; | ||
import { LitElement } from '@lion/core'; | ||
import { html } from '@open-wc/testing'; | ||
@@ -6,4 +6,4 @@ import { runRegistrationSuite } from '../test-suites/FormRegistrationMixins.suite.js'; | ||
runRegistrationSuite({ | ||
suffix: 'with UpdatingElement', | ||
baseElement: UpdatingElement, | ||
suffix: 'with LitElement', | ||
baseElement: LitElement, | ||
}); | ||
@@ -10,0 +10,0 @@ |
@@ -11,3 +11,2 @@ import { LitElement } from '@lion/core'; | ||
let hasCalledUpdateSync = false; | ||
// @ts-expect-error base constructors same return type | ||
class UpdatableImplementation extends SyncUpdatableMixin(LitElement) { | ||
@@ -69,3 +68,2 @@ static get properties() { | ||
// @ts-expect-error base constructors same return type | ||
class UpdatableImplementation extends SyncUpdatableMixin(LitElement) { | ||
@@ -141,3 +139,2 @@ static get properties() { | ||
// @ts-expect-error the private override is on purpose | ||
class UpdatableImplementation extends SyncUpdatableMixin(LitElement) { | ||
@@ -195,3 +192,2 @@ static get properties() { | ||
it('calls "updateSync" immediately when the observed property is changed (newValue !== oldValue)', async () => { | ||
// @ts-expect-error | ||
class UpdatableImplementation extends SyncUpdatableMixin(LitElement) { | ||
@@ -252,3 +248,2 @@ static get properties() { | ||
it('supports "hasChanged" from UpdatingElement', async () => { | ||
// @ts-expect-error base constructors same return type | ||
class UpdatableImplementation extends SyncUpdatableMixin(LitElement) { | ||
@@ -255,0 +250,0 @@ static get properties() { |
@@ -137,3 +137,3 @@ import { LitElement } from '@lion/core'; | ||
const lightDom = ''; | ||
// @ts-expect-error base constructors same return type | ||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you. | ||
class ValidateElement extends ValidateMixin(LitElement) { | ||
@@ -140,0 +140,0 @@ static get properties() { |
@@ -8,2 +8,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class ChoiceGroupHost { | ||
constructor(...args: any[]); | ||
multipleChoice: boolean; | ||
@@ -10,0 +11,0 @@ |
@@ -18,2 +18,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class ChoiceInputHost { | ||
constructor(...args: any[]); | ||
modelValue: ChoiceInputModelValue; | ||
@@ -20,0 +21,0 @@ serializedValue: ChoiceInputSerializedValue; |
@@ -6,2 +6,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FocusHost { | ||
constructor(...args: any[]); | ||
focused: boolean; | ||
@@ -8,0 +9,0 @@ |
@@ -10,2 +10,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FormGroupHost { | ||
constructor(...args: any[]); | ||
protected static _addDescriptionElementIdsToField(): void; | ||
@@ -33,3 +34,3 @@ _inputNode: HTMLElement; | ||
Constructor<FormGroupHost> & | ||
FormGroupHost & | ||
typeof FormGroupHost & | ||
Constructor<FormRegistrarHost> & | ||
@@ -36,0 +37,0 @@ typeof FormRegistrarHost & |
@@ -8,2 +8,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FormatHost { | ||
constructor(...args: any[]); | ||
formattedValue: string; | ||
@@ -10,0 +11,0 @@ serializedValue: string; |
@@ -39,2 +39,3 @@ import { LitElement, nothing, TemplateResult, CSSResultArray } from '@lion/core'; | ||
export declare class FormControlHost { | ||
constructor(...args: any[]); | ||
static get styles(): CSSResultArray; | ||
@@ -41,0 +42,0 @@ static get properties(): { |
@@ -6,2 +6,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class InteractionStateHost { | ||
constructor(...args: any[]); | ||
prefilled: boolean; | ||
@@ -30,3 +31,3 @@ filled: boolean; | ||
Constructor<InteractionStateHost> & | ||
InteractionStateHost & | ||
typeof InteractionStateHost & | ||
Constructor<FormControlHost> & | ||
@@ -33,0 +34,0 @@ typeof FormControlHost; |
@@ -9,2 +9,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class NativeTextFieldHost { | ||
constructor(...args: any[]); | ||
get selectionStart(): number; | ||
@@ -11,0 +12,0 @@ set selectionStart(value: number); |
@@ -6,2 +6,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FormRegisteringHost { | ||
constructor(...args: any[]); | ||
connectedCallback(): void; | ||
@@ -8,0 +9,0 @@ disconnectedCallback(): void; |
@@ -12,2 +12,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FormRegistrarHost { | ||
constructor(...args: any[]); | ||
_isFormOrFieldset: boolean; | ||
@@ -14,0 +15,0 @@ formElements: FormControlsCollection & { [x: string]: any }; |
@@ -5,2 +5,3 @@ import { Constructor } from '@open-wc/dedupe-mixin'; | ||
export declare class FormRegistrarPortalHost { | ||
constructor(...args: any[]); | ||
registrationTarget: HTMLElement; | ||
@@ -7,0 +8,0 @@ __redispatchEventForFormRegistrarPortalMixin(ev: CustomEvent): void; |
@@ -13,2 +13,3 @@ import { LitElement } from '@lion/core'; | ||
export declare class SyncUpdatableHost { | ||
constructor(...args: any[]); | ||
static __syncUpdatableHasChanged(name: string, newValue: any, oldValue: any): boolean; | ||
@@ -15,0 +16,0 @@ updateSync(name: string, oldValue: any): void; |
@@ -22,2 +22,3 @@ import { LitElement } from '@lion/core'; | ||
export declare class ValidateHost { | ||
constructor(...args: any[]); | ||
validators: Validator[]; | ||
@@ -24,0 +25,0 @@ hasFeedbackFor: string[]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308682
7392
+ Added@lion/core@0.13.8(transitive)
+ Added@lion/localize@0.15.5(transitive)
- Removed@lion/core@0.13.7(transitive)
- Removed@lion/localize@0.15.4(transitive)
Updated@lion/core@0.13.8
Updated@lion/localize@0.15.5