移除一些无用的API

master
yutent 2023-09-20 19:02:34 +08:00
parent ce4bf92ce2
commit c5333cbc2a
2 changed files with 3 additions and 11 deletions

View File

@ -248,7 +248,6 @@ class Template {
class TemplateInstance { class TemplateInstance {
constructor(template, parent) { constructor(template, parent) {
this._parts = [] this._parts = []
this._$disconnectableChildren = void 0
this._$template = template this._$template = template
this._$parent = parent this._$parent = parent
} }
@ -349,15 +348,14 @@ class ChildPart {
constructor(startNode, endNode, parent, options) { constructor(startNode, endNode, parent, options) {
this.type = CHILD_PART this.type = CHILD_PART
this._$committedValue = NOTHING this._$committedValue = NOTHING
this._$disconnectableChildren = void 0
this._$startNode = startNode this._$startNode = startNode
this._$endNode = endNode this._$endNode = endNode
this._$parent = parent this._$parent = parent
this.options = options this.options = options
this.__isConnected = options.isConnected || true this.__isConnected = options.isConnected ?? true
} }
get _$isConnected() { get _$isConnected() {
return this._$parent?._$isConnected || this.__isConnected return this._$parent?._$isConnected ?? this.__isConnected
} }
get parentNode() { get parentNode() {
let parentNode = this._$startNode.parentNode let parentNode = this._$startNode.parentNode
@ -475,8 +473,6 @@ class ChildPart {
} }
#clear(start = this._$startNode.nextSibling, from) { #clear(start = this._$startNode.nextSibling, from) {
this._$notifyConnectionChanged?.call(this, false, true, from)
while (start && start !== this._$endNode) { while (start && start !== this._$endNode) {
let node = start.nextSibling let node = start.nextSibling
start.remove() start.remove()
@ -486,7 +482,6 @@ class ChildPart {
setConnected(isConnected) { setConnected(isConnected) {
if (this._$parent === void 0) { if (this._$parent === void 0) {
this.__isConnected = isConnected this.__isConnected = isConnected
this._$notifyConnectionChanged?.call(this, isConnected)
} }
} }
} }
@ -495,7 +490,6 @@ class AttributePart {
constructor(element, name, strings, decorates, parent, options = {}) { constructor(element, name, strings, decorates, parent, options = {}) {
this.type = ATTRIBUTE_PART this.type = ATTRIBUTE_PART
this._$committedValue = NOTHING this._$committedValue = NOTHING
this._$disconnectableChildren = void 0
this.element = element this.element = element
this.name = name this.name = name
this.decorates = decorates this.decorates = decorates
@ -688,7 +682,6 @@ class ElementPart {
constructor(element, parent, options) { constructor(element, parent, options) {
this.element = element this.element = element
this.type = ELEMENT_PART this.type = ELEMENT_PART
this._$disconnectableChildren = void 0
this._$parent = parent this._$parent = parent
this.options = options this.options = options
} }

View File

@ -253,8 +253,6 @@ export class Component extends HTMLElement {
} }
this.#init() this.#init()
adoptStyles(this.root, this.constructor.styles) adoptStyles(this.root, this.constructor.styles)
this[__children__]?.setConnected(true)
} }
disconnectedCallback() { disconnectedCallback() {
@ -382,6 +380,7 @@ export class Component extends HTMLElement {
// 初始化时不触发updated回调 // 初始化时不触发updated回调
if (this[__mounted__] === false) { if (this[__mounted__] === false) {
this[__mounted__] = true this[__mounted__] = true
this[__children__].setConnected(true)
if (this.$animate?.immediate) { if (this.$animate?.immediate) {
this.$animate() this.$animate()
} }