steam-theming-utils 3.0.0 → 3.1.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/cdp/db/client.js +3 -3
- package/cdp/make_readable_classes.js +12 -0
- package/lib/build_class_modules.js +2 -1
- package/lib/replace_old_classes.js +9 -1
- package/package.json +1 -1
- package/src/api.d.ts +1 -0
- package/src/postcss_plugin.js +1 -0
- package/src/shared.js +3 -7
package/cdp/db/client.js
CHANGED
|
@@ -120,11 +120,13 @@ exportedModules = [
|
|
|
120
120
|
["appdetailsheader", (e) => e.AppDetailsOverviewPanel],
|
|
121
121
|
["appdetailsheaderinfo", (e) => e.HeaderFriendsInGameBadge],
|
|
122
122
|
["appdetailshover", (e) => e.AppDetailsHover],
|
|
123
|
+
["appdetailsinfoicon", (e) => e.MoreInfoIcon],
|
|
123
124
|
["appdetailsinvalidostype", (e) => e.InvalidOSTypeBody],
|
|
124
125
|
["appdetailsmastersubincluded", (e) => e.IncludedBanner],
|
|
125
126
|
["appdetailsnotessection", (e) => e.NoteLink],
|
|
126
127
|
["appdetailsoverview", (e) => e.SeekTarget],
|
|
127
128
|
["appdetailsplaysection", (e) => e.PermanentlyUnavailable],
|
|
129
|
+
["appdetailsposttextentry", (e) => e.PostTextEntryArea],
|
|
128
130
|
["appdetailsprimarylinkssection", (e) => e.NavButton],
|
|
129
131
|
["appdetailsreviewsection", (e) => e.EditMyReview],
|
|
130
132
|
["appdetailsscreenshotssection", (e) => e.ScreenshotsSection],
|
|
@@ -215,7 +217,6 @@ exportedModules = [
|
|
|
215
217
|
["cliptimelinerecordingdecorator", (e) => e.LiveRecordingBuffer],
|
|
216
218
|
["cloudconflict", (e) => e.ConflictChoiceText],
|
|
217
219
|
["cloudfileuploadprogress", (e) => e.UploadPreviewContainer],
|
|
218
|
-
["collapseicon", (e) => e.CollapseIconParent],
|
|
219
220
|
["collectionbanner", (e) => e.CollectionShelfBanner],
|
|
220
221
|
["collectionview", (e) => e.DynamicCollectionLabelAndButton],
|
|
221
222
|
["colorsettings", (e) => e.FloatingControls],
|
|
@@ -305,6 +306,7 @@ exportedModules = [
|
|
|
305
306
|
["gamelaunchingdialog", (e) => e.GameLaunchingDialog],
|
|
306
307
|
["gamelist", (e) => e.NoSearchResultsContainer],
|
|
307
308
|
["gamelistbar", (e) => e.GameListHomeAndSearch],
|
|
309
|
+
["gamelistcollapseicon", (e) => e.CollapseIconParent],
|
|
308
310
|
["gamelistcollectionmenu", (e) => e.CollectionDeleteContainer],
|
|
309
311
|
["gamelistdropdown", (e) => e.ScrollToTop],
|
|
310
312
|
["gamelistentry", (e) => e.GameListEntryName],
|
|
@@ -352,7 +354,6 @@ exportedModules = [
|
|
|
352
354
|
["hoverposition", (e) => e.HoverPosition],
|
|
353
355
|
["htmlpopupdialog", (e) => e.HTMLPopupDialog],
|
|
354
356
|
["index", (e) => e.ThreeDots],
|
|
355
|
-
["infoicon", (e) => e.MoreInfoIcon],
|
|
356
357
|
["insetshadow", (e) => e.FriendsListInsetShadowCtn],
|
|
357
358
|
["installdialog", (e) => e.DownloadItem],
|
|
358
359
|
["installrequest", (e) => e.AppSizeRequired],
|
|
@@ -444,7 +445,6 @@ exportedModules = [
|
|
|
444
445
|
["personastatusicons", (e) => e.PersonaStatusIcon],
|
|
445
446
|
["pininput", (e) => e.DigitInputField],
|
|
446
447
|
["playersdialog", (e) => e.PlayersDialog],
|
|
447
|
-
["posttextentry", (e) => e.PostTextEntryArea],
|
|
448
448
|
["powermenu", (e) => e.SuspendDialog],
|
|
449
449
|
["presenterpopup", (e) => e.Speaker],
|
|
450
450
|
["progressbar", (e) => e.ProgressBarFieldStatus],
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} className
|
|
3
|
+
* @returns the readable class name.
|
|
4
|
+
*/
|
|
1
5
|
function getNormalClass(className) {
|
|
2
6
|
for (const key of Object.keys(classModules)) {
|
|
3
7
|
const mod = classModules[key];
|
|
@@ -13,6 +17,11 @@ function getNormalClass(className) {
|
|
|
13
17
|
notInDb.push(className);
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Sets readable classes to a `data-readable-class` attribute.
|
|
22
|
+
*
|
|
23
|
+
* @param {HTMLElement} el
|
|
24
|
+
*/
|
|
16
25
|
function normalizeElement(el) {
|
|
17
26
|
const readableClasses = [...el.classList]
|
|
18
27
|
.map(getNormalClass)
|
|
@@ -26,6 +35,9 @@ function normalizeElement(el) {
|
|
|
26
35
|
el.dataset.readableClass = `\n${readableClasses}\n`;
|
|
27
36
|
}
|
|
28
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @param {FocusEvent}
|
|
40
|
+
*/
|
|
29
41
|
function main({ target }) {
|
|
30
42
|
const elements = target.document.querySelectorAll("[class]");
|
|
31
43
|
for (const el of elements) {
|
|
@@ -36,6 +36,7 @@ async function sleepUntilResult(...args) {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Gets a CDP web connection, accounting for the needed React part to load.
|
|
39
|
+
*
|
|
39
40
|
* @param {import("../src/api").Page | "client"} page
|
|
40
41
|
*/
|
|
41
42
|
async function getWebConn(page) {
|
|
@@ -91,7 +92,7 @@ async function doTheThing(page, conn) {
|
|
|
91
92
|
}
|
|
92
93
|
await runCdpFile(path.join("db", `${page}.js`), conn);
|
|
93
94
|
|
|
94
|
-
const dirPath = path.join(process.cwd(), config.classMaps);
|
|
95
|
+
const dirPath = path.join(path.basename(process.cwd()), config.classMaps);
|
|
95
96
|
const filePath = path.join(dirPath, `${page}.json`);
|
|
96
97
|
|
|
97
98
|
const output = await runCdpFile("class_modules.js", conn);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import postcss from "postcss";
|
|
3
4
|
import { config } from "../src/api.js";
|
|
4
|
-
import { readFile
|
|
5
|
+
import { readFile } from "../src/shared.js";
|
|
5
6
|
|
|
6
7
|
const CLASS_MAP_FILE = path.join(config.classMaps, "client.json");
|
|
7
8
|
const OLD_CLASS_MAP_FILE = path.join(config.classMaps, "client_old.json");
|
|
@@ -18,6 +19,13 @@ if ([CLASS_MAP_FILE, OLD_CLASS_MAP_FILE].some((e) => !fs.existsSync(e))) {
|
|
|
18
19
|
process.exit(1);
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
const selectorReplacerPlugin = (opts) => (css) => {
|
|
23
|
+
css.walkRules((rule) => {
|
|
24
|
+
rule.selector = rule.selector.replace(opts.match, opts.replace);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
selectorReplacerPlugin.postcss = true;
|
|
28
|
+
|
|
21
29
|
const cwd = process.cwd();
|
|
22
30
|
const oldClasses = JSON.parse(fs.readFileSync(OLD_CLASS_MAP_FILE));
|
|
23
31
|
const newClasses = JSON.parse(fs.readFileSync(CLASS_MAP_FILE));
|
package/package.json
CHANGED
package/src/api.d.ts
CHANGED
package/src/postcss_plugin.js
CHANGED
package/src/shared.js
CHANGED
|
@@ -13,13 +13,6 @@ export const packagePath = path
|
|
|
13
13
|
|
|
14
14
|
export const readFile = (file) => fs.readFileSync(file).toString();
|
|
15
15
|
|
|
16
|
-
export const selectorReplacerPlugin = (opts) => (css) => {
|
|
17
|
-
css.walkRules((rule) => {
|
|
18
|
-
rule.selector = rule.selector.replace(opts.match, opts.replace);
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
selectorReplacerPlugin.postcss = true;
|
|
22
|
-
|
|
23
16
|
/**
|
|
24
17
|
* @typedef {object} SteamPage
|
|
25
18
|
*
|
|
@@ -31,6 +24,7 @@ selectorReplacerPlugin.postcss = true;
|
|
|
31
24
|
|
|
32
25
|
/**
|
|
33
26
|
* Gets a page URL for a given page name.
|
|
27
|
+
*
|
|
34
28
|
* @param {import("./api").Page} page
|
|
35
29
|
* @returns {Promise<SteamPage>}
|
|
36
30
|
*/
|
|
@@ -67,6 +61,7 @@ export async function getPageUrl(page) {
|
|
|
67
61
|
|
|
68
62
|
/**
|
|
69
63
|
* Creates a CDP connection for a given target.
|
|
64
|
+
*
|
|
70
65
|
* @param {(targets: cdp.Target[]) => cdp.Target} target
|
|
71
66
|
*/
|
|
72
67
|
export async function createConnection(target) {
|
|
@@ -90,6 +85,7 @@ export async function createConnection(target) {
|
|
|
90
85
|
|
|
91
86
|
/**
|
|
92
87
|
* Creates a CDP connection for a given page name.
|
|
88
|
+
*
|
|
93
89
|
* @param {import("./api").Page} page
|
|
94
90
|
*/
|
|
95
91
|
export async function createWebConnection(page) {
|