Skip to content

Commit

Permalink
feat: fix issues for #61
Browse files Browse the repository at this point in the history
+ Rename `ShadowRoot.calcContainingSlot` to `ShadowRoot.getContainingSlot`
+ Add comments for shadowRoot iterate methods
+ Rename `ShadowRoot.isAttached` to `ShadowRoot.isConnected`
+ Change optional `DoubleLinkedList.next` and `DoubleLinkedList.prev` to non-optional
+ Add `_$` and `@internal` for serval private methods
+ Remove all GeneralComponentInstance
+ Add check for linked slot list when testing
+ Add test cases for slot management
  • Loading branch information
Tidyzq committed Jul 24, 2023
1 parent 7123570 commit 71a6336
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 120 deletions.
7 changes: 3 additions & 4 deletions glass-easel/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
DataList,
PropertyList,
MethodList,
GeneralComponentInstance,
DataWithPropertyValues,
RelationParams,
TraitRelationParams,
Expand Down Expand Up @@ -569,7 +568,7 @@ export class Component<
backendElement.setAttribute('exparser:info-component-id', componentInstanceId)
}
comp._$idPrefix = options.idPrefixGenerator
? options.idPrefixGenerator.call(comp as unknown as GeneralComponentInstance)
? options.idPrefixGenerator.call(comp as unknown as GeneralComponent)
: ''

// combine initial data
Expand Down Expand Up @@ -597,7 +596,7 @@ export class Component<

// init relations
const relation = (comp._$relation = new Relation(
comp as unknown as GeneralComponentInstance,
comp as unknown as GeneralComponent,
relationDefinitionGroup,
))

Expand Down Expand Up @@ -738,7 +737,7 @@ export class Component<
initDone = true

// init data
const tmplInst = template.createInstance(comp as unknown as GeneralComponentInstance)
const tmplInst = template.createInstance(comp as unknown as GeneralComponent)
const shadowRoot = tmplInst.shadowRoot
comp.shadowRoot = shadowRoot
const dataGroup = new DataGroup(
Expand Down
6 changes: 0 additions & 6 deletions glass-easel/src/component_params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,3 @@ export type ComponentParams<
| { [fields: string]: ComponentMethod | string }
options?: ComponentOptions
}

export type GeneralComponentInstance = ComponentInstance<
Record<string, any>,
Record<string, any>,
Record<string, any>
>
6 changes: 3 additions & 3 deletions glass-easel/src/data_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { DataPath, MultiPaths } from './data_path'
import { DeepCopyKind } from './global_options'
import { MutationObserverTarget } from './mutation_observer'
import {
GeneralComponentInstance,
DataList,
PropertyList,
MethodList,
ComponentInstance,
DataWithPropertyValues,
} from './component_params'
import { GeneralComponent } from './component'

// eslint-disable-next-line @typescript-eslint/unbound-method
const hasOwnProperty = Object.prototype.hasOwnProperty
Expand Down Expand Up @@ -132,7 +132,7 @@ const callObserver = <
f,
comp.getMethodCaller() as any,
args,
(comp as unknown as GeneralComponentInstance) || undefined,
(comp as unknown as GeneralComponent) || undefined,
)
}

Expand Down Expand Up @@ -641,7 +641,7 @@ export class DataGroup<
prop.observer,
comp.getMethodCaller() as any,
[newValue, oldValue],
comp as unknown as GeneralComponentInstance,
comp as unknown as GeneralComponent,
)
}
if (comp._$mutationObserverTarget) {
Expand Down
Loading

0 comments on commit 71a6336

Please sign in to comment.