@rws-framework/client 2.21.4 → 2.22.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.21.4",
4
+ "version": "2.22.0",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -21,8 +21,6 @@ type ComposeMethodType<
21
21
 
22
22
  type CSSInjectMode = 'adopted' | 'legacy' | 'both';
23
23
 
24
- const _DEFAULT_INJECT_CSS_CACHE_LIMIT_DAYS = 1;
25
-
26
24
  export interface IWithCompose<T extends RWSViewComponent> {
27
25
  [key: string]: any
28
26
  new(...args: any[]): T;
@@ -252,13 +250,10 @@ abstract class RWSViewComponent extends FoundationElement implements IRWSViewCom
252
250
  return RWSViewComponent.instances;
253
251
  }
254
252
 
255
- protected async injectStyles(styleLinks: string[], mode: CSSInjectMode = 'adopted', maxDaysExp?: number) {
253
+ protected async injectStyles(styleLinks: string[], mode: CSSInjectMode = 'adopted') {
256
254
  const dbName = 'css-cache';
257
255
  const storeName = 'styles';
258
256
  const db = await this.indexedDBService.openDB(dbName, storeName);
259
- const maxAgeMs = 1000 * 60 * 60 * 24; // 24h
260
- const maxDaysAge = maxDaysExp ? maxDaysExp : _DEFAULT_INJECT_CSS_CACHE_LIMIT_DAYS;
261
- const maxAgeDays = maxAgeMs * maxDaysAge;
262
257
 
263
258
  let adoptedSheets: CSSStyleSheet[] = [];
264
259
 
@@ -271,12 +266,13 @@ abstract class RWSViewComponent extends FoundationElement implements IRWSViewCom
271
266
  }
272
267
 
273
268
  if (mode === 'adopted' || mode === 'both') {
274
- const entry = await this.indexedDBService.getFromDB(db, storeName, styleLink);
269
+ const entry = await this.indexedDBService.getFromDB(db, storeName, styleLink);
270
+ const maxAgeMs = 1000 * 60 * 60 * 24; // 24h
275
271
 
276
272
  let cssText: string | null = null;
277
273
 
278
274
  if (entry && typeof entry === 'object' && 'css' in entry && 'timestamp' in entry) {
279
- const expired = Date.now() - entry.timestamp > maxAgeDays;
275
+ const expired = Date.now() - entry.timestamp > maxAgeMs;
280
276
  if (!expired) {
281
277
  cssText = entry.css;
282
278
  }
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ import { RWSIgnore, RWSInject, RWSView } from './components/_decorator';
22
22
  import type { DefaultRWSPluginOptionsType } from './plugins/_plugin';
23
23
  import type { IRWSPlugin, IStaticRWSPlugin, IPluginSpawnOption } from './types/IRWSPlugin';
24
24
  import type IRWSUser from './types/IRWSUser';
25
- import type { IAssetShowOptions, IRWSViewComponent } from './components/_component';
25
+ import type { IAssetShowOptions } from './components/_component';
26
26
  import type { RWSDecoratorOptions } from './components/_decorator';
27
27
  import type { IKDBTypeInfo, IKDBTypesResponse } from './types/IBackendCore';
28
28
  import type { DOMOutputType, TagsProcessorType } from './services/DOMService';
@@ -84,6 +84,5 @@ export type {
84
84
  IAssetShowOptions as IRWSAssetShowOptions,
85
85
  IRWSConfig,
86
86
  IRWSUser,
87
- TagsProcessorType,
88
- IRWSViewComponent
87
+ TagsProcessorType
89
88
  }
@@ -1,9 +1,9 @@
1
- import { FASTElement, ViewTemplate } from '@microsoft/fast-element';
1
+ import { ViewTemplate } from '@microsoft/fast-element';
2
2
  import { DOMOutputType } from '../services/DOMService';
3
3
 
4
4
  type IAssetShowOptions = Record<string, any>;
5
5
 
6
- interface IRWSViewComponent extends FASTElement {
6
+ interface IRWSViewComponent extends Node {
7
7
  __isLoading: boolean;
8
8
  routeParams: Record<string, string>;
9
9
  trashIterator: number;