Rework documentation URLs as inline markdown. Redesign documentations with markdown text. Redesign way to document scripts/categories and present the documentation. Documentation is showed in an expandable box instead of tooltip. This is to allow writing longer documentation (tooltips are meant to be used for short text) and have better experience on mobile. If a node (script/category) has documentation it's now shown with single information icon (ℹ) aligned to right. Add support for rendering documentation as markdown. It automatically converts plain URLs to URLs with display names (e.g. https://docs.microsoft.com/..) will be rendered automatically like "docs.microsoft.com - Windows 11 Privacy...".
80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
import type { FunctionCallData, ScriptData } from '@/application/collections/';
|
|
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
|
import { FunctionCallDataStub } from '@tests/unit/shared/Stubs/FunctionCallDataStub';
|
|
|
|
export class ScriptDataStub implements ScriptData {
|
|
public static createWithCode(): ScriptDataStub {
|
|
return new ScriptDataStub()
|
|
.withCode('stub-code')
|
|
.withRevertCode('stub-revert-code');
|
|
}
|
|
|
|
public static createWithCall(call?: FunctionCallData): ScriptDataStub {
|
|
let instance = new ScriptDataStub();
|
|
if (call) {
|
|
instance = instance.withCall(call);
|
|
} else {
|
|
instance = instance.withMockCall();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
public static createWithoutCallOrCodes(): ScriptDataStub {
|
|
return new ScriptDataStub();
|
|
}
|
|
|
|
public name = 'valid-name';
|
|
|
|
public code = undefined;
|
|
|
|
public revertCode = undefined;
|
|
|
|
public call = undefined;
|
|
|
|
public recommend = RecommendationLevel[RecommendationLevel.Standard].toLowerCase();
|
|
|
|
public docs?: readonly string[] = ['hello.com'];
|
|
|
|
private constructor() { /* use static methods for constructing */ }
|
|
|
|
public withName(name: string): ScriptDataStub {
|
|
this.name = name;
|
|
return this;
|
|
}
|
|
|
|
public withDocs(docs: readonly string[]): ScriptDataStub {
|
|
this.docs = docs;
|
|
return this;
|
|
}
|
|
|
|
public withCode(code: string): ScriptDataStub {
|
|
this.code = code;
|
|
return this;
|
|
}
|
|
|
|
public withRevertCode(revertCode: string): ScriptDataStub {
|
|
this.revertCode = revertCode;
|
|
return this;
|
|
}
|
|
|
|
public withMockCall(): ScriptDataStub {
|
|
this.call = new FunctionCallDataStub();
|
|
return this;
|
|
}
|
|
|
|
public withCall(call: FunctionCallData): ScriptDataStub {
|
|
this.call = call;
|
|
return this;
|
|
}
|
|
|
|
public withRecommend(recommend: string): ScriptDataStub {
|
|
this.recommend = recommend;
|
|
return this;
|
|
}
|
|
|
|
public withRecommendationLevel(level: RecommendationLevel): ScriptDataStub {
|
|
this.recommend = RecommendationLevel[level].toLowerCase();
|
|
return this;
|
|
}
|
|
}
|