@pi-r/chrome 0.3.5 → 0.3.7

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright 2024 An Pham
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
1
+ Copyright 2023 An Pham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
7
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
- # @pi-r/chrome
2
-
3
- PEP 402 - Forever
4
-
5
- ## LICENSE
6
-
1
+ # @pi-r/chrome
2
+
3
+ ## LICENSE
4
+
7
5
  MIT
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { IFileManager } from '@e-mc/types/lib';
2
-
3
- import type { ChromeDocumentConstructor, DocumentAsset } from './types';
4
-
5
- declare const Chrome: ChromeDocumentConstructor<IFileManager<DocumentAsset>>;
6
-
1
+ import type { IFileManager } from '@e-mc/types/lib';
2
+
3
+ import type { ChromeDocumentConstructor, DocumentAsset } from './types';
4
+
5
+ declare const Chrome: ChromeDocumentConstructor<IFileManager<DocumentAsset>>;
6
+
7
7
  export = Chrome;
package/index.js CHANGED
@@ -190,7 +190,7 @@ function hasCondition(data, condition) {
190
190
  if (items.length && !isSpace(match[0][0])) {
191
191
  return false;
192
192
  }
193
- items.push([match[1], match[2], match[3]]);
193
+ items.push([match[1], trimQuote(match[2]), trimQuote(match[3])]);
194
194
  }
195
195
  REGEXP_TEMPLATECOMPARISON.lastIndex = 0;
196
196
  const length = items.length;
