@powerhousedao/common 3.2.0-dev.2 → 3.2.0-dev.4
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/dist/drive-analytics/index.d.ts +3 -0
- package/dist/drive-analytics/index.d.ts.map +1 -0
- package/dist/drive-analytics/index.js +3 -0
- package/dist/drive-analytics/index.js.map +1 -0
- package/dist/drive-analytics/processor/index.d.ts +7 -0
- package/dist/drive-analytics/processor/index.d.ts.map +1 -0
- package/dist/drive-analytics/processor/index.js +16 -0
- package/dist/drive-analytics/processor/index.js.map +1 -0
- package/dist/drive-analytics/processor/processor.d.ts +16 -0
- package/dist/drive-analytics/processor/processor.d.ts.map +1 -0
- package/dist/drive-analytics/processor/processor.js +106 -0
- package/dist/drive-analytics/processor/processor.js.map +1 -0
- package/dist/drive-analytics/useDriveAnalytics.d.ts +21 -0
- package/dist/drive-analytics/useDriveAnalytics.d.ts.map +1 -0
- package/dist/drive-analytics/useDriveAnalytics.js +34 -0
- package/dist/drive-analytics/useDriveAnalytics.js.map +1 -0
- package/dist/editors/styles.css +69 -66
- package/dist/package.json +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../drive-analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../drive-analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IAnalyticsStore } from "@powerhousedao/reactor-browser/analytics";
|
|
2
|
+
import { type ProcessorRecord } from "document-drive/processors/types";
|
|
3
|
+
export declare const processorFactory: (module: {
|
|
4
|
+
analyticsStore: IAnalyticsStore;
|
|
5
|
+
}) => (driveId: string) => ProcessorRecord[];
|
|
6
|
+
export * from "./processor.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../drive-analytics/processor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIvE,eAAO,MAAM,gBAAgB,GAC1B,QAAQ;IAAE,cAAc,EAAE,eAAe,CAAA;CAAE,MAC3C,SAAS,MAAM,KAAG,eAAe,EAYjC,CAAC;AAEJ,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DriveAnalyticsProcessor } from "./processor.js";
|
|
2
|
+
export const processorFactory = (module) => (driveId) => {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
processor: new DriveAnalyticsProcessor(module.analyticsStore),
|
|
6
|
+
filter: {
|
|
7
|
+
branch: ["main"],
|
|
8
|
+
documentId: ["*"],
|
|
9
|
+
scope: ["*"],
|
|
10
|
+
documentType: ["powerhouse/document-drive"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
};
|
|
15
|
+
export * from "./processor.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../drive-analytics/processor/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAAC,MAA2C,EAAE,EAAE,CAChD,CAAC,OAAe,EAAqB,EAAE;IACrC,OAAO;QACL;YACE,SAAS,EAAE,IAAI,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC;YAC7D,MAAM,EAAE;gBACN,MAAM,EAAE,CAAC,MAAM,CAAC;gBAChB,UAAU,EAAE,CAAC,GAAG,CAAC;gBACjB,KAAK,EAAE,CAAC,GAAG,CAAC;gBACZ,YAAY,EAAE,CAAC,2BAA2B,CAAC;aAC5C;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IAnalyticsStore } from "@powerhousedao/reactor-browser/analytics";
|
|
2
|
+
import { type IProcessor } from "document-drive/processors/types";
|
|
3
|
+
import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
|
|
4
|
+
import type { PHDocument } from "document-model";
|
|
5
|
+
export type Target = "DRIVE" | "NODE";
|
|
6
|
+
export type ActionType = "CREATED" | "DUPLICATED" | "REMOVED" | "MOVED" | "UPDATED";
|
|
7
|
+
export declare class DriveAnalyticsProcessor implements IProcessor {
|
|
8
|
+
private readonly analyticsStore;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(analyticsStore: IAnalyticsStore, logger?: import("document-drive").ILogger);
|
|
11
|
+
onStrands<TDocument extends PHDocument>(strands: InternalTransmitterUpdate<TDocument>[]): Promise<void>;
|
|
12
|
+
onDisconnect(): Promise<void>;
|
|
13
|
+
private getActionType;
|
|
14
|
+
private clearSource;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../drive-analytics/processor/processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AACrG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAgBjD,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,YAAY,GACZ,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAGd,qBAAa,uBAAwB,YAAW,UAAU;IAEtD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,eAAe,EAC/B,MAAM,mCAAgD;IAKnE,SAAS,CAAC,SAAS,SAAS,UAAU,EAC1C,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAAE,GAC9C,OAAO,CAAC,IAAI,CAAC;IAgFV,YAAY;IAElB,OAAO,CAAC,aAAa;YAgBP,WAAW;CAO1B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AnalyticsPath, DateTime, } from "@powerhousedao/reactor-browser/analytics";
|
|
2
|
+
import { childLogger } from "document-drive";
|
|
3
|
+
const CREATE_NODE_ACTIONS = ["ADD_FILE", "ADD_FOLDER"];
|
|
4
|
+
const DUPLICATE_NODE_ACTIONS = ["COPY_NODE"];
|
|
5
|
+
const UPDATE_NODE_ACTIONS = ["UPDATE_FILE", "UPDATE_NODE"];
|
|
6
|
+
const MOVE_NODE_ACTIONS = ["MOVE_NODE"];
|
|
7
|
+
const REMOVE_NODE_ACTIONS = ["DELETE_NODE"];
|
|
8
|
+
const NODE_ACTIONS = [
|
|
9
|
+
...CREATE_NODE_ACTIONS,
|
|
10
|
+
...DUPLICATE_NODE_ACTIONS,
|
|
11
|
+
...UPDATE_NODE_ACTIONS,
|
|
12
|
+
...MOVE_NODE_ACTIONS,
|
|
13
|
+
...REMOVE_NODE_ACTIONS,
|
|
14
|
+
];
|
|
15
|
+
export class DriveAnalyticsProcessor {
|
|
16
|
+
analyticsStore;
|
|
17
|
+
logger;
|
|
18
|
+
constructor(analyticsStore, logger = childLogger(["processor", "drive-analytics"])) {
|
|
19
|
+
this.analyticsStore = analyticsStore;
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
//
|
|
22
|
+
}
|
|
23
|
+
async onStrands(strands) {
|
|
24
|
+
if (strands.length === 0) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const strand of strands) {
|
|
28
|
+
// skip empty strands
|
|
29
|
+
if (strand.operations.length === 0) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const firstOp = strand.operations[0];
|
|
33
|
+
const source = AnalyticsPath.fromString(`ph/drive/${strand.documentId}/${strand.branch}/${strand.scope}`);
|
|
34
|
+
if (firstOp.index === 0) {
|
|
35
|
+
await this.clearSource(source);
|
|
36
|
+
}
|
|
37
|
+
const { documentId: driveId, branch, scope } = strand;
|
|
38
|
+
const CHUNK_SIZE = 50;
|
|
39
|
+
for (let i = 0; i < strand.operations.length; i += CHUNK_SIZE) {
|
|
40
|
+
const chunk = strand.operations.slice(i, i + CHUNK_SIZE);
|
|
41
|
+
const buffer = [];
|
|
42
|
+
for (const operation of chunk) {
|
|
43
|
+
const revision = operation.index;
|
|
44
|
+
const actionType = this.getActionType(operation.type);
|
|
45
|
+
const target = NODE_ACTIONS.includes(operation.type)
|
|
46
|
+
? "NODE"
|
|
47
|
+
: "DRIVE";
|
|
48
|
+
let targetId = driveId;
|
|
49
|
+
if (target === "NODE") {
|
|
50
|
+
const operationInput = operation.input;
|
|
51
|
+
targetId =
|
|
52
|
+
operationInput.id ||
|
|
53
|
+
operationInput.targetId ||
|
|
54
|
+
operationInput.srcFolder ||
|
|
55
|
+
driveId;
|
|
56
|
+
}
|
|
57
|
+
const seriesInput = {
|
|
58
|
+
source,
|
|
59
|
+
metric: "DriveOperations",
|
|
60
|
+
start: DateTime.fromISO(operation.timestamp),
|
|
61
|
+
value: 1,
|
|
62
|
+
dimensions: {
|
|
63
|
+
drive: AnalyticsPath.fromString(`drive/${driveId}/${branch}/${scope}/${revision}`),
|
|
64
|
+
operation: AnalyticsPath.fromString(`operation/${operation.type}/${operation.index}`),
|
|
65
|
+
target: AnalyticsPath.fromString(`target/${target}/${targetId}`),
|
|
66
|
+
actionType: AnalyticsPath.fromString(`actionType/${actionType}/${targetId}`),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
buffer.push(seriesInput);
|
|
70
|
+
while (buffer.length >= CHUNK_SIZE) {
|
|
71
|
+
const batch = buffer.splice(0, CHUNK_SIZE);
|
|
72
|
+
await this.analyticsStore.addSeriesValues(batch);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (buffer.length > 0) {
|
|
76
|
+
await this.analyticsStore.addSeriesValues(buffer);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async onDisconnect() { }
|
|
82
|
+
getActionType(action) {
|
|
83
|
+
if (CREATE_NODE_ACTIONS.includes(action)) {
|
|
84
|
+
return "CREATED";
|
|
85
|
+
}
|
|
86
|
+
if (DUPLICATE_NODE_ACTIONS.includes(action)) {
|
|
87
|
+
return "DUPLICATED";
|
|
88
|
+
}
|
|
89
|
+
if (REMOVE_NODE_ACTIONS.includes(action)) {
|
|
90
|
+
return "REMOVED";
|
|
91
|
+
}
|
|
92
|
+
if (MOVE_NODE_ACTIONS.includes(action)) {
|
|
93
|
+
return "MOVED";
|
|
94
|
+
}
|
|
95
|
+
return "UPDATED";
|
|
96
|
+
}
|
|
97
|
+
async clearSource(source) {
|
|
98
|
+
try {
|
|
99
|
+
await this.analyticsStore.clearSeriesBySource(source, true);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
this.logger.error("Failed to clear source", e);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor.js","sourceRoot":"","sources":["../../../drive-analytics/processor/processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa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C;YACvC,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,MAAqB;QAC7C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnalyticsGranularity } from "@powerhousedao/reactor-browser/analytics";
|
|
2
|
+
import { type ActionType, type Target } from "./processor/index.js";
|
|
3
|
+
export type UseDriveAnalyticsOptions = {
|
|
4
|
+
from?: string;
|
|
5
|
+
to?: string;
|
|
6
|
+
granularity?: AnalyticsGranularity;
|
|
7
|
+
levelOfDetail?: {
|
|
8
|
+
drive?: number;
|
|
9
|
+
operation?: number;
|
|
10
|
+
target?: number;
|
|
11
|
+
actionType?: number;
|
|
12
|
+
};
|
|
13
|
+
filters?: {
|
|
14
|
+
driveId?: string[];
|
|
15
|
+
operation?: string[];
|
|
16
|
+
target?: Target[];
|
|
17
|
+
actionType?: ActionType[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const useDriveAnalytics: (options: UseDriveAnalyticsOptions) => import("@powerhousedao/reactor-browser/analytics").UseAnalyticsQueryResult<import("@powerhousedao/reactor-browser/analytics").GroupedPeriodResults>;
|
|
21
|
+
//# sourceMappingURL=useDriveAnalytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDriveAnalytics.d.ts","sourceRoot":"","sources":["../../drive-analytics/useDriveAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAKrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,aAAa,CAAC,EAAE;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;KAC3B,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,wBAAwB,wJAkDlE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AnalyticsGranularity, AnalyticsPath, DateTime, useAnalyticsQuery, } from "@powerhousedao/reactor-browser/analytics";
|
|
2
|
+
export const useDriveAnalytics = (options) => {
|
|
3
|
+
const start = options.from
|
|
4
|
+
? DateTime.fromISO(options.from)
|
|
5
|
+
: DateTime.now().startOf("day");
|
|
6
|
+
const end = options.to
|
|
7
|
+
? DateTime.fromISO(options.to)
|
|
8
|
+
: DateTime.now().endOf("day");
|
|
9
|
+
const granularity = options.granularity ?? AnalyticsGranularity.Daily;
|
|
10
|
+
const lod = options.levelOfDetail ?? {
|
|
11
|
+
drive: 1,
|
|
12
|
+
};
|
|
13
|
+
const selectDrives = options.filters?.driveId?.map((driveId) => AnalyticsPath.fromString(`drive/${driveId}`));
|
|
14
|
+
const operations = options.filters?.operation?.map((operation) => AnalyticsPath.fromString(`operation/${operation}`));
|
|
15
|
+
const targets = options.filters?.target?.map((target) => AnalyticsPath.fromString(`target/${target}`));
|
|
16
|
+
const actionTypes = options.filters?.actionType?.map((actionType) => AnalyticsPath.fromString(`actionType/${actionType}`));
|
|
17
|
+
const select = {
|
|
18
|
+
drive: selectDrives ?? [AnalyticsPath.fromString("drive")],
|
|
19
|
+
...(operations && { operation: operations }),
|
|
20
|
+
...(targets && { target: targets }),
|
|
21
|
+
...(actionTypes && { actionType: actionTypes }),
|
|
22
|
+
};
|
|
23
|
+
const config = {
|
|
24
|
+
start,
|
|
25
|
+
end,
|
|
26
|
+
metrics: ["DriveOperations"],
|
|
27
|
+
granularity,
|
|
28
|
+
lod,
|
|
29
|
+
select,
|
|
30
|
+
};
|
|
31
|
+
const result = useAnalyticsQuery(config);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=useDriveAnalytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDriveAnalytics.js","sourceRoot":"","sources":["../../drive-analytics/useDriveAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,aAAa,EAEb,QAAQ,EACR,iBAAiB,GAClB,MAAM,0CAA0C,CAAC;AAqBlD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAiC,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI;QACxB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE;QACpB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEhC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IA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,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/editors/styles.css
CHANGED
|
@@ -393,6 +393,9 @@
|
|
|
393
393
|
.text-gray-600 {
|
|
394
394
|
color: var(--color-gray-600);
|
|
395
395
|
}
|
|
396
|
+
.filter {
|
|
397
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
398
|
+
}
|
|
396
399
|
}
|
|
397
400
|
/*! tailwindcss v4.1.7 | MIT License | https://tailwindcss.com */
|
|
398
401
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
@@ -4777,59 +4780,6 @@ input[type="number"] {
|
|
|
4777
4780
|
inherits: false;
|
|
4778
4781
|
initial-value: solid;
|
|
4779
4782
|
}
|
|
4780
|
-
@property --tw-blur {
|
|
4781
|
-
syntax: "*";
|
|
4782
|
-
inherits: false;
|
|
4783
|
-
}
|
|
4784
|
-
@property --tw-brightness {
|
|
4785
|
-
syntax: "*";
|
|
4786
|
-
inherits: false;
|
|
4787
|
-
}
|
|
4788
|
-
@property --tw-contrast {
|
|
4789
|
-
syntax: "*";
|
|
4790
|
-
inherits: false;
|
|
4791
|
-
}
|
|
4792
|
-
@property --tw-grayscale {
|
|
4793
|
-
syntax: "*";
|
|
4794
|
-
inherits: false;
|
|
4795
|
-
}
|
|
4796
|
-
@property --tw-hue-rotate {
|
|
4797
|
-
syntax: "*";
|
|
4798
|
-
inherits: false;
|
|
4799
|
-
}
|
|
4800
|
-
@property --tw-invert {
|
|
4801
|
-
syntax: "*";
|
|
4802
|
-
inherits: false;
|
|
4803
|
-
}
|
|
4804
|
-
@property --tw-opacity {
|
|
4805
|
-
syntax: "*";
|
|
4806
|
-
inherits: false;
|
|
4807
|
-
}
|
|
4808
|
-
@property --tw-saturate {
|
|
4809
|
-
syntax: "*";
|
|
4810
|
-
inherits: false;
|
|
4811
|
-
}
|
|
4812
|
-
@property --tw-sepia {
|
|
4813
|
-
syntax: "*";
|
|
4814
|
-
inherits: false;
|
|
4815
|
-
}
|
|
4816
|
-
@property --tw-drop-shadow {
|
|
4817
|
-
syntax: "*";
|
|
4818
|
-
inherits: false;
|
|
4819
|
-
}
|
|
4820
|
-
@property --tw-drop-shadow-color {
|
|
4821
|
-
syntax: "*";
|
|
4822
|
-
inherits: false;
|
|
4823
|
-
}
|
|
4824
|
-
@property --tw-drop-shadow-alpha {
|
|
4825
|
-
syntax: "<percentage>";
|
|
4826
|
-
inherits: false;
|
|
4827
|
-
initial-value: 100%;
|
|
4828
|
-
}
|
|
4829
|
-
@property --tw-drop-shadow-size {
|
|
4830
|
-
syntax: "*";
|
|
4831
|
-
inherits: false;
|
|
4832
|
-
}
|
|
4833
4783
|
@property --tw-duration {
|
|
4834
4784
|
syntax: "*";
|
|
4835
4785
|
inherits: false;
|
|
@@ -5000,6 +4950,59 @@ input[type="number"] {
|
|
|
5000
4950
|
syntax: "*";
|
|
5001
4951
|
inherits: false;
|
|
5002
4952
|
}
|
|
4953
|
+
@property --tw-blur {
|
|
4954
|
+
syntax: "*";
|
|
4955
|
+
inherits: false;
|
|
4956
|
+
}
|
|
4957
|
+
@property --tw-brightness {
|
|
4958
|
+
syntax: "*";
|
|
4959
|
+
inherits: false;
|
|
4960
|
+
}
|
|
4961
|
+
@property --tw-contrast {
|
|
4962
|
+
syntax: "*";
|
|
4963
|
+
inherits: false;
|
|
4964
|
+
}
|
|
4965
|
+
@property --tw-grayscale {
|
|
4966
|
+
syntax: "*";
|
|
4967
|
+
inherits: false;
|
|
4968
|
+
}
|
|
4969
|
+
@property --tw-hue-rotate {
|
|
4970
|
+
syntax: "*";
|
|
4971
|
+
inherits: false;
|
|
4972
|
+
}
|
|
4973
|
+
@property --tw-invert {
|
|
4974
|
+
syntax: "*";
|
|
4975
|
+
inherits: false;
|
|
4976
|
+
}
|
|
4977
|
+
@property --tw-opacity {
|
|
4978
|
+
syntax: "*";
|
|
4979
|
+
inherits: false;
|
|
4980
|
+
}
|
|
4981
|
+
@property --tw-saturate {
|
|
4982
|
+
syntax: "*";
|
|
4983
|
+
inherits: false;
|
|
4984
|
+
}
|
|
4985
|
+
@property --tw-sepia {
|
|
4986
|
+
syntax: "*";
|
|
4987
|
+
inherits: false;
|
|
4988
|
+
}
|
|
4989
|
+
@property --tw-drop-shadow {
|
|
4990
|
+
syntax: "*";
|
|
4991
|
+
inherits: false;
|
|
4992
|
+
}
|
|
4993
|
+
@property --tw-drop-shadow-color {
|
|
4994
|
+
syntax: "*";
|
|
4995
|
+
inherits: false;
|
|
4996
|
+
}
|
|
4997
|
+
@property --tw-drop-shadow-alpha {
|
|
4998
|
+
syntax: "<percentage>";
|
|
4999
|
+
inherits: false;
|
|
5000
|
+
initial-value: 100%;
|
|
5001
|
+
}
|
|
5002
|
+
@property --tw-drop-shadow-size {
|
|
5003
|
+
syntax: "*";
|
|
5004
|
+
inherits: false;
|
|
5005
|
+
}
|
|
5003
5006
|
@keyframes spin {
|
|
5004
5007
|
to {
|
|
5005
5008
|
transform: rotate(360deg);
|
|
@@ -5020,6 +5023,19 @@ input[type="number"] {
|
|
|
5020
5023
|
--tw-skew-y: initial;
|
|
5021
5024
|
--tw-border-style: solid;
|
|
5022
5025
|
--tw-font-weight: initial;
|
|
5026
|
+
--tw-blur: initial;
|
|
5027
|
+
--tw-brightness: initial;
|
|
5028
|
+
--tw-contrast: initial;
|
|
5029
|
+
--tw-grayscale: initial;
|
|
5030
|
+
--tw-hue-rotate: initial;
|
|
5031
|
+
--tw-invert: initial;
|
|
5032
|
+
--tw-opacity: initial;
|
|
5033
|
+
--tw-saturate: initial;
|
|
5034
|
+
--tw-sepia: initial;
|
|
5035
|
+
--tw-drop-shadow: initial;
|
|
5036
|
+
--tw-drop-shadow-color: initial;
|
|
5037
|
+
--tw-drop-shadow-alpha: 100%;
|
|
5038
|
+
--tw-drop-shadow-size: initial;
|
|
5023
5039
|
--tw-translate-x: 0;
|
|
5024
5040
|
--tw-translate-y: 0;
|
|
5025
5041
|
--tw-translate-z: 0;
|
|
@@ -5045,19 +5061,6 @@ input[type="number"] {
|
|
|
5045
5061
|
--tw-ring-offset-color: #fff;
|
|
5046
5062
|
--tw-ring-offset-shadow: 0 0 #0000;
|
|
5047
5063
|
--tw-outline-style: solid;
|
|
5048
|
-
--tw-blur: initial;
|
|
5049
|
-
--tw-brightness: initial;
|
|
5050
|
-
--tw-contrast: initial;
|
|
5051
|
-
--tw-grayscale: initial;
|
|
5052
|
-
--tw-hue-rotate: initial;
|
|
5053
|
-
--tw-invert: initial;
|
|
5054
|
-
--tw-opacity: initial;
|
|
5055
|
-
--tw-saturate: initial;
|
|
5056
|
-
--tw-sepia: initial;
|
|
5057
|
-
--tw-drop-shadow: initial;
|
|
5058
|
-
--tw-drop-shadow-color: initial;
|
|
5059
|
-
--tw-drop-shadow-alpha: 100%;
|
|
5060
|
-
--tw-drop-shadow-size: initial;
|
|
5061
5064
|
--tw-duration: initial;
|
|
5062
5065
|
--tw-ease: initial;
|
|
5063
5066
|
--tw-content: "";
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/common",
|
|
3
|
-
"version": "3.2.0-dev.
|
|
3
|
+
"version": "3.2.0-dev.4",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./dist/index.js",
|
|
15
|
-
"./*": "./dist/*.js"
|
|
15
|
+
"./*": "./dist/*.js",
|
|
16
|
+
"./drive-analytics": "./dist/drive-analytics/index.js"
|
|
16
17
|
},
|
|
17
18
|
"types": "./dist/index.d.ts",
|
|
18
19
|
"imports": {
|