Skip to content

Commit 839ff5d

Browse files
committed
refactor: optimize bundle by only importing types from snjs
1 parent c56d2d8 commit 839ff5d

15 files changed

Lines changed: 108 additions & 207 deletions

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"trailingComma": "all",
4+
"printWidth": 120,
45
"semi": false
56
}

dist/@types/ComponentRelay.d.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { OutgoingItemMessagePayload, AppDataField, DecryptedTransferPayload, ItemContent, ComponentAction, ContentType } from '@standardnotes/snjs';
1+
import type { OutgoingItemMessagePayload, AppDataField, DecryptedTransferPayload, ItemContent, ContentType } from '@standardnotes/snjs';
22
import { ComponentRelayParams } from './Types/ComponentRelayParams';
3+
import { ComponentAction } from './Types/ComponentAction';
34
export default class ComponentRelay {
45
private contentWindow;
56
private component;
@@ -76,15 +77,6 @@ export default class ComponentRelay {
7677
* @param callback A callback to process the streamed item.
7778
*/
7879
streamContextItem(callback: (data: any) => void): void;
79-
/**
80-
* Selects a `Tag` item.
81-
* @param item The Item (`Tag` or `SmartTag`) to select.
82-
*/
83-
selectItem(item: DecryptedTransferPayload): void;
84-
/**
85-
* Clears current selected `Tag` (if any).
86-
*/
87-
clearSelection(): void;
8880
/**
8981
* Creates and stores an Item in the item store.
9082
* @param item The Item's payload content.
@@ -97,16 +89,6 @@ export default class ComponentRelay {
9789
* @param callback The callback to process the created Item(s).
9890
*/
9991
createItems(items: DecryptedTransferPayload[], callback: (data: any) => void): void;
100-
/**
101-
* Associates a `Tag` with the current Note.
102-
* @param item The `Tag` item to associate.
103-
*/
104-
associateItem(item: DecryptedTransferPayload): void;
105-
/**
106-
* Deassociates a `Tag` with the current Note.
107-
* @param item The `Tag` item to deassociate.
108-
*/
109-
deassociateItem(item: DecryptedTransferPayload): void;
11092
/**
11193
* Deletes an Item from the item store.
11294
* @param item The Item to delete.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export declare enum ComponentAction {
2+
SetSize = "set-size",
3+
StreamItems = "stream-items",
4+
StreamContextItem = "stream-context-item",
5+
SaveItems = "save-items",
6+
CreateItem = "create-item",
7+
CreateItems = "create-items",
8+
DeleteItems = "delete-items",
9+
SetComponentData = "set-component-data",
10+
RequestPermissions = "request-permissions",
11+
DuplicateItem = "duplicate-item",
12+
ComponentRegistered = "component-registered",
13+
ActivateThemes = "themes",
14+
Reply = "reply",
15+
ThemesActivated = "themes-activated",
16+
KeyDown = "key-down",
17+
KeyUp = "key-up",
18+
Click = "click"
19+
}

dist/@types/Types/Environment.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export declare enum Environment {
2+
Web = 1,
3+
Desktop = 2,
4+
Mobile = 3
5+
}

dist/@types/Types/MessagePayload.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MessageData, UuidString, ComponentAction } from '@standardnotes/snjs';
1+
import type { MessageData, UuidString, ComponentAction } from '@standardnotes/snjs';
22
import { MessagePayloadApi } from './MessagePayloadApi';
33
import { ComponentData } from './ComponentData';
44
export declare type MessagePayload = {

dist/@types/Utils.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Environment } from '@standardnotes/snjs';
1+
import { Environment } from './Types/Environment';
22
declare global {
33
interface Window {
44
msCrypto: unknown;

dist/dist.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dist.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)