@croffledev/croffle-types 2.0.1 → 2.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/README.md +10 -8
- package/models/schedule.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
# Croffle Types
|
|
7
7
|
|
|
8
|
-
> Official TypeScript definitions for
|
|
8
|
+
> Official TypeScript definitions for Croffle extension development
|
|
9
9
|
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
|
-
**@croffledev/croffle-types** provides the
|
|
12
|
+
**@croffledev/croffle-types** provides the type definitions and interfaces for building [Croffle](https://github.com/team-croffle/croffle) extensions.
|
|
13
13
|
|
|
14
|
-
By using this package, developers can ensure type safety and leverage IntelliSense when interacting with the Croffle
|
|
14
|
+
By using this package, developers can ensure type safety and leverage IntelliSense when interacting with the Croffle host API, events, and the extension lifecycle.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
## 📦 Installation
|
|
19
19
|
|
|
20
|
-
This package should be installed as a **development dependency** in your
|
|
20
|
+
This package should be installed as a **development dependency** in your extension project.
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
# Using npm
|
|
@@ -93,6 +93,8 @@ Items appear only after `onContextMenu` attaches an action. `onContextMenu(id, h
|
|
|
93
93
|
| `storage`, `session`, `configuration` | Context only; already bound to your extension id |
|
|
94
94
|
| `ui` | Context only; `registerView`, `registerConfigurationTab`, `onContextMenu`, `registerContextMenu` |
|
|
95
95
|
|
|
96
|
+
**To-Dos.** A `Schedule` with `kind: 'todo'` is a To-Do (desktop 1.3.3): its `endDate` is the deadline and its `startDate` equals it, it has no `recurrenceRule`, and `completedAt` is when it was done (`null` or missing = not done). `kind` missing means `'event'`, which never has `completedAt`. Both fields are optional, so schedules from older hosts read as events.
|
|
97
|
+
|
|
96
98
|
**Events.** `context.event.emit('ping')` is delivered as `<extensionId>:ping`; a name that already starts with your id is sent as is. Core events (`AppEventType`) and other extensions' prefixes cannot be emitted — they are dropped with a console warning. `on(name)` subscribes to anything, core events included.
|
|
97
99
|
|
|
98
100
|
### Migrating from 1.x to 2.0
|
|
@@ -128,10 +130,10 @@ Event names also changed: an `emit('x')` from an extension now reaches subscribe
|
|
|
128
130
|
|
|
129
131
|
If you want to contribute to the type definitions or add support for new Core APIs:
|
|
130
132
|
|
|
131
|
-
1. Fork the [Croffle
|
|
132
|
-
2.
|
|
133
|
-
3.
|
|
134
|
-
4.
|
|
133
|
+
1. Fork the [Croffle repository](https://github.com/team-croffle/croffle); the types live in `packages/types`.
|
|
134
|
+
2. Add or change the declarations under `api/` (host API) or `models/` (data shapes), and export them from `index.d.ts`.
|
|
135
|
+
3. Add a Changeset (`pnpm changeset`).
|
|
136
|
+
4. Open a pull request — see [CONTRIBUTING.md](https://github.com/team-croffle/croffle/blob/master/CONTRIBUTING.md).
|
|
135
137
|
|
|
136
138
|
---
|
|
137
139
|
|
package/models/schedule.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ export type Schedule = {
|
|
|
40
40
|
* `occurrenceStart`, and add `startDate`..`endDate` unless `cancelled`.
|
|
41
41
|
*/
|
|
42
42
|
exceptions?: ScheduleException[];
|
|
43
|
+
/**
|
|
44
|
+
* `'todo'` = a To-Do (1.3.3): `endDate` is the deadline and `startDate` equals it; a To-Do does
|
|
45
|
+
* not repeat. Missing = `'event'`.
|
|
46
|
+
*/
|
|
47
|
+
kind?: 'event' | 'todo';
|
|
48
|
+
/** When a To-Do was done; `null` or missing = not done. Always empty for an event. */
|
|
49
|
+
completedAt?: Date | null;
|
|
43
50
|
createdAt: Date;
|
|
44
51
|
updatedAt: Date;
|
|
45
52
|
};
|