@@ -3109,7 +3109,8 @@ class ChromeDocument extends Document {
3109
3109
  const row = items[0];
3110
3110
  let condition = NaN;
3111
3111
  for (let seg of template) {
3112
- switch ((seg = seg.trim()).toLowerCase()) {
3112
+ seg = seg.trim();
3113
+ switch (seg.toLowerCase()) {
3113
3114
  case ':is(and)':
3114
3115
  if (condition === 0) {
3115
3116
  remove = false;
@@ -3302,7 +3303,7 @@ class ChromeDocument extends Document {
3302
3303
  const parseSelector = (value) => {
3303
3304
  const items = [];
3304
3305
  const revised = value.replace(useUnsafeCssReplace ? REGEXP_NTHCHILD_UNSAFE : REGEXP_NTHCHILD, (...capture) => {
3305
- return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + (capture[6] ? getStringMany() + '[oO][fF]' + getStringMany() + capture[6].trim() : '') + getStringSome() + '\\)') - 1) + '`';
3306
+ return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]?') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b?') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + (capture[6] ? getStringMany() + '[oO][fF]' + getStringMany() + capture[6].trim() : '') + getStringSome() + '\\)') - 1) + '`';
3306
3307
  });
3307
3308
  let selector = '';
3308
3309
  for (let i = 0, length = revised.length, casing = false, attr = false, quote = false; i < length; i++) {
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@pi-r/chrome",
3
- "version": "0.3.5",
4
- "description": "Chrome document constructor for E-mc.",
5
- "main": "index.js",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/anpham6/pi-r.git",
12
- "directory": "src/module/chrome"
13
- },
14
- "keywords": [
15
- "squared",
16
- "e-mc",
17
- "squared-functions"
18
- ],
19
- "author": "An Pham <anpham6@gmail.com>",
20
- "license": "MIT",
21
- "homepage": "https://github.com/anpham6/pi-r#readme",
22
- "dependencies": {
23
- "@e-mc/cloud": "^0.6.7",
24
- "@e-mc/core": "^0.6.7",
25
- "@e-mc/document": "^0.6.7",
26
- "@e-mc/types": "^0.6.7"
27
- }
28
- }
1
+ {
2
+ "name": "@pi-r/chrome",
3
+ "version": "0.3.7",
4
+ "description": "Chrome document constructor for E-mc.",
5
+ "main": "index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/anpham6/pi-r.git",
12
+ "directory": "src/module/chrome"
13
+ },
14
+ "keywords": [
15
+ "squared",
16
+ "e-mc",
17
+ "squared-functions"
18
+ ],
19
+ "author": "An Pham <anpham6@gmail.com>",
20
+ "license": "MIT",
21
+ "homepage": "https://github.com/anpham6/pi-r#readme",
22
+ "dependencies": {
23
+ "@e-mc/cloud": "^0.6.16",
24
+ "@e-mc/core": "^0.6.16",
25
+ "@e-mc/document": "^0.6.16",
26
+ "@e-mc/types": "^0.6.16"
27
+ }
28
+ }
package/types/index.d.ts CHANGED
@@ -1,119 +1,119 @@
1
- import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
2
-
3
- import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
4
- import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
5
- import type { LogTime } from '@e-mc/types/lib/logger';
6
- import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
7
-
8
- import type { CloudScopeOrigin } from '@e-mc/cloud/types';
9
- import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
10
-
11
- import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
12
-
13
- interface DocumentDirectory extends IDocumentDirectory {
14
- template?: string;
15
- data?: string;
16
- export?: string;
17
- schema?: string;
18
- sql?: string;
19
- }
20
-
21
- interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
22
- uri?: T;
23
- local?: T;
24
- export?: T;
25
- }
26
-
27
- interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
28
-
29
- interface DocumentEval extends IDocumentEval {
30
- template?: boolean;
31
- userconfig?: boolean;
32
- }
33
-
34
- interface ChromeDocumentSettings extends IDocumentSettings {
35
- directory?: DocumentDirectory;
36
- options?: DocumentComponentOptions<boolean | number>;
37
- export?: ObjectMap<string | FunctionType>;
38
- }
39
-
40
- type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
41
-
42
- export interface FormatUri extends Partial<LocationUri> {
43
- dictionary?: string;
44
- }
45
-
46
- export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
47
- readonly host: T;
48
- readonly startTime: LogTime;
49
- readonly hashed: Set<DocumentAsset>;
50
- readonly contentMap: StringMap;
51
- readonly bufferMap: ObjectMap<BufferContent>;
52
- readonly cacheMiss: string[];
53
- readonly productionRelease: Undef<true>;
54
- }
55
-
56
- export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
57
-
58
- export interface DocumentModule extends IDocumentModule {
59
- eval?: DocumentEval;
60
- format?: PlainObject & { uuid?: FormatUri };
61
- settings?: ChromeDocumentSettings;
62
- }
63
-
64
- export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
65
- relativeUrl?: string;
66
- inlineFilename?: string;
67
- srcSet?: string[];
68
- inlineUrl?: string;
69
- inlineUrlMap?: StringMap;
70
- inlineUrlCloud?: string;
71
- inlineUrlCloudMap?: StringMap;
72
- inlineBase64?: string;
73
- modified?: boolean;
74
- }
75
-
76
- export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
77
- useUnsafeHtmlReplace?: boolean;
78
- useUnsafeCssReplace?: boolean;
79
- }
80
-
81
- export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
82
- htmlFile: Null<U>;
83
- cssFiles: U[];
84
- jsFiles: U[];
85
- svgFiles: U[];
86
- baseDirectory: string;
87
- baseUrl: string;
88
- config: UserConfig;
89
- related: Map<U, Set<U>>;
90
- replaced: U[];
91
- formatMap?: ObjectMap<FormatUri>;
92
- setElementSrc(asset: U, element: IXmlElement, value: string): void;
93
- findDataValue(name: string): Undef<string>;
94
- setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
95
- applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
96
- rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
97
- setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
98
- applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
99
- setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
100
- removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
101
- removeServerRoot(value: string): string;
102
- replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
103
- cloudInit(state: CloudScopeOrigin<T, U, V>): void;
104
- cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
105
- cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
106
- cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
107
- get editing(): U[];
108
- set dataSource(value);
109
- get dataSource(): DataSource[];
110
- get elements(): XmlTagNode[];
111
- get settings(): ChromeDocumentSettings;
112
- }
113
-
114
- export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
115
- INTERNAL_ASSIGNUUID: string;
116
- INTERNAL_SERVERROOT: string;
117
- readonly prototype: IChromeDocument<T, U>;
118
- new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
1
+ import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
2
+
3
+ import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
4
+ import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
5
+ import type { LogTime } from '@e-mc/types/lib/logger';
6
+ import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
7
+
8
+ import type { CloudScopeOrigin } from '@e-mc/cloud/types';
9
+ import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
10
+
11
+ import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
12
+
13
+ interface DocumentDirectory extends IDocumentDirectory {
14
+ template?: string;
15
+ data?: string;
16
+ export?: string;
17
+ schema?: string;
18
+ sql?: string;
19
+ }
20
+
21
+ interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
22
+ uri?: T;
23
+ local?: T;
24
+ export?: T;
25
+ }
26
+
27
+ interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
28
+
29
+ interface DocumentEval extends IDocumentEval {
30
+ template?: boolean;
31
+ userconfig?: boolean;
32
+ }
33
+
34
+ interface ChromeDocumentSettings extends IDocumentSettings {
35
+ directory?: DocumentDirectory;
36
+ options?: DocumentComponentOptions<boolean | number>;
37
+ export?: ObjectMap<string | FunctionType>;
38
+ }
39
+
40
+ type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
41
+
42
+ export interface FormatUri extends Partial<LocationUri> {
43
+ dictionary?: string;
44
+ }
45
+
46
+ export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
47
+ readonly host: T;
48
+ readonly startTime: LogTime;
49
+ readonly hashed: Set<DocumentAsset>;
50
+ readonly contentMap: StringMap;
51
+ readonly bufferMap: ObjectMap<BufferContent>;
52
+ readonly cacheMiss: string[];
53
+ readonly productionRelease: Undef<true>;
54
+ }
55
+
56
+ export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
57
+
58
+ export interface DocumentModule extends IDocumentModule {
59
+ eval?: DocumentEval;
60
+ format?: PlainObject & { uuid?: FormatUri };
61
+ settings?: ChromeDocumentSettings;
62
+ }
63
+
64
+ export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
65
+ relativeUrl?: string;
66
+ inlineFilename?: string;
67
+ srcSet?: string[];
68
+ inlineUrl?: string;
69
+ inlineUrlMap?: StringMap;
70
+ inlineUrlCloud?: string;
71
+ inlineUrlCloudMap?: StringMap;
72
+ inlineBase64?: string;
73
+ modified?: boolean;
74
+ }
75
+
76
+ export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
77
+ useUnsafeHtmlReplace?: boolean;
78
+ useUnsafeCssReplace?: boolean;
79
+ }
80
+
81
+ export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
82
+ htmlFile: Null<U>;
83
+ cssFiles: U[];
84
+ jsFiles: U[];
85
+ svgFiles: U[];
86
+ baseDirectory: string;
87
+ baseUrl: string;
88
+ config: UserConfig;
89
+ related: Map<U, Set<U>>;
90
+ replaced: U[];
91
+ formatMap?: ObjectMap<FormatUri>;
92
+ setElementSrc(asset: U, element: IXmlElement, value: string): void;
93
+ findDataValue(name: string): Undef<string>;
94
+ setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
95
+ applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
96
+ rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
97
+ setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
98
+ applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
99
+ setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
100
+ removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
101
+ removeServerRoot(value: string): string;
102
+ replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
103
+ cloudInit(state: CloudScopeOrigin<T, U, V>): void;
104
+ cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
105
+ cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
106
+ cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
107
+ get editing(): U[];
108
+ set dataSource(value);
109
+ get dataSource(): DataSource[];
110
+ get elements(): XmlTagNode[];
111
+ get settings(): ChromeDocumentSettings;
112
+ }
113
+
114
+ export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
115
+ INTERNAL_ASSIGNUUID: string;
116
+ INTERNAL_SERVERROOT: string;
117
+ readonly prototype: IChromeDocument<T, U>;
118
+ new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
119
119
  }
