Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/snjs/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,4 @@ export { SNLog } from './log';
export { Permission } from '@standardnotes/auth';

export type { ItemMessagePayload } from './services/component_manager';
export type { MessageData } from './services/component_manager';
3 changes: 2 additions & 1 deletion packages/snjs/lib/models/app/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export enum ComponentAction {
Reply = 'reply',
SaveSuccess = 'save-success',
SaveError = 'save-error',
ThemesActivated = 'themes-activated'
ThemesActivated = 'themes-activated',
KeyPressed = 'key-pressed'
}

export type ComponentPermission = {
Expand Down
44 changes: 30 additions & 14 deletions packages/snjs/lib/services/component_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,36 @@ export type PermissionDialog = {
callback: (approved: boolean) => void;
};

type MessageData = Partial<{
content_types: ContentType[];
item: RawPayload & { clientData: any };
items: (RawPayload & { clientData: any })[];
permissions: ComponentPermission[];
componentData: any;
uuid: UuidString;
environment: string;
platform: string;
activeThemeUrls: string[];
width: string | number;
height: string | number;
/** Related to setSize action */
type: 'container';
enum KeyboardModifier {
Shift = 'Shift',
Ctrl = 'Control',
Meta = 'Meta'
}

export type MessageData = Partial<{
/** Related to the stream-item-context action */
item?: ItemMessagePayload
/** Related to the stream-items action */
content_types?: ContentType[]
items?: ItemMessagePayload[]
/** Related to the request-permission action */
permissions?: ComponentPermission[]
/** Related to the component-registered action */
componentData?: any
uuid?: UuidString
environment?: string
platform?: string
activeThemeUrls?: string[]
/** Related to set-size action */
width?: string | number
height?: string | number
type?: string
/** Related to themes action */
themes?: string[]
/** Related to clear-selection action */
content_type?: ContentType
/** Related to key-pressed action */
keyboardModifier?: KeyboardModifier
}>;

type ComponentMessage = {
Expand Down
1 change: 1 addition & 0 deletions packages/snjs/lib/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ export {
StoragePersistencePolicies,
} from '@Services/storage_service';
export type { ItemMessagePayload } from '@Services/component_manager';
export type { MessageData } from '@Services/component_manager';
2 changes: 1 addition & 1 deletion packages/snjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/snjs",
"version": "2.2.2",
"version": "2.2.3",
"engines": {
"node": ">=14.0.0 <16.0.0"
},
Expand Down