@colixsystems/widget-sdk 0.215.0 → 0.218.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 -1
- package/dist/host.d.ts +19 -0
- package/dist/host.js +2 -0
- package/dist/navigation.cjs +28 -1
- package/dist/navigation.js +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,16 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
83
83
|
|
|
84
84
|
## Status
|
|
85
85
|
|
|
86
|
-
`v0.
|
|
86
|
+
`v0.218.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
87
|
+
|
|
88
|
+
### What's new in 0.218.0
|
|
89
|
+
|
|
90
|
+
**Host helpers for the app logo's dark-bar variant.** An app can now carry a second logo for dark navigation bars, stored beside the app logo as `themeConfig.appLogoDarkAssetId` / `appLogoDarkUrl`. Two helpers on `@colixsystems/widget-sdk/host` decide which one a bar draws, and both hosts ask them, so the rail, the drawer, the app header and the site header pick the same logo in the web Player and in the exported app:
|
|
91
|
+
|
|
92
|
+
- `isDarkSurface({ surface, backdrop, textColor, theme })` — `true` when the bar reads as dark. Pass the colour the bar paints as `surface`; a see-through `#RRGGBBAA` is composited over `backdrop`, or over the page in `theme`, first. A bar that paints nothing passes the `textColor` authored to sit on it instead: light text names a dark backdrop.
|
|
93
|
+
- `resolveAppLogo(logo, darkSurfaceLogo, onDark)` — the logo to draw. The variant is used only beside an app logo; it never stands in for a missing one.
|
|
94
|
+
|
|
95
|
+
These are host-integration helpers, not something a widget imports. Nothing changes for widget authors.
|
|
87
96
|
|
|
88
97
|
### What's new in 0.215.0 (contract 1.174.0)
|
|
89
98
|
|
package/dist/host.d.ts
CHANGED
|
@@ -397,6 +397,25 @@ export interface TopBarTokens {
|
|
|
397
397
|
*/
|
|
398
398
|
export function resolveTopBarTokens(theme: unknown): TopBarTokens;
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Whether a chrome surface reads as dark. Pass the colour the bar paints
|
|
402
|
+
* (`#RRGGBBAA` is composited over `backdrop`, else over the page in `theme`),
|
|
403
|
+
* or, for a bar that paints nothing, the colour of the text authored to sit on it.
|
|
404
|
+
*/
|
|
405
|
+
export function isDarkSurface(input?: {
|
|
406
|
+
surface?: string | null;
|
|
407
|
+
backdrop?: string | null;
|
|
408
|
+
textColor?: string | null;
|
|
409
|
+
theme?: unknown;
|
|
410
|
+
} | null): boolean;
|
|
411
|
+
|
|
412
|
+
/** The logo a surface draws: the dark-surface variant only beside an app logo. */
|
|
413
|
+
export function resolveAppLogo<T>(
|
|
414
|
+
logo: T | null | undefined,
|
|
415
|
+
darkSurfaceLogo: T | null | undefined,
|
|
416
|
+
onDark: boolean,
|
|
417
|
+
): T | null;
|
|
418
|
+
|
|
400
419
|
/** sc-8023 — the arrangeable contents of the sidebar layout's TOP STRIPE: the
|
|
401
420
|
* row across the top of the content, outside the panel and above it. */
|
|
402
421
|
export type TopStripeSlot = "back" | "menu" | "brand" | "notifications";
|
package/dist/host.js
CHANGED
package/dist/navigation.cjs
CHANGED
|
@@ -535,6 +535,33 @@ function resolveTopStripeLayout(theme) {
|
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
// Whether a chrome surface reads as dark — asked for the app logo's variant
|
|
539
|
+
// and for the status-bar glyphs, so the two can never disagree about a bar.
|
|
540
|
+
// A see-through `surface` is judged by its blend with what is behind it: the
|
|
541
|
+
// given `backdrop`, else the page in `theme`. A bar that paints nothing passes
|
|
542
|
+
// `textColor` instead: light text was authored for a dark backdrop.
|
|
543
|
+
function isDarkSurface(input) {
|
|
544
|
+
const { surface, backdrop, textColor, theme } = isPlainObject(input) ? input : {};
|
|
545
|
+
if (isHexColor(surface)) {
|
|
546
|
+
const alpha = surface.length === 9 ? parseInt(surface.slice(7), 16) / 255 : 1;
|
|
547
|
+
const behind = isHexColor(backdrop)
|
|
548
|
+
? backdrop
|
|
549
|
+
: chromeSurface(isPlainObject(theme) ? theme : {});
|
|
550
|
+
const seen = alpha < 1 ? mixHex(behind, surface.slice(0, 7), alpha) : surface;
|
|
551
|
+
return readableTextColor(seen, "dark", "light") === "light";
|
|
552
|
+
}
|
|
553
|
+
if (isHexColor(textColor)) {
|
|
554
|
+
return readableTextColor(textColor, "dark", "light") === "dark";
|
|
555
|
+
}
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// The dark-surface logo is a VARIANT of the app logo: it never stands alone.
|
|
560
|
+
function resolveAppLogo(logo, darkSurfaceLogo, onDark) {
|
|
561
|
+
if (!logo) return null;
|
|
562
|
+
return onDark && darkSurfaceLogo ? darkSurfaceLogo : logo;
|
|
563
|
+
}
|
|
564
|
+
|
|
538
565
|
const TAB_ALIGNMENTS = ["left", "right"];
|
|
539
566
|
const TAB_ROW_WIDTHS = ["full", "content"];
|
|
540
567
|
|
|
@@ -817,4 +844,4 @@ function borderWidthOr(...values) {
|
|
|
817
844
|
return BORDER_WIDTH_MIN;
|
|
818
845
|
}
|
|
819
846
|
|
|
820
|
-
module.exports = { normaliseNavigation, menuItemCap, resolveFooterTokens, resolveSidebarTokens, resolveTopStripeLayout, resolveTopBarTokens, topStripeShowKey, TOP_STRIPE_ALWAYS_SHOWN_SLOTS, TOP_STRIPE_SLOTS, MIN_TOP_STRIPE_HEIGHT_PX, MAX_TOP_STRIPE_HEIGHT_PX, MIN_TOP_STRIPE_PADDING_X_PX, MAX_TOP_STRIPE_PADDING_X_PX, MAX_TOP_STRIPE_OFFSET_Y_PX, DEFAULT_TOP_STRIPE_HEIGHT_PX, DEFAULT_TOP_STRIPE_PADDING_X_PX, resolveSidebarUnfold, resolveLocalNavModel, drawsLocalNavAnywhere };
|
|
847
|
+
module.exports = { normaliseNavigation, menuItemCap, resolveFooterTokens, resolveSidebarTokens, resolveTopStripeLayout, resolveTopBarTokens, topStripeShowKey, TOP_STRIPE_ALWAYS_SHOWN_SLOTS, TOP_STRIPE_SLOTS, MIN_TOP_STRIPE_HEIGHT_PX, MAX_TOP_STRIPE_HEIGHT_PX, MIN_TOP_STRIPE_PADDING_X_PX, MAX_TOP_STRIPE_PADDING_X_PX, MAX_TOP_STRIPE_OFFSET_Y_PX, DEFAULT_TOP_STRIPE_HEIGHT_PX, DEFAULT_TOP_STRIPE_PADDING_X_PX, resolveSidebarUnfold, resolveLocalNavModel, drawsLocalNavAnywhere, isDarkSurface, resolveAppLogo };
|
package/dist/navigation.js
CHANGED
|
@@ -526,6 +526,33 @@ export function resolveTopStripeLayout(theme) {
|
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
+
// Whether a chrome surface reads as dark — asked for the app logo's variant
|
|
530
|
+
// and for the status-bar glyphs, so the two can never disagree about a bar.
|
|
531
|
+
// A see-through `surface` is judged by its blend with what is behind it: the
|
|
532
|
+
// given `backdrop`, else the page in `theme`. A bar that paints nothing passes
|
|
533
|
+
// `textColor` instead: light text was authored for a dark backdrop.
|
|
534
|
+
export function isDarkSurface(input) {
|
|
535
|
+
const { surface, backdrop, textColor, theme } = isPlainObject(input) ? input : {};
|
|
536
|
+
if (isHexColor(surface)) {
|
|
537
|
+
const alpha = surface.length === 9 ? parseInt(surface.slice(7), 16) / 255 : 1;
|
|
538
|
+
const behind = isHexColor(backdrop)
|
|
539
|
+
? backdrop
|
|
540
|
+
: chromeSurface(isPlainObject(theme) ? theme : {});
|
|
541
|
+
const seen = alpha < 1 ? mixHex(behind, surface.slice(0, 7), alpha) : surface;
|
|
542
|
+
return readableTextColor(seen, "dark", "light") === "light";
|
|
543
|
+
}
|
|
544
|
+
if (isHexColor(textColor)) {
|
|
545
|
+
return readableTextColor(textColor, "dark", "light") === "dark";
|
|
546
|
+
}
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// The dark-surface logo is a VARIANT of the app logo: it never stands alone.
|
|
551
|
+
export function resolveAppLogo(logo, darkSurfaceLogo, onDark) {
|
|
552
|
+
if (!logo) return null;
|
|
553
|
+
return onDark && darkSurfaceLogo ? darkSurfaceLogo : logo;
|
|
554
|
+
}
|
|
555
|
+
|
|
529
556
|
const TAB_ALIGNMENTS = ["left", "right"];
|
|
530
557
|
const TAB_ROW_WIDTHS = ["full", "content"];
|
|
531
558
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.218.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|