@skyux/core 6.3.2 → 6.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.
@@ -1344,10 +1344,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
1344
1344
  }]
1345
1345
  }] });
1346
1346
 
1347
+ var _SkyIdDirective__id;
1347
1348
  let idIndex = 0;
1348
1349
  function generateId() {
1349
1350
  idIndex++;
1350
- return `sky-id-gen__${idIndex}`;
1351
+ // Include timestamp and an incrementing index to guarantee unique IDs both during the application
1352
+ // lifecycle as well as across sessions, since browsers will try to apply autocomplete options to
1353
+ // elements with the same ID across sessions.
1354
+ return `sky-id-gen__${new Date().getTime()}__${idIndex}`;
1351
1355
  }
1352
1356
  /**
1353
1357
  * Sets the element's `id` attribute to a unique ID. To reference this unique ID on other elements,
@@ -1356,16 +1360,18 @@ function generateId() {
1356
1360
  */
1357
1361
  class SkyIdDirective {
1358
1362
  constructor(elRef, renderer) {
1363
+ _SkyIdDirective__id.set(this, void 0);
1359
1364
  // Generate and apply the ID before the template is rendered
1360
1365
  // to avoid a changed-after-checked error.
1361
1366
  const id = generateId();
1362
1367
  renderer.setAttribute(elRef.nativeElement, 'id', id);
1363
- this._id = id;
1368
+ __classPrivateFieldSet(this, _SkyIdDirective__id, id, "f");
1364
1369
  }
1365
1370
  get id() {
1366
- return this._id;
1371
+ return __classPrivateFieldGet(this, _SkyIdDirective__id, "f");
1367
1372
  }
1368
1373
  }
1374
+ _SkyIdDirective__id = new WeakMap();
1369
1375
  SkyIdDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1370
1376
  SkyIdDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyIdDirective, selector: "[skyId]", exportAs: ["skyId"], ngImport: i0 });
1371
1377
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyIdDirective, decorators: [{
@@ -2886,6 +2892,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
2886
2892
  }]
2887
2893
  }], ctorParameters: function () { return [{ type: i1$1.Title }]; } });
2888
2894
 
2895
+ var _SkyTrimDirective_instances, _SkyTrimDirective_obs, _SkyTrimDirective_observe, _SkyTrimDirective_disconnect, _SkyTrimDirective_trim;
2896
+ /**
2897
+ * Trims whitespace in each text node that is a direct descendent of the current element.
2898
+ */
2899
+ class SkyTrimDirective {
2900
+ constructor(elRef, mutationObs) {
2901
+ this.elRef = elRef;
2902
+ this.mutationObs = mutationObs;
2903
+ _SkyTrimDirective_instances.add(this);
2904
+ _SkyTrimDirective_obs.set(this, void 0);
2905
+ __classPrivateFieldSet(this, _SkyTrimDirective_obs, this.mutationObs.create((mutations) => {
2906
+ const nodes = [];
2907
+ // Only trim white space inside direct descendents of the current element.
2908
+ for (const mutation of mutations) {
2909
+ if (mutation.target.parentNode === this.elRef.nativeElement) {
2910
+ nodes.push(mutation.target);
2911
+ }
2912
+ }
2913
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_trim).call(this, nodes);
2914
+ }), "f");
2915
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_observe).call(this);
2916
+ }
2917
+ ngOnInit() {
2918
+ const el = this.elRef.nativeElement;
2919
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_trim).call(this, Array.from(el.childNodes));
2920
+ }
2921
+ ngOnDestroy() {
2922
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_disconnect).call(this);
2923
+ __classPrivateFieldSet(this, _SkyTrimDirective_obs, undefined, "f");
2924
+ }
2925
+ }
2926
+ _SkyTrimDirective_obs = new WeakMap(), _SkyTrimDirective_instances = new WeakSet(), _SkyTrimDirective_observe = function _SkyTrimDirective_observe() {
2927
+ __classPrivateFieldGet(this, _SkyTrimDirective_obs, "f").observe(this.elRef.nativeElement, {
2928
+ characterData: true,
2929
+ subtree: true,
2930
+ });
2931
+ }, _SkyTrimDirective_disconnect = function _SkyTrimDirective_disconnect() {
2932
+ __classPrivateFieldGet(this, _SkyTrimDirective_obs, "f").disconnect();
2933
+ }, _SkyTrimDirective_trim = function _SkyTrimDirective_trim(nodes) {
2934
+ // Suspend the MutationObserver so altering the text content of each node
2935
+ // doesn't retrigger the observe callback.
2936
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_disconnect).call(this);
2937
+ for (const node of nodes) {
2938
+ if (node.nodeType === Node.TEXT_NODE) {
2939
+ const textContent = node.textContent;
2940
+ const textContentTrimmed = textContent.trim();
2941
+ if (textContent !== textContentTrimmed) {
2942
+ node.textContent = textContentTrimmed;
2943
+ }
2944
+ }
2945
+ }
2946
+ __classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_observe).call(this);
2947
+ };
2948
+ SkyTrimDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimDirective, deps: [{ token: i0.ElementRef }, { token: MutationObserverService }], target: i0.ɵɵFactoryTarget.Directive });
2949
+ SkyTrimDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyTrimDirective, selector: "[skyTrim]", ngImport: i0 });
2950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimDirective, decorators: [{
2951
+ type: Directive,
2952
+ args: [{
2953
+ selector: '[skyTrim]',
2954
+ }]
2955
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MutationObserverService }]; } });
2956
+
2957
+ class SkyTrimModule {
2958
+ }
2959
+ SkyTrimModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2960
+ SkyTrimModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimModule, declarations: [SkyTrimDirective], exports: [SkyTrimDirective] });
2961
+ SkyTrimModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimModule });
2962
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyTrimModule, decorators: [{
2963
+ type: NgModule,
2964
+ args: [{
2965
+ declarations: [SkyTrimDirective],
2966
+ exports: [SkyTrimDirective],
2967
+ }]
2968
+ }] });
2969
+
2889
2970
  class SkyUIConfigService {
2890
2971
  getConfig(key, defaultConfig) {
2891
2972
  return of(defaultConfig);
@@ -3320,5 +3401,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
3320
3401
  * Generated bundle index. Do not edit.
3321
3402
  */
3322
3403
 
3323
- export { MutationObserverService, NumericOptions, SKY_LOG_LEVEL, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3 };
3404
+ export { MutationObserverService, NumericOptions, SKY_LOG_LEVEL, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
3324
3405
  //# sourceMappingURL=skyux-core.mjs.map