@nebulahome/package-sdk 1.2.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  The SDK's version is the version of the package API the platform implements: a minor version adds
4
4
  to it, a major one breaks it, and a patch leaves it as it is.
5
5
 
6
+ ## 1.3.0
7
+
8
+ - **The page's actions in its header.** `<PageActions>` from `@nebulahome/package-sdk/ui` draws
9
+ its children in the header of the package's page, beside the title, in place of the platform's
10
+ own "Details": the buttons a page would otherwise give a row of their own. On a card or an
11
+ entity view it draws nothing.
12
+ - **Changing the areas.** `useAreaActions()` adds a floor or a room to the house, renames one,
13
+ moves a floor to another storey or removes an area, with the viewer's permissions (`area:write`,
14
+ which `canEdit` says): a package that draws the house keeps its floors and rooms the house's own.
15
+
6
16
  ## 1.2.0
7
17
 
8
18
  - **The past of the house.** `ctx.history.states()` and `ctx.history.telemetry()` on the server
@@ -6850,7 +6850,7 @@ function composeFileProblems(text, settingKeys) {
6850
6850
  * the two are compared before a package is installed or started (PACKAGES_DOCS.md 11).
6851
6851
  */
6852
6852
  /** The SDK's own version, `1.0.0`. */
6853
- const SDK_VERSION = "1.2.0";
6853
+ const SDK_VERSION = "1.3.0";
6854
6854
  //#endregion
6855
6855
  //#region src/vite/catalogues.ts
6856
6856
  /**
@@ -7,6 +7,6 @@
7
7
  * the two are compared before a package is installed or started (PACKAGES_DOCS.md 11).
8
8
  */
9
9
  /** The SDK's own version, `1.0.0`. */
10
- const SDK_VERSION = "1.2.0";
10
+ const SDK_VERSION = "1.3.0";
11
11
  //#endregion
12
12
  export { SDK_VERSION as t };
package/dist/styles.css CHANGED
@@ -116,9 +116,12 @@
116
116
  /** Scenes, aliases and computed things; the If lane of an automation. */
117
117
  --color-violet: #a78bfa;
118
118
 
119
- /** Sensors, charts, live scanning; the When lane of an automation. */
119
+ /** Sensors, charts, live scanning; the When lane of an automation. Wi-Fi on a network map. */
120
120
  --color-cyan: #4fd0ee;
121
121
 
122
+ /** Thread, on a network map: its links, its routers. */
123
+ --color-thread: #e879f9;
124
+
122
125
  /* --- states ------------------------------------------------------------------------------ */
123
126
 
124
127
  --color-success: #52cd86;
@@ -258,6 +261,16 @@
258
261
  --text-headline--line-height: 1.25;
259
262
  --text-headline--letter-spacing: -0.02em;
260
263
 
264
+ /** A settings page's own title, beside its icon chip under the breadcrumb. */
265
+ --text-headline-lg: 24px;
266
+ --text-headline-lg--line-height: 1.2;
267
+ --text-headline-lg--letter-spacing: -0.02em;
268
+
269
+ /** The title of a section with its own column of pages, such as Settings. */
270
+ --text-display-sm: 28px;
271
+ --text-display-sm--line-height: 1.15;
272
+ --text-display-sm--letter-spacing: -0.03em;
273
+
261
274
  /** The page title, one per screen, with its meta beside it in `mono-ui`. */
262
275
  --text-display: 30px;
263
276
  --text-display--line-height: 1.15;
@@ -329,14 +342,15 @@
329
342
  /* --- depth -------------------------------------------------------------------------------- */
330
343
  /*
331
344
  * Flat. A panel has no resting shadow; an entity card has the faint lit top edge of `edge`. A
332
- * dialog and the sign-in card take `dialog`, a menu and a dragged card `float`, a focused
333
- * field `focus`.
345
+ * dialog and the sign-in card take `dialog`, a menu and a dragged card `float`, a popover
346
+ * (search results, the icon picker) `popover`, a focused field `focus`.
334
347
  */
335
348
 
336
349
  --shadow-edge: inset 0 1px 0 rgb(255 255 255 / 0.04);
337
350
  --shadow-focus: 0 0 0 3px rgb(124 134 255 / 0.25);
338
351
  --shadow-float: 0 24px 48px -12px rgb(0 0 0 / 0.7);
339
352
  --shadow-dialog: 0 30px 80px -20px rgb(0 0 0 / 0.9);
353
+ --shadow-popover: 0 28px 60px -20px rgb(0 0 0 / 0.95);
340
354
 
341
355
  /* --- motion ---------------------------------------------------------------------------- */
342
356
 
package/dist/ui.d.ts CHANGED
@@ -90,6 +90,27 @@ type AreaView = {
90
90
  readonly latitude: number | null;
91
91
  readonly longitude: number | null;
92
92
  };
93
+ /** A floor or a room to add to the house. Since 1.3. */
94
+ type AreaDraft = {
95
+ readonly kind: 'floor' | 'room';
96
+ readonly name: string;
97
+ /** The house a floor is in, the floor a room is on. */
98
+ readonly parentKey: string;
99
+ /** A floor's storey: 0 the ground floor, -1 the one below. */
100
+ readonly level?: number;
101
+ };
102
+ /** Changes to the house's areas, with the viewer's permissions. Since 1.3. */
103
+ type AreaActions = {
104
+ /** Whether the viewer may change the areas (`area:write`). */
105
+ readonly canEdit: boolean;
106
+ /** Adds a floor or a room; its key comes from its name. */
107
+ readonly create: (draft: AreaDraft) => Promise<AreaView>;
108
+ readonly rename: (key: string, name: string) => Promise<void>;
109
+ /** Moves a floor to another storey. */
110
+ readonly setLevel: (key: string, level: number) => Promise<void>;
111
+ /** Removes an area and everything under it. */
112
+ readonly remove: (key: string) => Promise<void>;
113
+ };
93
114
  /** How a picture is fetched. */
94
115
  type PictureOptions = {
95
116
  /** A camera's still is fetched again this often; 15 seconds when not said, at least 2. */
@@ -273,6 +294,10 @@ type PackageLinkProps = LinkAttributes & {
273
294
  type PlatformLinkProps = LinkAttributes & {
274
295
  readonly to: PlatformTarget;
275
296
  };
297
+ /** What the header of the package's page shows. Since 1.3. */
298
+ type PageActionsProps = {
299
+ readonly children?: ReactNode;
300
+ };
276
301
  /** What the interface lends to implement `/ui`. */
277
302
  type UiHost = {
278
303
  readonly usePackage: () => PackageInfo;
@@ -303,6 +328,10 @@ type UiHost = {
303
328
  readonly usePlatformNavigate: () => PlatformNavigate;
304
329
  readonly PackageLink: ComponentType<PackageLinkProps>;
305
330
  readonly PlatformLink: ComponentType<PlatformLinkProps>;
331
+ /** Since 1.3. */
332
+ readonly PageActions: ComponentType<PageActionsProps>;
333
+ /** Since 1.3. */
334
+ readonly useAreaActions: () => AreaActions;
306
335
  };
307
336
  //#endregion
308
337
  //#region src/ui/index.d.ts
@@ -418,6 +447,13 @@ export declare function useTelemetry(query: TelemetryQuery): Telemetry;
418
447
  * @returns Them, in the owner's order.
419
448
  */
420
449
  export declare function useAreas(): readonly AreaView[];
450
+ /**
451
+ * Adds, renames and removes the house's floors and rooms, as the platform's areas page does, with
452
+ * the viewer's permissions: `canEdit` says whether they hold them. Since 1.3.
453
+ *
454
+ * @returns What changes the areas.
455
+ */
456
+ export declare function useAreaActions(): AreaActions;
421
457
  /**
422
458
  * A camera's latest still, fetched again every so often, or an image entity's picture, fetched
423
459
  * again when it changes: an address an `<img>` shows, let go of when a newer one replaces it.
@@ -471,5 +507,13 @@ export declare function PackageLink(props: PackageLinkProps): ReactElement;
471
507
  * @returns The link.
472
508
  */
473
509
  export declare function PlatformLink(props: PlatformLinkProps): ReactElement;
510
+ /**
511
+ * Buttons and links drawn in the header of the package's page, in place of the platform's own:
512
+ * the page's actions, beside its title. On a card or a view it draws nothing. Since 1.3.
513
+ *
514
+ * @param props - What the header shows.
515
+ * @returns The actions.
516
+ */
517
+ export declare function PageActions(props: PageActionsProps): ReactElement;
474
518
  //#endregion
475
- export type { AreaKind, AreaView, CardProps, ChangeCause, CustomEntityState, EntitiesFilter, EntityPicture, EntityView, EntityViewProps, History, HistoryQuery, HistorySeries, HistoryWindow, Locale, Mutation, MutationOptions, PackageCall, PackageInfo, PackageLinkProps, PackageNavigate, PackageRoute, PackageSettings, PageProps, PictureOptions, PlatformLinkProps, PlatformNavigate, PlatformTarget, PluralEnglish, RpcOptions, RpcState, SendCommand, SettingsPatch, StateHistoryPoint, Telemetry, TelemetryPoint, TelemetryQuery, TelemetryResolution, Theme, Translate, Translation, TranslationValues, UiHost, Viewer, VisibleSettings };
519
+ export type { AreaActions, AreaDraft, AreaKind, AreaView, CardProps, ChangeCause, CustomEntityState, EntitiesFilter, EntityPicture, EntityView, EntityViewProps, History, HistoryQuery, HistorySeries, HistoryWindow, Locale, Mutation, MutationOptions, PackageCall, PackageInfo, PackageLinkProps, PackageNavigate, PackageRoute, PackageSettings, PageActionsProps, PageProps, PictureOptions, PlatformLinkProps, PlatformNavigate, PlatformTarget, PluralEnglish, RpcOptions, RpcState, SendCommand, SettingsPatch, StateHistoryPoint, Telemetry, TelemetryPoint, TelemetryQuery, TelemetryResolution, Theme, Translate, Translation, TranslationValues, UiHost, Viewer, VisibleSettings };
package/dist/ui.js CHANGED
@@ -203,6 +203,15 @@ function useAreas() {
203
203
  return ui("useAreas", "1.2")();
204
204
  }
205
205
  /**
206
+ * Adds, renames and removes the house's floors and rooms, as the platform's areas page does, with
207
+ * the viewer's permissions: `canEdit` says whether they hold them. Since 1.3.
208
+ *
209
+ * @returns What changes the areas.
210
+ */
211
+ function useAreaActions() {
212
+ return ui("useAreaActions", "1.3")();
213
+ }
214
+ /**
206
215
  * A camera's latest still, fetched again every so often, or an image entity's picture, fetched
207
216
  * again when it changes: an address an `<img>` shows, let go of when a newer one replaces it.
208
217
  *
@@ -271,5 +280,15 @@ function PackageLink(props) {
271
280
  function PlatformLink(props) {
272
281
  return createElement(ui("PlatformLink", "1.0"), props);
273
282
  }
283
+ /**
284
+ * Buttons and links drawn in the header of the package's page, in place of the platform's own:
285
+ * the page's actions, beside its title. On a card or a view it draws nothing. Since 1.3.
286
+ *
287
+ * @param props - What the header shows.
288
+ * @returns The actions.
289
+ */
290
+ function PageActions(props) {
291
+ return createElement(ui("PageActions", "1.3"), props);
292
+ }
274
293
  //#endregion
275
- export { PackageLink, PlatformLink, useAreas, useCommand, useCustomEntity, useEntities, useEntity, useEntityPicture, useLocale, usePackage, usePackageCall, usePackageMutation, usePackageNavigate, usePackageRoute, usePackageRpc, usePackageSettings, usePlatformNavigate, usePortalContainer, useStateHistory, useTelemetry, useTheme, useTranslation, useViewer };
294
+ export { PackageLink, PageActions, PlatformLink, useAreaActions, useAreas, useCommand, useCustomEntity, useEntities, useEntity, useEntityPicture, useLocale, usePackage, usePackageCall, usePackageMutation, usePackageNavigate, usePackageRoute, usePackageRpc, usePackageSettings, usePlatformNavigate, usePortalContainer, useStateHistory, useTelemetry, useTheme, useTranslation, useViewer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebulahome/package-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Write a NebulaHome package: declare it, build it, and run it on the platform.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -100,10 +100,10 @@
100
100
  "vitest": "^4.1.11",
101
101
  "yaml": "^2.9.0",
102
102
  "zod": "^4.5.4",
103
+ "@nebulahome/contracts": "0.0.0",
103
104
  "@nebulahome/eslint-config": "0.0.0",
104
- "@nebulahome/ui": "0.0.0",
105
105
  "@nebulahome/tsconfig": "0.0.0",
106
- "@nebulahome/contracts": "0.0.0"
106
+ "@nebulahome/ui": "0.0.0"
107
107
  },
108
108
  "scripts": {
109
109
  "build": "tsdown && node scripts/build-styles.js",