@@ -1,114 +1,114 @@
1
- import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from '@e-mc/types/lib/squared';
2
-
3
- import type { UploadAction } from '@e-mc/types/lib/cloud';
4
- import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
5
- import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
6
-
7
- interface ImportFrom {
8
- placeholder: string;
9
- original: string;
10
- uri: string;
11
- type?: string;
12
- dynamic?: boolean;
13
- }
14
-
15
- interface DataObject extends CascadeAction {
16
- format?: string;
17
- options?: PlainObject;
18
- }
19
-
20
- export interface UserAgentData {
21
- platform: string;
22
- brand: string;
23
- browser: number;
24
- version: Null<number[]>;
25
- }
26
-
27
- export interface DocumentOutput {
28
- productionRelease?: boolean | string;
29
- productionIncremental?: boolean;
30
- useOriginalHtmlPage?: boolean | string;
31
- useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
32
- stripCommentsAndCDATA?: boolean | string;
33
- normalizeHtmlOutput?: boolean | string;
34
- escapeReservedCharacters?: boolean;
35
- ignoreServerCodeBlocks?: string[];
36
- webBundle?: {
37
- rootDirAlias?: string;
38
- baseUrl?: string;
39
- primaryUrl?: string;
40
- copyTo?: string;
41
- rewriteHtmlPage?: boolean | string;
42
- excludeHtmlPage?: boolean;
43
- excludeTransforms?: boolean;
44
- includeScopes?: string[];
45
- excludeScopes?: string[];
46
- };
47
- templateMap?: TemplateMap;
48
- userAgentData?: Partial<UserAgentData>;
49
- }
50
-
51
- export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
52
-
53
- export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
54
- preserve?: boolean;
55
- static?: boolean;
56
- editing?: boolean;
57
- inlineContent?: string;
58
- originAddress?: boolean;
59
- }
60
-
61
- export interface TemplateMap extends PlainObject {
62
- html?: ObjectMap<StringMap>;
63
- js?: ObjectMap<StringMap>;
64
- css?: ObjectMap<StringMap>;
65
- data?: StringMap;
66
- }
67
-
68
- export interface CssRuleData {
69
- usedVariables?: string[];
70
- usedFontFace?: string[];
71
- usedKeyframes?: string[];
72
- unusedStyles?: string[];
73
- unusedMedia?: string[];
74
- unusedContainer?: string[];
75
- unusedSupports?: string[];
76
- unusedAtRules?: UnusedAtRule[];
77
- }
78
-
79
- export interface UnusedAtRule {
80
- selector?: string;
81
- media?: ConditionProperty;
82
- supports?: ConditionProperty;
83
- container?: CssConditionData & Partial<ConditionProperty>;
84
- layer?: string[];
85
- }
86
-
87
- export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
88
- source: "cloud" | "uri" | "local" | "export" | DbSource;
89
- element?: XmlTagNode;
90
- type?: "text" | "attribute" | "display";
91
- dynamic?: boolean;
92
- value?: StringOfArray | ObjectMap<unknown>;
93
- template?: string;
94
- viewEngine?: ViewEngine | string;
95
- ignoreEmpty?: boolean;
96
- }
97
-
98
- export interface UriDataSource extends DataSource, DataObject {
99
- source: "uri";
100
- }
101
-
102
- export interface LocalDataSource extends DataSource, DataObject {
103
- source: "local";
104
- pathname?: string;
105
- }
106
-
107
- export interface ExportDataSource extends DataSource, CascadeAction {
108
- source: "export";
109
- execute?: FunctionType;
110
- pathname?: string;
111
- settings?: string;
112
- params?: unknown;
113
- persist?: boolean;
1
+ import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from '@e-mc/types/lib/squared';
2
+
3
+ import type { UploadAction } from '@e-mc/types/lib/cloud';
4
+ import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
5
+ import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
6
+
7
+ interface ImportFrom {
8
+ placeholder: string;
9
+ original: string;
10
+ uri: string;
11
+ type?: string;
12
+ dynamic?: boolean;
13
+ }
14
+
15
+ interface DataObject extends CascadeAction {
16
+ format?: string;
17
+ options?: PlainObject;
18
+ }
19
+
20
+ export interface UserAgentData {
21
+ platform: string;
22
+ brand: string;
23
+ browser: number;
24
+ version: Null<number[]>;
25
+ }
26
+
27
+ export interface DocumentOutput {
28
+ productionRelease?: boolean | string;
29
+ productionIncremental?: boolean;
30
+ useOriginalHtmlPage?: boolean | string;
31
+ useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
32
+ stripCommentsAndCDATA?: boolean | string;
33
+ normalizeHtmlOutput?: boolean | string;
34
+ escapeReservedCharacters?: boolean;
35
+ ignoreServerCodeBlocks?: string[];
36
+ webBundle?: {
37
+ rootDirAlias?: string;
38
+ baseUrl?: string;
39
+ primaryUrl?: string;
40
+ copyTo?: string;
41
+ rewriteHtmlPage?: boolean | string;
42
+ excludeHtmlPage?: boolean;
43
+ excludeTransforms?: boolean;
44
+ includeScopes?: string[];
45
+ excludeScopes?: string[];
46
+ };
47
+ templateMap?: TemplateMap;
48
+ userAgentData?: Partial<UserAgentData>;
49
+ }
50
+
51
+ export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
52
+
53
+ export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
54
+ preserve?: boolean;
55
+ static?: boolean;
56
+ editing?: boolean;
57
+ inlineContent?: string;
58
+ originAddress?: boolean;
59
+ }
60
+
61
+ export interface TemplateMap extends PlainObject {
62
+ html?: ObjectMap<StringMap>;
63
+ js?: ObjectMap<StringMap>;
64
+ css?: ObjectMap<StringMap>;
65
+ data?: StringMap;
66
+ }
67
+
68
+ export interface CssRuleData {
69
+ usedVariables?: string[];
70
+ usedFontFace?: string[];
71
+ usedKeyframes?: string[];
72
+ unusedStyles?: string[];
73
+ unusedMedia?: string[];
74
+ unusedContainer?: string[];
75
+ unusedSupports?: string[];
76
+ unusedAtRules?: UnusedAtRule[];
77
+ }
78
+
79
+ export interface UnusedAtRule {
80
+ selector?: string;
81
+ media?: ConditionProperty;
82
+ supports?: ConditionProperty;
83
+ container?: CssConditionData & Partial<ConditionProperty>;
84
+ layer?: string[];
85
+ }
86
+
87
+ export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
88
+ source: "cloud" | "uri" | "local" | "export" | DbSource;
89
+ element?: XmlTagNode;
90
+ type?: "text" | "attribute" | "display";
91
+ dynamic?: boolean;
92
+ value?: StringOfArray | ObjectMap<unknown>;
93
+ template?: string;
94
+ viewEngine?: ViewEngine | string;
95
+ ignoreEmpty?: boolean;
96
+ }
97
+
98
+ export interface UriDataSource extends DataSource, DataObject {
99
+ source: "uri";
100
+ }
101
+
102
+ export interface LocalDataSource extends DataSource, DataObject {
103
+ source: "local";
104
+ pathname?: string;
105
+ }
106
+
107
+ export interface ExportDataSource extends DataSource, CascadeAction {
108
+ source: "export";
109
+ execute?: FunctionType;
110
+ pathname?: string;
111
+ settings?: string;
112
+ params?: unknown;
113
+ persist?: boolean;
114
114
  }