@genesislcap/foundation-utils 14.3.1-alpha-d0e4402.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,25 @@
1
1
  import { Constructable, FASTElement } from '@microsoft/fast-element';
2
2
  export type ConstructableLifecycleHandler = Constructable<FASTElement & HTMLElement>;
3
- type Draggable = {
3
+ type FoundationLayoutContainer = {
4
4
  dragging: boolean;
5
+ hasFirstLoaded: boolean;
6
+ _key: 'foundation-layout';
5
7
  };
8
+ type LayoutCacheContainer = {
9
+ _key: 'foundation-layout-cache';
10
+ };
11
+ type DOMContainer = {
12
+ _key: 'dom';
13
+ };
14
+ type Container = FoundationLayoutContainer | LayoutCacheContainer | DOMContainer;
6
15
  export declare const LifecycleMixin: <T extends ConstructableLifecycleHandler>(Base: T) => {
7
16
  new (...args: any[]): {
8
- "__#1@#_containingLayout": Draggable | null;
17
+ "__#1@#_container": Container;
9
18
  cloneNode(deep?: boolean): Node;
10
19
  deepClone(): Node;
11
20
  readonly shouldRunDisconnect: boolean;
12
21
  readonly shouldRunConnect: boolean;
13
- "__#1@#_tryFindContainingLayout"(e: Element): Draggable | null;
22
+ "__#1@#_tryFindContainingLayout"(e: Element): Container;
14
23
  connectedCallback(): void;
15
24
  readonly $fastController: import("@microsoft/fast-element").Controller;
16
25
  $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail">): boolean | void;
@@ -325,5 +334,6 @@ export declare const LifecycleMixin: <T extends ConstructableLifecycleHandler>(B
325
334
  focus(options?: FocusOptions): void;
326
335
  };
327
336
  } & T;
337
+ export declare const layoutCacheDocument: unique symbol;
328
338
  export {};
329
339
  //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/mixins/lifecycle/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MA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AS,GAAG,yBAAyB,GAAG,oBAAoB,GAAG,YAAY,CAAC;AAYjF,eAAO,MAAM,cAAc;kBAKF,GAAG,EAAE;4BAFb,SAAS;yBAYI,OAAO,GAAG,IAAI;qBAiB3B,IAAI;;;4CAsCY,OAAO,GAAG,SAAS;6BA4B3B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAM1B,CAAC;AAMJ,eAAO,MAAM,mBAAmB,eAAkC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
2
- export const LifecycleMixin = (Base) => { var _instances, __containingLayout, __tryFindContainingLayout, _a; return _a = class extends Base {
2
+ export const LifecycleMixin = (Base) => { var _instances, __container, __tryFindContainingLayout, _a; return _a = class extends Base {
3
3
  constructor(...args) {
4
4
  super(args);
5
5
  _instances.add(this);
6
- __containingLayout.set(this, null);
6
+ __container.set(this, { _key: 'dom' });
7
7
  }
8
8
  cloneNode(deep) {
9
9
  const thisClone = this.deepClone();
@@ -20,30 +20,40 @@ export const LifecycleMixin = (Base) => { var _instances, __containingLayout, __
20
20
  return copy;
21
21
  }
22
22
  get shouldRunDisconnect() {
23
- if (__classPrivateFieldGet(this, __containingLayout, "f") === null)
23
+ if (__classPrivateFieldGet(this, __container, "f")._key === 'dom') {
24
24
  return true;
25
- return !__classPrivateFieldGet(this, __containingLayout, "f").dragging;
25
+ }
26
+ if (__classPrivateFieldGet(this, __container, "f")._key === 'foundation-layout-cache') {
27
+ return false;
28
+ }
29
+ return !(__classPrivateFieldGet(this, __container, "f").dragging || !__classPrivateFieldGet(this, __container, "f").hasFirstLoaded);
26
30
  }
27
31
  get shouldRunConnect() {
28
32
  return this.shouldRunDisconnect;
29
33
  }
30
34
  connectedCallback() {
31
35
  super.connectedCallback();
32
- if (__classPrivateFieldGet(this, __containingLayout, "f") === null) {
33
- __classPrivateFieldSet(this, __containingLayout, __classPrivateFieldGet(this, _instances, "m", __tryFindContainingLayout).call(this, this), "f");
36
+ if (__classPrivateFieldGet(this, __container, "f")._key !== 'foundation-layout') {
37
+ __classPrivateFieldSet(this, __container, __classPrivateFieldGet(this, _instances, "m", __tryFindContainingLayout).call(this, this), "f");
34
38
  }
35
39
  }
36
40
  },
37
- __containingLayout = new WeakMap(),
41
+ __container = new WeakMap(),
38
42
  _instances = new WeakSet(),
39
43
  __tryFindContainingLayout = function __tryFindContainingLayout(e) {
40
- if (e.getRootNode() instanceof Document || e.getRootNode() instanceof DocumentFragment) {
41
- return null;
44
+ if (e.getRootNode()[layoutCacheDocument] === true) {
45
+ return { _key: 'foundation-layout-cache' };
46
+ }
47
+ if (e.getRootNode() instanceof Document) {
48
+ return { _key: 'dom' };
42
49
  }
43
50
  const shadowHost = e.getRootNode().host;
44
51
  if (shadowHost.constructor.name === 'FoundationLayout') {
45
- return shadowHost;
52
+ const layoutHost = shadowHost;
53
+ layoutHost._key = 'foundation-layout';
54
+ return layoutHost;
46
55
  }
47
56
  return __classPrivateFieldGet(this, _instances, "m", __tryFindContainingLayout).call(this, shadowHost);
48
57
  },
49
58
  _a; };
59
+ export const layoutCacheDocument = Symbol('layout-cache-document');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "14.3.1-alpha-d0e4402.0",
4
+ "version": "14.5.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "4321a5bdc42370bb1d5731a0fba999fdedc0e8bb"
91
+ "gitHead": "0b69be3bb6826011ac8571a7bbb414cdb147c29a"
92
92
  }