UNPKG

@vaadin/hilla-models

Version:

Generative form models for Hilla

48 lines 1.32 kB
export const nothing = Symbol('nothing'); const detachedTarget = Object.create({ toString: () => ':detached:', }, { model: { value: undefined }, value: { value: nothing }, }); export const $key = Symbol('key'); export const $name = Symbol('name'); export const $owner = Symbol('owner'); export const $meta = Symbol('meta'); export const $optional = Symbol('optional'); export const $defaultValue = Symbol('value'); export const $enum = Symbol('enumerate'); export const $members = Symbol('members'); export const $itemModel = Symbol('itemModel'); export const Model = Object.create(null, { [$key]: { value: 'model', }, [$name]: { value: 'Model', }, [$owner]: { value: detachedTarget, }, [$meta]: {}, [$optional]: { value: false, }, [$defaultValue]: {}, [Symbol.toStringTag]: { get() { return this[$name]; }, }, [Symbol.hasInstance]: { value(o) { return typeof o === 'object' && o != null && (this === o || Object.prototype.isPrototypeOf.call(this, o)); }, }, toString: { value() { return `[${String(this[$owner])} / ${String(this[$key])}${this[$optional] ? '?' : ''}] ${this[$name]}`; }, }, }); //# sourceMappingURL=model.js.map