@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.170 → 2.0.0-next.171
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/bundle/openbridge-webcomponents.bundle.js +870 -441
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +1110 -383
- package/dist/ar/poi/poi-aton.d.ts +1 -0
- package/dist/ar/poi/poi-aton.d.ts.map +1 -1
- package/dist/ar/poi/poi-aton.js +1 -0
- package/dist/ar/poi/poi-aton.js.map +1 -1
- package/dist/ar/poi/poi-base.d.ts +39 -5
- package/dist/ar/poi/poi-base.d.ts.map +1 -1
- package/dist/ar/poi/poi-base.js +108 -37
- package/dist/ar/poi/poi-base.js.map +1 -1
- package/dist/ar/poi/poi-data.d.ts +1 -0
- package/dist/ar/poi/poi-data.d.ts.map +1 -1
- package/dist/ar/poi/poi-data.js +1 -0
- package/dist/ar/poi/poi-data.js.map +1 -1
- package/dist/ar/poi/poi-vessel.d.ts +1 -0
- package/dist/ar/poi/poi-vessel.d.ts.map +1 -1
- package/dist/ar/poi/poi-vessel.js +1 -0
- package/dist/ar/poi/poi-vessel.js.map +1 -1
- package/dist/ar/poi/poi.d.ts +4 -12
- package/dist/ar/poi/poi.d.ts.map +1 -1
- package/dist/ar/poi/poi.js +6 -72
- package/dist/ar/poi/poi.js.map +1 -1
- package/dist/ar/poi-button/poi-button.d.ts +6 -2
- package/dist/ar/poi-button/poi-button.d.ts.map +1 -1
- package/dist/ar/poi-button/poi-button.js +10 -1
- package/dist/ar/poi-button/poi-button.js.map +1 -1
- package/dist/ar/poi-card/poi-card.d.ts +12 -1
- package/dist/ar/poi-card/poi-card.d.ts.map +1 -1
- package/dist/ar/poi-card/poi-card.js +4 -1
- package/dist/ar/poi-card/poi-card.js.map +1 -1
- package/dist/ar/poi-controller/poi-controller.d.ts +45 -1
- package/dist/ar/poi-controller/poi-controller.d.ts.map +1 -1
- package/dist/ar/poi-controller/poi-controller.js +72 -14
- package/dist/ar/poi-controller/poi-controller.js.map +1 -1
- package/dist/ar/poi-group/poi-group.d.ts +28 -5
- package/dist/ar/poi-group/poi-group.d.ts.map +1 -1
- package/dist/ar/poi-group/poi-group.js +50 -7
- package/dist/ar/poi-group/poi-group.js.map +1 -1
- package/dist/ar/poi-layer/poi-layer.css.js +69 -18
- package/dist/ar/poi-layer/poi-layer.css.js.map +1 -1
- package/dist/ar/poi-layer/poi-layer.d.ts +64 -5
- package/dist/ar/poi-layer/poi-layer.d.ts.map +1 -1
- package/dist/ar/poi-layer/poi-layer.js +173 -39
- package/dist/ar/poi-layer/poi-layer.js.map +1 -1
- package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts +82 -7
- package/dist/ar/poi-layer-stack/poi-layer-stack.d.ts.map +1 -1
- package/dist/ar/poi-layer-stack/poi-layer-stack.js +172 -100
- package/dist/ar/poi-layer-stack/poi-layer-stack.js.map +1 -1
- package/dist/ar/poi-projection/poi-projection.d.ts +88 -0
- package/dist/ar/poi-projection/poi-projection.d.ts.map +1 -0
- package/dist/ar/poi-projection/poi-projection.js +90 -0
- package/dist/ar/poi-projection/poi-projection.js.map +1 -0
- package/docs/MigrationGuide.mdx +61 -5
- package/docs/migration-guide/a11y-labels.md +8 -0
- package/docs/migration-guide/api-automation.md +1 -0
- package/package.json +2 -2
- package/src/ar/_test-utils.ts +18 -6
- package/src/ar/poi/poi-aton.ts +2 -0
- package/src/ar/poi/poi-base.ts +159 -70
- package/src/ar/poi/poi-data.ts +2 -0
- package/src/ar/poi/poi-dom-ownership.spec.ts +393 -0
- package/src/ar/poi/poi-vessel.ts +2 -0
- package/src/ar/poi/poi.ts +12 -113
- package/src/ar/poi-button/poi-button.ts +25 -3
- package/src/ar/poi-card/poi-card.ts +16 -2
- package/src/ar/poi-controller/poi-controller.spec.ts +54 -0
- package/src/ar/poi-controller/poi-controller.stories.ts +76 -24
- package/src/ar/poi-controller/poi-controller.ts +111 -41
- package/src/ar/poi-group/poi-group.stories.ts +18 -5
- package/src/ar/poi-group/poi-group.ts +87 -12
- package/src/ar/poi-layer/poi-layer.css +69 -18
- package/src/ar/poi-layer/poi-layer.stories.ts +30 -16
- package/src/ar/poi-layer/poi-layer.ts +289 -64
- package/src/ar/poi-layer-stack/poi-layer-stack.stories.ts +56 -23
- package/src/ar/poi-layer-stack/poi-layer-stack.ts +342 -247
- package/src/ar/poi-projection/poi-projection.stories.ts +100 -0
- package/src/ar/poi-projection/poi-projection.ts +147 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module POI Projection
|
|
3
|
+
*
|
|
4
|
+
* Media-projection helpers for POI overlays.
|
|
5
|
+
*
|
|
6
|
+
* Maps points from media pixel space (video/image natural resolution) to
|
|
7
|
+
* rendered screen space, accounting for `cover`/`contain` letterboxing.
|
|
8
|
+
* This is the same math `obc-poi-controller` applies to its
|
|
9
|
+
* detections-driven targets, exported as pure functions so applications
|
|
10
|
+
* that manage their own POI elements can project coordinates without
|
|
11
|
+
* re-implementing the transform.
|
|
12
|
+
*
|
|
13
|
+
* ### Usage Guidelines
|
|
14
|
+
* - Build a {@link MediaProjection} once per resize/metadata change via
|
|
15
|
+
* {@link computeMediaProjection}; reuse it for every point in a frame.
|
|
16
|
+
* - `renderWidth`/`renderHeight` come from the media element's
|
|
17
|
+
* `getBoundingClientRect()`; `mediaWidth`/`mediaHeight` from
|
|
18
|
+
* `videoWidth`/`videoHeight` (video) or `naturalWidth`/`naturalHeight`
|
|
19
|
+
* (image).
|
|
20
|
+
* - {@link projectPointToLayer} additionally converts a projected
|
|
21
|
+
* point into `obc-poi-data` layer coordinates (`x` center px,
|
|
22
|
+
* `y` line length from the layer's bottom anchor), given the layer's
|
|
23
|
+
* bottom offset inside the projection container.
|
|
24
|
+
*
|
|
25
|
+
* ### Fit modes
|
|
26
|
+
* - `cover`: media fills the container; overflow is cropped.
|
|
27
|
+
* - `contain`: media letterboxes inside the container.
|
|
28
|
+
*
|
|
29
|
+
* The Storybook demo draws the rendered container (outer box), the scaled
|
|
30
|
+
* media content region (shaded), and a marker at the projected point.
|
|
31
|
+
*/
|
|
32
|
+
/** Fit behavior matching `obc-poi-controller`'s `PoiFitMode` values. */
|
|
33
|
+
export declare enum MediaFit {
|
|
34
|
+
Cover = "cover",
|
|
35
|
+
Contain = "contain"
|
|
36
|
+
}
|
|
37
|
+
/** Natural and rendered media dimensions plus the fit mode. */
|
|
38
|
+
export interface MediaProjectionInput {
|
|
39
|
+
/** Media natural width in px (`videoWidth`/`naturalWidth`). */
|
|
40
|
+
mediaWidth: number;
|
|
41
|
+
/** Media natural height in px (`videoHeight`/`naturalHeight`). */
|
|
42
|
+
mediaHeight: number;
|
|
43
|
+
/** Rendered element width in px. */
|
|
44
|
+
renderWidth: number;
|
|
45
|
+
/** Rendered element height in px. */
|
|
46
|
+
renderHeight: number;
|
|
47
|
+
fit: MediaFit;
|
|
48
|
+
}
|
|
49
|
+
/** Resolved projection: uniform scale plus letterbox offsets. */
|
|
50
|
+
export interface MediaProjection {
|
|
51
|
+
scale: number;
|
|
52
|
+
/** Horizontal letterbox offset in rendered px (negative when cropped). */
|
|
53
|
+
offsetX: number;
|
|
54
|
+
/** Vertical letterbox offset in rendered px (negative when cropped). */
|
|
55
|
+
offsetY: number;
|
|
56
|
+
/** Scaled media content width in rendered px. */
|
|
57
|
+
contentWidth: number;
|
|
58
|
+
/** Scaled media content height in rendered px. */
|
|
59
|
+
contentHeight: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compute the projection for the given dimensions, or `null` when any
|
|
63
|
+
* dimension is non-finite or zero (media not measured yet).
|
|
64
|
+
*/
|
|
65
|
+
export declare function computeMediaProjection(input: MediaProjectionInput): MediaProjection | null;
|
|
66
|
+
/** Project a point from media pixel space into rendered space. */
|
|
67
|
+
export declare function projectPoint(projection: MediaProjection, x: number, y: number): {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Project a media-space anchor point into `obc-poi-data` layer
|
|
73
|
+
* coordinates.
|
|
74
|
+
*
|
|
75
|
+
* `layerBottom` is the POI layer's bottom edge measured in the same
|
|
76
|
+
* rendered coordinate space as the projection container (e.g.
|
|
77
|
+
* `layerRect.bottom - containerRect.top`). The returned `y` is the
|
|
78
|
+
* connector line length extending downward from the layer to the
|
|
79
|
+
* target point, clamped to `0` (matches how `obc-poi-controller`
|
|
80
|
+
* positions its detection targets).
|
|
81
|
+
*/
|
|
82
|
+
export declare function projectPointToLayer(projection: MediaProjection, x: number, y: number, layerBottom: number): {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
};
|
|
86
|
+
/** Scale a media-space box dimension into rendered px, or `null`. */
|
|
87
|
+
export declare function projectBoxSize(projection: MediaProjection, size: number | null | undefined): number | null;
|
|
88
|
+
//# sourceMappingURL=poi-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poi-projection.d.ts","sourceRoot":"","sources":["../../../src/ar/poi-projection/poi-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,wEAAwE;AACxE,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,GAC1B,eAAe,GAAG,IAAI,CA6BxB;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAC1B,UAAU,EAAE,eAAe,EAC3B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAKxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,eAAe,EAC3B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,MAAM,GAClB;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAMxB;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAC5B,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,GAAG,IAAI,CAKf"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region src/ar/poi-projection/poi-projection.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module POI Projection
|
|
4
|
+
*
|
|
5
|
+
* Media-projection helpers for POI overlays.
|
|
6
|
+
*
|
|
7
|
+
* Maps points from media pixel space (video/image natural resolution) to
|
|
8
|
+
* rendered screen space, accounting for `cover`/`contain` letterboxing.
|
|
9
|
+
* This is the same math `obc-poi-controller` applies to its
|
|
10
|
+
* detections-driven targets, exported as pure functions so applications
|
|
11
|
+
* that manage their own POI elements can project coordinates without
|
|
12
|
+
* re-implementing the transform.
|
|
13
|
+
*
|
|
14
|
+
* ### Usage Guidelines
|
|
15
|
+
* - Build a {@link MediaProjection} once per resize/metadata change via
|
|
16
|
+
* {@link computeMediaProjection}; reuse it for every point in a frame.
|
|
17
|
+
* - `renderWidth`/`renderHeight` come from the media element's
|
|
18
|
+
* `getBoundingClientRect()`; `mediaWidth`/`mediaHeight` from
|
|
19
|
+
* `videoWidth`/`videoHeight` (video) or `naturalWidth`/`naturalHeight`
|
|
20
|
+
* (image).
|
|
21
|
+
* - {@link projectPointToLayer} additionally converts a projected
|
|
22
|
+
* point into `obc-poi-data` layer coordinates (`x` center px,
|
|
23
|
+
* `y` line length from the layer's bottom anchor), given the layer's
|
|
24
|
+
* bottom offset inside the projection container.
|
|
25
|
+
*
|
|
26
|
+
* ### Fit modes
|
|
27
|
+
* - `cover`: media fills the container; overflow is cropped.
|
|
28
|
+
* - `contain`: media letterboxes inside the container.
|
|
29
|
+
*
|
|
30
|
+
* The Storybook demo draws the rendered container (outer box), the scaled
|
|
31
|
+
* media content region (shaded), and a marker at the projected point.
|
|
32
|
+
*/
|
|
33
|
+
/** Fit behavior matching `obc-poi-controller`'s `PoiFitMode` values. */
|
|
34
|
+
var MediaFit = /* @__PURE__ */ function(MediaFit) {
|
|
35
|
+
MediaFit["Cover"] = "cover";
|
|
36
|
+
MediaFit["Contain"] = "contain";
|
|
37
|
+
return MediaFit;
|
|
38
|
+
}({});
|
|
39
|
+
/**
|
|
40
|
+
* Compute the projection for the given dimensions, or `null` when any
|
|
41
|
+
* dimension is non-finite or zero (media not measured yet).
|
|
42
|
+
*/
|
|
43
|
+
function computeMediaProjection(input) {
|
|
44
|
+
const { mediaWidth, mediaHeight, renderWidth, renderHeight, fit } = input;
|
|
45
|
+
if (!Number.isFinite(mediaWidth) || !Number.isFinite(mediaHeight) || !Number.isFinite(renderWidth) || !Number.isFinite(renderHeight) || mediaWidth === 0 || mediaHeight === 0 || renderWidth === 0 || renderHeight === 0) return null;
|
|
46
|
+
const scale = fit === "cover" ? Math.max(renderWidth / mediaWidth, renderHeight / mediaHeight) : Math.min(renderWidth / mediaWidth, renderHeight / mediaHeight);
|
|
47
|
+
const contentWidth = mediaWidth * scale;
|
|
48
|
+
const contentHeight = mediaHeight * scale;
|
|
49
|
+
return {
|
|
50
|
+
scale,
|
|
51
|
+
offsetX: (renderWidth - contentWidth) / 2,
|
|
52
|
+
offsetY: (renderHeight - contentHeight) / 2,
|
|
53
|
+
contentWidth,
|
|
54
|
+
contentHeight
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Project a point from media pixel space into rendered space. */
|
|
58
|
+
function projectPoint(projection, x, y) {
|
|
59
|
+
return {
|
|
60
|
+
x: projection.offsetX + x * projection.scale,
|
|
61
|
+
y: projection.offsetY + y * projection.scale
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Project a media-space anchor point into `obc-poi-data` layer
|
|
66
|
+
* coordinates.
|
|
67
|
+
*
|
|
68
|
+
* `layerBottom` is the POI layer's bottom edge measured in the same
|
|
69
|
+
* rendered coordinate space as the projection container (e.g.
|
|
70
|
+
* `layerRect.bottom - containerRect.top`). The returned `y` is the
|
|
71
|
+
* connector line length extending downward from the layer to the
|
|
72
|
+
* target point, clamped to `0` (matches how `obc-poi-controller`
|
|
73
|
+
* positions its detection targets).
|
|
74
|
+
*/
|
|
75
|
+
function projectPointToLayer(projection, x, y, layerBottom) {
|
|
76
|
+
const projected = projectPoint(projection, x, y);
|
|
77
|
+
return {
|
|
78
|
+
x: projected.x,
|
|
79
|
+
y: Math.max(0, projected.y - layerBottom)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Scale a media-space box dimension into rendered px, or `null`. */
|
|
83
|
+
function projectBoxSize(projection, size) {
|
|
84
|
+
if (typeof size !== "number" || !Number.isFinite(size)) return null;
|
|
85
|
+
return size * projection.scale;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { MediaFit, computeMediaProjection, projectBoxSize, projectPoint, projectPointToLayer };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=poi-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poi-projection.js","names":[],"sources":["../../../src/ar/poi-projection/poi-projection.ts"],"sourcesContent":["/**\n * @module POI Projection\n *\n * Media-projection helpers for POI overlays.\n *\n * Maps points from media pixel space (video/image natural resolution) to\n * rendered screen space, accounting for `cover`/`contain` letterboxing.\n * This is the same math `obc-poi-controller` applies to its\n * detections-driven targets, exported as pure functions so applications\n * that manage their own POI elements can project coordinates without\n * re-implementing the transform.\n *\n * ### Usage Guidelines\n * - Build a {@link MediaProjection} once per resize/metadata change via\n * {@link computeMediaProjection}; reuse it for every point in a frame.\n * - `renderWidth`/`renderHeight` come from the media element's\n * `getBoundingClientRect()`; `mediaWidth`/`mediaHeight` from\n * `videoWidth`/`videoHeight` (video) or `naturalWidth`/`naturalHeight`\n * (image).\n * - {@link projectPointToLayer} additionally converts a projected\n * point into `obc-poi-data` layer coordinates (`x` center px,\n * `y` line length from the layer's bottom anchor), given the layer's\n * bottom offset inside the projection container.\n *\n * ### Fit modes\n * - `cover`: media fills the container; overflow is cropped.\n * - `contain`: media letterboxes inside the container.\n *\n * The Storybook demo draws the rendered container (outer box), the scaled\n * media content region (shaded), and a marker at the projected point.\n */\n\n/** Fit behavior matching `obc-poi-controller`'s `PoiFitMode` values. */\nexport enum MediaFit {\n Cover = 'cover',\n Contain = 'contain',\n}\n\n/** Natural and rendered media dimensions plus the fit mode. */\nexport interface MediaProjectionInput {\n /** Media natural width in px (`videoWidth`/`naturalWidth`). */\n mediaWidth: number;\n /** Media natural height in px (`videoHeight`/`naturalHeight`). */\n mediaHeight: number;\n /** Rendered element width in px. */\n renderWidth: number;\n /** Rendered element height in px. */\n renderHeight: number;\n fit: MediaFit;\n}\n\n/** Resolved projection: uniform scale plus letterbox offsets. */\nexport interface MediaProjection {\n scale: number;\n /** Horizontal letterbox offset in rendered px (negative when cropped). */\n offsetX: number;\n /** Vertical letterbox offset in rendered px (negative when cropped). */\n offsetY: number;\n /** Scaled media content width in rendered px. */\n contentWidth: number;\n /** Scaled media content height in rendered px. */\n contentHeight: number;\n}\n\n/**\n * Compute the projection for the given dimensions, or `null` when any\n * dimension is non-finite or zero (media not measured yet).\n */\nexport function computeMediaProjection(\n input: MediaProjectionInput\n): MediaProjection | null {\n const {mediaWidth, mediaHeight, renderWidth, renderHeight, fit} = input;\n if (\n !Number.isFinite(mediaWidth) ||\n !Number.isFinite(mediaHeight) ||\n !Number.isFinite(renderWidth) ||\n !Number.isFinite(renderHeight) ||\n mediaWidth === 0 ||\n mediaHeight === 0 ||\n renderWidth === 0 ||\n renderHeight === 0\n ) {\n return null;\n }\n\n const scale =\n fit === MediaFit.Cover\n ? Math.max(renderWidth / mediaWidth, renderHeight / mediaHeight)\n : Math.min(renderWidth / mediaWidth, renderHeight / mediaHeight);\n\n const contentWidth = mediaWidth * scale;\n const contentHeight = mediaHeight * scale;\n return {\n scale,\n offsetX: (renderWidth - contentWidth) / 2,\n offsetY: (renderHeight - contentHeight) / 2,\n contentWidth,\n contentHeight,\n };\n}\n\n/** Project a point from media pixel space into rendered space. */\nexport function projectPoint(\n projection: MediaProjection,\n x: number,\n y: number\n): {x: number; y: number} {\n return {\n x: projection.offsetX + x * projection.scale,\n y: projection.offsetY + y * projection.scale,\n };\n}\n\n/**\n * Project a media-space anchor point into `obc-poi-data` layer\n * coordinates.\n *\n * `layerBottom` is the POI layer's bottom edge measured in the same\n * rendered coordinate space as the projection container (e.g.\n * `layerRect.bottom - containerRect.top`). The returned `y` is the\n * connector line length extending downward from the layer to the\n * target point, clamped to `0` (matches how `obc-poi-controller`\n * positions its detection targets).\n */\nexport function projectPointToLayer(\n projection: MediaProjection,\n x: number,\n y: number,\n layerBottom: number\n): {x: number; y: number} {\n const projected = projectPoint(projection, x, y);\n return {\n x: projected.x,\n y: Math.max(0, projected.y - layerBottom),\n };\n}\n\n/** Scale a media-space box dimension into rendered px, or `null`. */\nexport function projectBoxSize(\n projection: MediaProjection,\n size: number | null | undefined\n): number | null {\n if (typeof size !== 'number' || !Number.isFinite(size)) {\n return null;\n }\n return size * projection.scale;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAY,WAAL,yBAAA,UAAA;CACL,SAAA,WAAA;CACA,SAAA,aAAA;;AACF,EAAA,CAAA,CAAA;;;;;AAgCA,SAAgB,uBACd,OACwB;CACxB,MAAM,EAAC,YAAY,aAAa,aAAa,cAAc,QAAO;CAClE,IACE,CAAC,OAAO,SAAS,UAAU,KAC3B,CAAC,OAAO,SAAS,WAAW,KAC5B,CAAC,OAAO,SAAS,WAAW,KAC5B,CAAC,OAAO,SAAS,YAAY,KAC7B,eAAe,KACf,gBAAgB,KAChB,gBAAgB,KAChB,iBAAiB,GAEjB,OAAO;CAGT,MAAM,QACJ,QAAA,UACI,KAAK,IAAI,cAAc,YAAY,eAAe,WAAW,IAC7D,KAAK,IAAI,cAAc,YAAY,eAAe,WAAW;CAEnE,MAAM,eAAe,aAAa;CAClC,MAAM,gBAAgB,cAAc;CACpC,OAAO;EACL;EACA,UAAU,cAAc,gBAAgB;EACxC,UAAU,eAAe,iBAAiB;EAC1C;EACA;CACF;AACF;;AAGA,SAAgB,aACd,YACA,GACA,GACwB;CACxB,OAAO;EACL,GAAG,WAAW,UAAU,IAAI,WAAW;EACvC,GAAG,WAAW,UAAU,IAAI,WAAW;CACzC;AACF;;;;;;;;;;;;AAaA,SAAgB,oBACd,YACA,GACA,GACA,aACwB;CACxB,MAAM,YAAY,aAAa,YAAY,GAAG,CAAC;CAC/C,OAAO;EACL,GAAG,UAAU;EACb,GAAG,KAAK,IAAI,GAAG,UAAU,IAAI,WAAW;CAC1C;AACF;;AAGA,SAAgB,eACd,YACA,MACe;CACf,IAAI,OAAO,SAAS,YAAY,CAAC,OAAO,SAAS,IAAI,GACnD,OAAO;CAET,OAAO,OAAO,WAAW;AAC3B"}
|
package/docs/MigrationGuide.mdx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Meta, Markdown} from '@storybook/addon-docs/blocks';
|
|
2
|
+
import a11yLabels from './migration-guide/a11y-labels.md?raw';
|
|
2
3
|
import apiAr from './migration-guide/api-ar.md?raw';
|
|
3
4
|
import apiAutomation from './migration-guide/api-automation.md?raw';
|
|
4
5
|
import apiBuildingBlocks from './migration-guide/api-building-blocks.md?raw';
|
|
@@ -31,10 +32,11 @@ The [Changelog](?path=/docs/introduction-changelog--docs) lists every change. If
|
|
|
31
32
|
5. [Framework Wrappers](#framework-wrappers)
|
|
32
33
|
6. [CSS and Theming](#css-and-theming)
|
|
33
34
|
7. [Component Changes](#component-changes)
|
|
34
|
-
8. [
|
|
35
|
-
9. [
|
|
36
|
-
10. [
|
|
37
|
-
11. [
|
|
35
|
+
8. [Keyboard, Focus and Events](#keyboard-focus-and-events)
|
|
36
|
+
9. [Deprecated Components](#deprecated-components)
|
|
37
|
+
10. [API Mapping by Component](#api-mapping-by-component)
|
|
38
|
+
11. [Icons](#icons)
|
|
39
|
+
12. [Troubleshooting](#troubleshooting)
|
|
38
40
|
|
|
39
41
|
## Major Breaking Changes
|
|
40
42
|
|
|
@@ -45,7 +47,8 @@ The [Changelog](?path=/docs/introduction-changelog--docs) lists every change. If
|
|
|
45
47
|
- **Svelte:** eight components renamed a snippet prop, and named slots no longer render a wrapping `div`. See [Svelte](#svelte).
|
|
46
48
|
- **Alert flashing:** `--alarm-blink-*` and `--warning-blink-*` no longer animate; use `--flash-*` and `blinkingAll()`. See [Alert Flashing Variables](#alert-flashing-variables).
|
|
47
49
|
- **CSS variables:** 141 were renamed or removed, and the old names fail without an error. See [Renamed CSS Variables](#renamed-css-variables).
|
|
48
|
-
- **Component APIs:** properties were renamed, retyped or given new defaults, among them the [automation badges](#badges-take-values-silent), [wind speeds in knots](#wind-speed-in-knots-silent), [`obc-card` timeouts in seconds](#obc-card-timeouts-in-seconds-silent)
|
|
50
|
+
- **Component APIs:** properties were renamed, retyped or given new defaults, among them the [automation badges](#badges-take-values-silent), [wind speeds in knots](#wind-speed-in-knots-silent), [`obc-card` timeouts in seconds](#obc-card-timeouts-in-seconds-silent), [`obc-number-input-field` values as numbers](#obc-number-input-field-value-and-events) and [the motorized buttons' `on` as `turnedOn`](#on-is-now-turnedon-silent). See [Component Changes](#component-changes) and [API Mapping by Component](#api-mapping-by-component).
|
|
51
|
+
- **Keyboard:** the tab row, the toggle button group and the context menu are one tab stop each, with the arrow keys moving between their items, and the modals take focus when they connect. See [Keyboard, Focus and Events](#keyboard-focus-and-events).
|
|
49
52
|
- **Icons:** 50 icons were renamed, and the wind icons ending in `-1`, `-5` and `-10` kept their names but show a different glyph. See [Icons](#icons).
|
|
50
53
|
- **Deprecations:** 11 components are deprecated. They still work in 2.0. See [Deprecated Components](#deprecated-components).
|
|
51
54
|
|
|
@@ -396,6 +399,18 @@ The tank follows the OpenBridge 6.1 design and is larger at every size ([#862](h
|
|
|
396
399
|
|
|
397
400
|
The value and setpoint rows under a device render through `obc-readout-block` ([#1097](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/pull/1097)). A missing value shows the figure dash `‒` instead of the text `NaN`, and hinted zeros are drawn in a dimmed color. The device icon colors moved from the pipe tokens to the automation button tokens, and the new `activated` property draws the selected background ([#967](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/pull/967)).
|
|
398
401
|
|
|
402
|
+
#### `on` Is Now `turnedOn` _(silent)_
|
|
403
|
+
|
|
404
|
+
The run state of `obc-motor`, `obc-pump` and `obc-fan` is `turnedOn` ([#1090](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/issues/1090)). The old name begins with `on`, which Svelte and other frameworks read as an event binding, so `on={running}` in a Svelte template registered a listener for an empty event name and left the property at `false`. An `on` attribute is ignored in 2.0 and the device draws its off state.
|
|
405
|
+
|
|
406
|
+
```html
|
|
407
|
+
<!-- 1.0.1 -->
|
|
408
|
+
<obc-pump on></obc-pump>
|
|
409
|
+
|
|
410
|
+
<!-- 2.0 -->
|
|
411
|
+
<obc-pump turnedOn></obc-pump>
|
|
412
|
+
```
|
|
413
|
+
|
|
399
414
|
### Instruments
|
|
400
415
|
|
|
401
416
|
#### Wind Speed in Knots _(silent)_
|
|
@@ -802,6 +817,47 @@ The point-of-interest components are experimental in 2.0. Besides the [import pa
|
|
|
802
817
|
<obc-poi-layer is-selected></obc-poi-layer>
|
|
803
818
|
```
|
|
804
819
|
|
|
820
|
+
## Keyboard, Focus and Events
|
|
821
|
+
|
|
822
|
+
The components that carry a widget role follow the [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/) in 2.0 ([#1297](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/pull/1297), [#1314](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/pull/1314)). No property was removed. What changed is how the components answer the keyboard, when they take focus, and which events leave them, so a page that drives them from script or asserts their keyboard behavior in tests needs a second look.
|
|
823
|
+
|
|
824
|
+
### One Tab Stop per Composite Widget _(silent)_
|
|
825
|
+
|
|
826
|
+
`obc-tab-row`, `obc-toggle-button-group` and `obc-context-menu-input` hold a single tab stop each, and the arrow keys move between their items, with `Home` and `End` for the first and last. In 1.0.1 every item was its own tab stop, so a test that reached the last of five tabs with five presses of `Tab` now leaves the row on the second.
|
|
827
|
+
|
|
828
|
+
Two buttons left the tab order, each with a key in its place:
|
|
829
|
+
|
|
830
|
+
- a tab's close button under `hasClose`, with `Delete` on the focused tab,
|
|
831
|
+
- the close button in `obc-context-menu-input`'s title bar, with `Escape`.
|
|
832
|
+
|
|
833
|
+
Both still fire the events they fired before, `tab-closed` and `close`.
|
|
834
|
+
|
|
835
|
+
### Modals Take Focus _(silent)_
|
|
836
|
+
|
|
837
|
+
`obc-modal-window`, `obc-sequence-modal` and `obc-automation-input-modal` follow the APG dialog pattern: focus moves onto the dialog when the element connects, `Tab` and `Shift+Tab` cycle inside it, and focus returns to the element that opened it when the element disconnects. Focus lands on the dialog container rather than on its first button, so the `Enter` that opened a dialog cannot activate anything in it.
|
|
838
|
+
|
|
839
|
+
A page that keeps a modal in the DOM and hides it with CSS now takes focus on load. Render the modal only while it is open.
|
|
840
|
+
|
|
841
|
+
`Escape` also closes `obc-keyboard-full` and `obc-keyboard-numeric`, through the same event as their close button, and `obc-stepper-box` answers the [spinbutton](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/) keys wherever focus sits inside it. On `obc-modal-window`, `Escape` fires `close-click`, or `cancel-click` when there is no close button.
|
|
842
|
+
|
|
843
|
+
### Accessible Names in English
|
|
844
|
+
|
|
845
|
+
Icon-only buttons name themselves for a screen reader, and the defaults are English, so a localized page sets them. `obc-topbar-message-item` is the exception: its `actionLabel` is empty by default and the button stays unnamed until the page sets it.
|
|
846
|
+
|
|
847
|
+
<div style={{overflowX: 'auto'}}>
|
|
848
|
+
|
|
849
|
+
<Markdown>{a11yLabels}</Markdown>
|
|
850
|
+
|
|
851
|
+
</div>
|
|
852
|
+
|
|
853
|
+
`obc-tab-row` names its tab list through `label`, and `obc-toggle-button-group`, `obc-table` and `obc-alert-list-details-experimental` take their name from `aria-label`.
|
|
854
|
+
|
|
855
|
+
### Events Stay Inside Their Component _(silent)_
|
|
856
|
+
|
|
857
|
+
A component no longer lets a child's event out unless it documents that event itself, so what an element fires is what its `@fires` list in the docs shows. 75 events that crossed the shadow boundary in 1.0.1 without any element documenting them were closed off: most are stopped where they are handled, among them the readout source events of the instruments and `tab-click` inside `obc-tab-row`, and the rest now carry an `@fires` entry on the component that passes them on, as `event-click` does on `obc-date-item` and `obc-calendar`.
|
|
858
|
+
|
|
859
|
+
One documented event changed: `obc-bar-horizontal`, `obc-bar-vertical`, `obc-gauge-horizontal` and `obc-gauge-vertical` fire `scale-dimensions-changed` without `composed`, so it no longer crosses out of the shadow root of a component that renders one of them. A listener on the scale itself, or on an ancestor in the same tree, still sees it.
|
|
860
|
+
|
|
805
861
|
## Deprecated Components
|
|
806
862
|
|
|
807
863
|
Deprecated components and properties still work in 2.0 and are slated for removal. Components now show their status in Storybook: stable, beta, experimental or deprecated. The experimental ones, among them all AR and integration components, may still change their API. The replacements below are the ones the components' own `@deprecated` notes name ([#1262](https://github.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/pull/1262)).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
| Element | Property | Default |
|
|
2
|
+
| ------------------------------------------- | ---------------------------------- | -------------------------- |
|
|
3
|
+
| `obc-floating-item` | `dismissLabel` | `Dismiss` |
|
|
4
|
+
| `obc-keyboard-full`, `obc-keyboard-numeric` | `closeLabel` | `Close` |
|
|
5
|
+
| `obc-modal-window`, `obc-sequence-modal` | `closeLabel` | `Close` |
|
|
6
|
+
| `obc-slider`, `obc-stepper-box` | `decrementLabel`, `incrementLabel` | `Decrease`, `Increase` |
|
|
7
|
+
| `obc-split-button` | `dropdownLabel` | `More options` |
|
|
8
|
+
| `obc-topbar-message-item` | `actionLabel` | empty; the icon is unnamed |
|
|
@@ -9,3 +9,4 @@
|
|
|
9
9
|
| all automation devices | `tag` = `''` | `tag` = `null` |
|
|
10
10
|
| `obc-automation-button`, `obc-automation-button-readout-stack` | `tag`: `AutomationButtonReadoutStackTag` or `null` | `tag`: `string` or `null` |
|
|
11
11
|
| `obc-automation-tank` | `variant` | `orientation`; `variant="compact"` is now `compact` |
|
|
12
|
+
| `obc-fan`, `obc-motor`, `obc-pump` | `on` | `turnedOn` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oicl/openbridge-webcomponents-full-bundle",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.171",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vitest/browser-playwright": "^4.1.11",
|
|
50
50
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
51
51
|
"dotenv": "^18.0.0",
|
|
52
|
-
"eslint": "^10.
|
|
52
|
+
"eslint": "^10.11.0",
|
|
53
53
|
"eslint-plugin-storybook": "^10.6.0",
|
|
54
54
|
"figma-api": "^2.2.1-beta",
|
|
55
55
|
"glob": "^13.0.6",
|
package/src/ar/_test-utils.ts
CHANGED
|
@@ -2,6 +2,11 @@ export const isVitestBrowser = Boolean(
|
|
|
2
2
|
(globalThis as {__vitest_browser__?: unknown}).__vitest_browser__
|
|
3
3
|
);
|
|
4
4
|
|
|
5
|
+
const nextFrames = () =>
|
|
6
|
+
new Promise<void>((resolve) =>
|
|
7
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve()))
|
|
8
|
+
);
|
|
9
|
+
|
|
5
10
|
export const waitForStorySettle = async (
|
|
6
11
|
options: {drainTransitions?: boolean} = {}
|
|
7
12
|
) => {
|
|
@@ -9,16 +14,23 @@ export const waitForStorySettle = async (
|
|
|
9
14
|
await (document as Document & {fonts?: FontFaceSet}).fonts?.ready;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
await
|
|
13
|
-
requestAnimationFrame(() => requestAnimationFrame(() => resolve()))
|
|
14
|
-
);
|
|
17
|
+
await nextFrames();
|
|
15
18
|
|
|
16
19
|
if (options.drainTransitions && isVitestBrowser) {
|
|
17
20
|
await new Promise<void>((resolve) => {
|
|
18
21
|
setTimeout(resolve, 220);
|
|
19
22
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
// `data-x-moving` is a `will-change` hint POI targets carry briefly after
|
|
24
|
+
// a position update; whether it is still set at capture time changes
|
|
25
|
+
// stroke rasterization, so snapshots flip under load unless it has
|
|
26
|
+
// expired. Stories that animate forever hit the deadline instead.
|
|
27
|
+
const deadline = performance.now() + 2000;
|
|
28
|
+
while (
|
|
29
|
+
document.querySelector('[data-x-moving]') &&
|
|
30
|
+
performance.now() < deadline
|
|
31
|
+
) {
|
|
32
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 50));
|
|
33
|
+
}
|
|
34
|
+
await nextFrames();
|
|
23
35
|
}
|
|
24
36
|
};
|
package/src/ar/poi/poi-aton.ts
CHANGED
|
@@ -18,6 +18,7 @@ export {ObcPoiObjectState as ObcPoiObjectAtonState};
|
|
|
18
18
|
*
|
|
19
19
|
* Extends `PoiBase` to provide the "aton" variant of the POI system.
|
|
20
20
|
* Renders `<obc-poi>` with a slotted `<obc-poi-button-aton>`.
|
|
21
|
+
* See the "Coordinate Model" section in `PoiBase` (poi-base.ts) for how `x`, `y`, and `buttonY` position the marker.
|
|
21
22
|
*
|
|
22
23
|
* @slot - Icon content forwarded to the inner aton diamond.
|
|
23
24
|
* @slot header - Optional header content forwarded to the poi button.
|
|
@@ -61,6 +62,7 @@ export class ObcPoiAton extends PoiBase {
|
|
|
61
62
|
.atonInteractive=${this.atonInteractive}
|
|
62
63
|
>
|
|
63
64
|
<slot><obi-beacon-general-east></obi-beacon-general-east></slot>
|
|
65
|
+
<slot name="header" slot="header"></slot>
|
|
64
66
|
</obc-poi-button-aton>
|
|
65
67
|
`;
|
|
66
68
|
}
|