@orangelogic/myos-gen1 1.0.0-alpha.13 → 1.0.0-alpha.15
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/contracts/dotnet/ReleaseEligibility.cs +8 -7
- package/contracts/unit/1/README.md +38 -0
- package/contracts/unit/1/unit.ts +9 -0
- package/dist/{autocomplete-A22UY3SN.js → autocomplete-P5BK4OPY.js} +1 -1
- package/dist/{chunk-2JEQZJWE.js → chunk-7PIWWAEE.js} +1 -1
- package/dist/{chunk-CEFABX7R.js → chunk-DTEXGDWU.js} +70 -4
- package/dist/contracts/unit.d.ts +11 -0
- package/dist/{date-HHTMVKVA.js → date-EHBEJXA7.js} +1 -1
- package/dist/{menu-BNLDLLJL.js → menu-T3KIPZY2.js} +5 -5
- package/dist/{remote-table-MUEAZU26.js → remote-table-IHAQVZBS.js} +2 -2
- package/dist/{rich-text-7HNZFET5.js → rich-text-GR36HPMI.js} +1 -1
- package/dist/runtime/index.css +10 -0
- package/dist/runtime/index.js +14 -11
- package/dist/runtime/menu-panels.d.ts +3 -1
- package/dist/runtime/presentation-state.d.ts +5 -0
- package/dist/runtime/renderer-families.json +10 -10
- package/dist/{select-3GYY26V7.js → select-LQJLARZJ.js} +1 -1
- package/dist/{tab-menu-5MKT2234.js → tab-menu-VAV24BQS.js} +1 -1
- package/dist/{table-UXDJNCDN.js → table-LJXFEGOH.js} +2 -2
- package/dist/{webcomponent-SSBPKP6V.js → webcomponent-3A5MZQJX.js} +7 -2
- package/dist/{widgets-H57AVNQO.js → widgets-WYT4EAMQ.js} +1 -1
- package/package.json +2 -2
- package/scripts/sync-events-actions-fixtures.mjs +24 -0
- package/scripts/sync-gen1-contracts.mjs +2 -0
|
@@ -160,9 +160,8 @@ public static class ReleaseEligibility
|
|
|
160
160
|
private static bool ValidRange(VersionRange? range, bool designSystem)
|
|
161
161
|
{
|
|
162
162
|
if (range is null || !StrictSemVersion.TryParse(range.Min, out var min)) return false;
|
|
163
|
-
if (range.Max is null) return true;
|
|
164
|
-
return StrictSemVersion.TryParse(range.Max, out var max) && max.ComparePrecedence(min) >= 0
|
|
165
|
-
(!designSystem || SameDesignSystemLine(min, max));
|
|
163
|
+
if (designSystem || range.Max is null) return true;
|
|
164
|
+
return StrictSemVersion.TryParse(range.Max, out var max) && max.ComparePrecedence(min) >= 0;
|
|
166
165
|
}
|
|
167
166
|
private static bool InRange(string version, VersionRange range)
|
|
168
167
|
{
|
|
@@ -170,10 +169,12 @@ public static class ReleaseEligibility
|
|
|
170
169
|
return candidate.ComparePrecedence(StrictSemVersion.Parse(range.Min!)) >= 0 &&
|
|
171
170
|
(range.Max is null || candidate.ComparePrecedence(StrictSemVersion.Parse(range.Max)) <= 0);
|
|
172
171
|
}
|
|
173
|
-
private static bool InDesignSystemRange(string version, VersionRange range)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
private static bool InDesignSystemRange(string version, VersionRange range)
|
|
173
|
+
{
|
|
174
|
+
var candidate = StrictSemVersion.Parse(version);
|
|
175
|
+
var min = StrictSemVersion.Parse(range.Min!);
|
|
176
|
+
return candidate.Major == min.Major && candidate.ComparePrecedence(min) >= 0;
|
|
177
|
+
}
|
|
177
178
|
private static int PrivilegeRank(ExecutionPrivilege privilege) => privilege switch
|
|
178
179
|
{
|
|
179
180
|
ExecutionPrivilege.Ordinary => 1, ExecutionPrivilege.CustomerAdmin => 2, ExecutionPrivilege.VisitingStaff => 3, _ => int.MaxValue
|
|
@@ -15,6 +15,44 @@ subscriptions and owned DOM on idempotent unmount. `host.dispose` belongs to the
|
|
|
15
15
|
Regenerate with `node packages/gen1/scripts/sync-gen1-contracts.mjs`; verify with the same
|
|
16
16
|
command plus `--check` (part of `check:contracts`).
|
|
17
17
|
|
|
18
|
+
## Host-owned presentation and lifecycle
|
|
19
|
+
|
|
20
|
+
Buttons may require `presentationStates: ["exitPending"]`. The host provides both
|
|
21
|
+
optional `getControlPresentation(unitId, controlId)` and
|
|
22
|
+
`subscribePresentation(unitId, listener)` methods. The listener invalidates a read;
|
|
23
|
+
there is no public setter. Only the semantic `exitPending: true` state is supported.
|
|
24
|
+
It applies opacity 0 and scale 0.8 through CxButton/CxIconButton public DOM props,
|
|
25
|
+
with `--cx-transition-medium` motion (250 ms; the legacy skin used 300 ms) and a
|
|
26
|
+
reduced-motion override. It preserves the control, disabled state and tab order.
|
|
27
|
+
Unknown states, non-button targets (including links), and buttons rendered as menu or tab
|
|
28
|
+
items reject explicitly rather than silently drawing an unsupported action. This
|
|
29
|
+
includes control menus, referenced dropdown panels and context-menu units, including
|
|
30
|
+
their inline VForms. Dropdown panels are resolved by reference using the renderer's
|
|
31
|
+
lookup, including triggers in web-component items and targets without `menu: true`.
|
|
32
|
+
CxMenuItem and CxTab do not support this presentation state.
|
|
33
|
+
TabMenu converts direct button children without a truthy `href` into tabs only when
|
|
34
|
+
the `tabMenu` group has no triggers and is not `hoverOnly`. Those targets reject;
|
|
35
|
+
buttons in triggered or hover-only groups, href children and buttons nested inside
|
|
36
|
+
ordinary groups or inline VForms still use CxButton/CxIconButton and remain supported.
|
|
37
|
+
Both bridge methods are required only for dependent units;
|
|
38
|
+
older units and hosts remain supported. Mount and replacement check the capability
|
|
39
|
+
before changing the rendered unit so the host can use its legacy fallback.
|
|
40
|
+
|
|
41
|
+
The host owns isolation and resets local state on private snapshot/grant replacement,
|
|
42
|
+
fallback and disposal, including replacements with an unchanged public `rev`.
|
|
43
|
+
Presentation notifications only redraw appearance: they do not replace units,
|
|
44
|
+
reseed input values, emit change, or replay Show. The runtime unsubscribes on unmount
|
|
45
|
+
and rereads on each authoritative replacement as well as presentation invalidation.
|
|
46
|
+
|
|
47
|
+
Ordinary `show` remains host-fired once per private snapshot. New `cx-dropdown`
|
|
48
|
+
maps advertise `dropdownShow`/`dropdownHide`, emitted only by CxDropdown's typed
|
|
49
|
+
open/close lifecycle callbacks. If either new key is advertised, both lifecycle
|
|
50
|
+
directions use the distinct vocabulary; an undeclared direction does not alias
|
|
51
|
+
ordinary Show. Maps with neither key retain their existing `show`/`hide` routing.
|
|
52
|
+
The adapter does not fire snapshot Show. Private schema 2, public protocol 1 and
|
|
53
|
+
slot 1 remain unchanged. URLs, action indices, scripts and server arguments remain
|
|
54
|
+
host-private; navigation and dismissal use the existing semantic gesture bridge.
|
|
55
|
+
|
|
18
56
|
## Media
|
|
19
57
|
|
|
20
58
|
`kind: "media"` carries a server-resolved `src`, `mediaType`, effective `format`, `canView`, rotation,
|
package/contracts/unit/1/unit.ts
CHANGED
|
@@ -41,6 +41,8 @@ export type Input =
|
|
|
41
41
|
| { readonly kind: 'autocomplete'; readonly value: AutocompleteSelection | readonly AutocompleteSelection[] };
|
|
42
42
|
export type InputKind = Input['kind'];
|
|
43
43
|
export interface NodeBase {
|
|
44
|
+
/** Required semantic appearance capabilities. Only the reviewed button exit state is currently supported. */
|
|
45
|
+
readonly presentationStates?: readonly ControlPresentationState[];
|
|
44
46
|
/** Reviewed title, aria-* and data-* on buttons/links; framework identity attributes are reserved. */
|
|
45
47
|
readonly attributes?: Readonly<Record<string, string>>;
|
|
46
48
|
/** Reviewed named slot in the containing React web-component mapping. */
|
|
@@ -179,8 +181,15 @@ export interface AutocompleteOption { readonly value: string; readonly label: st
|
|
|
179
181
|
export interface AutocompleteResult { readonly options: readonly AutocompleteOption[]; readonly headers?: readonly string[]; readonly widths?: readonly number[] }
|
|
180
182
|
/** A design-system icon font family and its release-relative stylesheet, e.g. `assets/fonts/fontawesome.css`. */
|
|
181
183
|
export interface IconFontRequest { readonly family: 'outlined-core' | 'outlined' | 'fontawesome' | 'rounded' | 'sharp'; readonly stylesheet: string }
|
|
184
|
+
export type ControlPresentationState = 'exitPending';
|
|
185
|
+
/** Host-owned local appearance; no program, selector, URL or action authority crosses this bridge. */
|
|
186
|
+
export interface ControlPresentation { readonly exitPending?: true }
|
|
182
187
|
export interface HostBridge {
|
|
183
188
|
readonly unitId: string; readonly presentation: Presentation;
|
|
189
|
+
/** Optional for old units. Reset on private snapshot/grant replacement, fallback and disposal, even if rev is equal. */
|
|
190
|
+
getControlPresentation?(unitId: string, controlId: string): ControlPresentation;
|
|
191
|
+
/** Invalidates presentation reads only; must not reseed values or replay Show. Unsubscribe is idempotent. */
|
|
192
|
+
subscribePresentation?(unitId: string, listener: () => void): () => void;
|
|
184
193
|
getValue(unitId: string, controlId: string): InputValue | undefined;
|
|
185
194
|
/** Optional staged parameter reset state; older hosts have no parameter editor integration. */
|
|
186
195
|
getParameterReset?(unitId: string, controlId: string): boolean;
|
|
@@ -254,7 +254,7 @@ function DeferredFamily({ registry, family, render, fallback }) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
// packages/gen1/src/runtime/controls.tsx
|
|
257
|
-
import { Fragment, memo, useContext as
|
|
257
|
+
import { Fragment, memo, useContext as useContext5, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
258
258
|
import { CxAlert } from "@orangelogic/design-system-react/alert";
|
|
259
259
|
import { CxBox as CxBox2 } from "@orangelogic/design-system-react/box";
|
|
260
260
|
import { CxButton as CxButton2 } from "@orangelogic/design-system-react/button";
|
|
@@ -543,6 +543,9 @@ function findMenu(items, id) {
|
|
|
543
543
|
if (nested) return nested;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
+
function resolveSubmenu(unit, control) {
|
|
547
|
+
return control.submenu ? findMenu(unit.view, control.submenu) : void 0;
|
|
548
|
+
}
|
|
546
549
|
function isDropdownPanel(unit, id) {
|
|
547
550
|
const contains = (items) => items.some((item) => !isUnit(item) && (item.submenu === id || item.kind === "group" && contains(item.items)));
|
|
548
551
|
return contains(unit.view);
|
|
@@ -591,6 +594,66 @@ function FreeHtmlView({ control, unit, ctx }) {
|
|
|
591
594
|
);
|
|
592
595
|
}
|
|
593
596
|
|
|
597
|
+
// packages/gen1/src/runtime/presentation-state.ts
|
|
598
|
+
import { useCallback as useCallback3, useContext as useContext4, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
599
|
+
function checkControl(control, host, unsupportedRenderer = false) {
|
|
600
|
+
if (!control.presentationStates?.length) return;
|
|
601
|
+
if (control.kind !== "button" || unsupportedRenderer || control.presentationStates.some((state) => state !== "exitPending"))
|
|
602
|
+
throw Error(`Unsupported Gen1 presentation state for control ${control.id}.`);
|
|
603
|
+
if (typeof host.getControlPresentation !== "function" || typeof host.subscribePresentation !== "function")
|
|
604
|
+
throw Error(`Gen1 presentation requires getControlPresentation and subscribePresentation for control ${control.id}.`);
|
|
605
|
+
}
|
|
606
|
+
function checkPresentation(unit, host) {
|
|
607
|
+
const referencedPanels = /* @__PURE__ */ new WeakMap();
|
|
608
|
+
const visit = (items, owner, surface) => {
|
|
609
|
+
for (const item of items) {
|
|
610
|
+
if (isUnit(item)) {
|
|
611
|
+
const contextMenu = item.contextMenu || surface === "contextMenu" && item.kind === "vform";
|
|
612
|
+
visit(item.view, item, contextMenu ? "contextMenu" : "controls");
|
|
613
|
+
} else {
|
|
614
|
+
const tab = surface === "tabs" && item.kind === "button" && !item.href;
|
|
615
|
+
checkControl(item, host, surface === "menu" || surface === "contextMenu" || tab);
|
|
616
|
+
const panel = resolveSubmenu(owner, item);
|
|
617
|
+
if (panel && !referencedPanels.get(owner)?.has(panel)) {
|
|
618
|
+
const panels = referencedPanels.get(owner) ?? /* @__PURE__ */ new Set();
|
|
619
|
+
panels.add(panel);
|
|
620
|
+
referencedPanels.set(owner, panels);
|
|
621
|
+
visit(panel.items, owner, "menu");
|
|
622
|
+
}
|
|
623
|
+
if ("items" in item && item.items) {
|
|
624
|
+
const menu = item.kind === "group" && (item.menu || item.contextMenu || surface === "menu" && !owner.triggers[item.id]?.length);
|
|
625
|
+
const tabs = item.kind === "group" && item.tabMenu && !owner.triggers[item.id]?.length && !item.hoverOnly;
|
|
626
|
+
visit(item.items, owner, surface === "contextMenu" ? "contextMenu" : menu ? "menu" : tabs ? "tabs" : "controls");
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
visit(unit.view, unit, unit.contextMenu ? "contextMenu" : "controls");
|
|
632
|
+
}
|
|
633
|
+
function useExitPending(control, unitId, host) {
|
|
634
|
+
checkControl(control, host);
|
|
635
|
+
const enabled = control.presentationStates?.includes("exitPending") === true;
|
|
636
|
+
const store = useContext4(UnitStoreContext);
|
|
637
|
+
const subscribe = useCallback3((listener) => {
|
|
638
|
+
if (!enabled) return () => {
|
|
639
|
+
};
|
|
640
|
+
const unsubscribe = host.subscribePresentation(unitId, listener);
|
|
641
|
+
const unsubscribeReplacement = store?.subscribeValues(listener);
|
|
642
|
+
return () => {
|
|
643
|
+
try {
|
|
644
|
+
unsubscribe();
|
|
645
|
+
} finally {
|
|
646
|
+
unsubscribeReplacement?.();
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
}, [enabled, host, unitId, store]);
|
|
650
|
+
const read = useCallback3(
|
|
651
|
+
() => enabled && host.getControlPresentation(unitId, control.id).exitPending === true,
|
|
652
|
+
[enabled, host, unitId, control.id]
|
|
653
|
+
);
|
|
654
|
+
return useSyncExternalStore4(subscribe, read, read);
|
|
655
|
+
}
|
|
656
|
+
|
|
594
657
|
// packages/gen1/src/runtime/controls.tsx
|
|
595
658
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
596
659
|
function iconName(icon, fallback = "") {
|
|
@@ -702,9 +765,11 @@ var ControlView = memo(function ControlView2({ control, unit, ctx }) {
|
|
|
702
765
|
var ControlBody = memo(function ControlBody2({ control, unit, ctx }) {
|
|
703
766
|
const fire = useFire(ctx.host, unit.id, unit.triggers);
|
|
704
767
|
const disabled = control.disabled === true || control.readOnly === true;
|
|
768
|
+
const exitPending = useExitPending(control, unit.id, ctx.host);
|
|
705
769
|
const [hovered, setHovered] = useState4(false);
|
|
706
770
|
const hoverProps = {
|
|
707
|
-
style: { opacity: hovered && !disabled ? control.hoverOpacity : void 0 },
|
|
771
|
+
style: { opacity: exitPending ? void 0 : hovered && !disabled ? control.hoverOpacity : void 0 },
|
|
772
|
+
"data-exit-pending": exitPending || void 0,
|
|
708
773
|
onMouseEnter: () => setHovered(true),
|
|
709
774
|
onMouseLeave: () => setHovered(false)
|
|
710
775
|
};
|
|
@@ -851,7 +916,7 @@ function TextInput({ control, unit, ctx }) {
|
|
|
851
916
|
);
|
|
852
917
|
}
|
|
853
918
|
function TextareaInput({ control, unit, ctx }) {
|
|
854
|
-
const parameterInput =
|
|
919
|
+
const parameterInput = useContext5(ParameterInputContext);
|
|
855
920
|
const autoSize = parameterInput?.unitId === unit.id && parameterInput.controlId === control.id;
|
|
856
921
|
const [value, setValue] = useControlValue(ctx.host, unit.id, control.id, unit.inputs[control.id]);
|
|
857
922
|
const fire = useFire(ctx.host, unit.id, unit.triggers);
|
|
@@ -915,12 +980,13 @@ export {
|
|
|
915
980
|
useFire,
|
|
916
981
|
hasExtendedEvents,
|
|
917
982
|
EventBoundary,
|
|
918
|
-
|
|
983
|
+
resolveSubmenu,
|
|
919
984
|
isDropdownPanel,
|
|
920
985
|
createRendererRegistry,
|
|
921
986
|
RendererRegistryContext,
|
|
922
987
|
rendererFamilyNames,
|
|
923
988
|
rendererFamiliesOf,
|
|
989
|
+
checkPresentation,
|
|
924
990
|
iconName,
|
|
925
991
|
Text,
|
|
926
992
|
Items,
|
package/dist/contracts/unit.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type Input = {
|
|
|
30
30
|
};
|
|
31
31
|
export type InputKind = Input['kind'];
|
|
32
32
|
export interface NodeBase {
|
|
33
|
+
/** Required semantic appearance capabilities. Only the reviewed button exit state is currently supported. */
|
|
34
|
+
readonly presentationStates?: readonly ControlPresentationState[];
|
|
33
35
|
/** Reviewed title, aria-* and data-* on buttons/links; framework identity attributes are reserved. */
|
|
34
36
|
readonly attributes?: Readonly<Record<string, string>>;
|
|
35
37
|
/** Reviewed named slot in the containing React web-component mapping. */
|
|
@@ -329,9 +331,18 @@ export interface IconFontRequest {
|
|
|
329
331
|
readonly family: 'outlined-core' | 'outlined' | 'fontawesome' | 'rounded' | 'sharp';
|
|
330
332
|
readonly stylesheet: string;
|
|
331
333
|
}
|
|
334
|
+
export type ControlPresentationState = 'exitPending';
|
|
335
|
+
/** Host-owned local appearance; no program, selector, URL or action authority crosses this bridge. */
|
|
336
|
+
export interface ControlPresentation {
|
|
337
|
+
readonly exitPending?: true;
|
|
338
|
+
}
|
|
332
339
|
export interface HostBridge {
|
|
333
340
|
readonly unitId: string;
|
|
334
341
|
readonly presentation: Presentation;
|
|
342
|
+
/** Optional for old units. Reset on private snapshot/grant replacement, fallback and disposal, even if rev is equal. */
|
|
343
|
+
getControlPresentation?(unitId: string, controlId: string): ControlPresentation;
|
|
344
|
+
/** Invalidates presentation reads only; must not reseed values or replay Show. Unsubscribe is idempotent. */
|
|
345
|
+
subscribePresentation?(unitId: string, listener: () => void): () => void;
|
|
335
346
|
getValue(unitId: string, controlId: string): InputValue | undefined;
|
|
336
347
|
/** Optional staged parameter reset state; older hosts have no parameter editor integration. */
|
|
337
348
|
getParameterReset?(unitId: string, controlId: string): boolean;
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
EventBoundary,
|
|
4
4
|
Text,
|
|
5
5
|
activate,
|
|
6
|
-
findMenu,
|
|
7
6
|
hasExtendedEvents,
|
|
8
7
|
iconName,
|
|
9
8
|
isDropdownPanel,
|
|
10
|
-
isUnit
|
|
11
|
-
|
|
9
|
+
isUnit,
|
|
10
|
+
resolveSubmenu
|
|
11
|
+
} from "./chunk-DTEXGDWU.js";
|
|
12
12
|
import "./chunk-Y2YDC5B7.js";
|
|
13
13
|
|
|
14
14
|
// packages/gen1/src/runtime/context-menu.tsx
|
|
@@ -79,7 +79,7 @@ function MenuContents({ control, unit, ctx, menuRef, onSelect }) {
|
|
|
79
79
|
if (isUnit(item)) return /* @__PURE__ */ jsx2("span", { children: ctx.renderUnit(item, ctx) }, item.id);
|
|
80
80
|
if (isDropdownPanel(unit, item.id)) return null;
|
|
81
81
|
const disabled = control.disabled || control.readOnly || item.disabled || item.readOnly;
|
|
82
|
-
const submenu = item.submenu ?
|
|
82
|
+
const submenu = item.submenu ? resolveSubmenu(unit, item) : item.kind === "group" && !unit.triggers[item.id]?.length ? item : void 0;
|
|
83
83
|
if (item.kind === "button" || item.kind === "link" || submenu) return /* @__PURE__ */ jsx2(
|
|
84
84
|
CxMenuItem2,
|
|
85
85
|
{
|
|
@@ -107,7 +107,7 @@ function MenuContents({ control, unit, ctx, menuRef, onSelect }) {
|
|
|
107
107
|
}
|
|
108
108
|
function DropdownControl({ control, unit, ctx }) {
|
|
109
109
|
const dropdown = useRef2(null);
|
|
110
|
-
const menu =
|
|
110
|
+
const menu = resolveSubmenu(unit, control);
|
|
111
111
|
if (!menu) return /* @__PURE__ */ jsx2(ControlView, { control: { ...control, submenu: void 0 }, unit, ctx });
|
|
112
112
|
const leave = (event) => {
|
|
113
113
|
if (!control.menuInteraction?.closeOnMouseOut) return;
|
package/dist/runtime/index.css
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/* packages/gen1/src/runtime/styles.module.css */
|
|
2
|
+
[data-exit-pending=true] {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
transform: scale(0.8);
|
|
5
|
+
transition: opacity var(--cx-transition-medium), transform var(--cx-transition-medium);
|
|
6
|
+
}
|
|
7
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8
|
+
[data-exit-pending=true] {
|
|
9
|
+
transition: none;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
2
12
|
.uic-unit {
|
|
3
13
|
display: flex;
|
|
4
14
|
flex-direction: column;
|
package/dist/runtime/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Text,
|
|
7
7
|
UnitStoreContext,
|
|
8
8
|
activate,
|
|
9
|
+
checkPresentation,
|
|
9
10
|
createRendererRegistry,
|
|
10
11
|
createUnitStore,
|
|
11
12
|
defaultAction,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
useFire,
|
|
18
19
|
useInputValue,
|
|
19
20
|
useUnit
|
|
20
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-DTEXGDWU.js";
|
|
21
22
|
import {
|
|
22
23
|
uiStringKeys
|
|
23
24
|
} from "../chunk-Y2YDC5B7.js";
|
|
@@ -73,6 +74,7 @@ function createMount(Root, registry) {
|
|
|
73
74
|
}
|
|
74
75
|
return async (container, { unit, host, styleSheets }) => {
|
|
75
76
|
const store = createUnitStore(unit);
|
|
77
|
+
checkPresentation(unit, host);
|
|
76
78
|
await registry.loadRendererFamilies(rendererFamiliesOf(unit));
|
|
77
79
|
const scope = container.shadowRoot ?? (styleSheets ? container.attachShadow({ mode: "open" }) : container);
|
|
78
80
|
if (scope.childNodes.length) throw Error("Component container is occupied.");
|
|
@@ -103,6 +105,7 @@ function createMount(Root, registry) {
|
|
|
103
105
|
const update = (next) => {
|
|
104
106
|
if (!mounted) return;
|
|
105
107
|
if (next.id !== unit.id) throw Error("Replacement unit does not belong to this mount.");
|
|
108
|
+
checkPresentation(next, host);
|
|
106
109
|
registry.loadRendererFamilies(rendererFamiliesOf(next)).catch(() => void 0);
|
|
107
110
|
store.set(next);
|
|
108
111
|
};
|
|
@@ -165,17 +168,17 @@ function createRuntime(loaders) {
|
|
|
165
168
|
|
|
166
169
|
// packages/gen1/src/runtime/renderer-loaders.ts
|
|
167
170
|
var rendererLoaders = {
|
|
168
|
-
select: () => import("../select-
|
|
169
|
-
date: () => import("../date-
|
|
170
|
-
autocomplete: () => import("../autocomplete-
|
|
171
|
-
"rich-text": () => import("../rich-text-
|
|
172
|
-
table: () => import("../table-
|
|
173
|
-
"remote-table": () => import("../remote-table-
|
|
171
|
+
select: () => import("../select-LQJLARZJ.js"),
|
|
172
|
+
date: () => import("../date-EHBEJXA7.js"),
|
|
173
|
+
autocomplete: () => import("../autocomplete-P5BK4OPY.js"),
|
|
174
|
+
"rich-text": () => import("../rich-text-GR36HPMI.js"),
|
|
175
|
+
table: () => import("../table-LJXFEGOH.js"),
|
|
176
|
+
"remote-table": () => import("../remote-table-IHAQVZBS.js"),
|
|
174
177
|
media: () => import("../media-IECUTXW5.js"),
|
|
175
|
-
webcomponent: () => import("../webcomponent-
|
|
176
|
-
widgets: () => import("../widgets-
|
|
177
|
-
menu: () => import("../menu-
|
|
178
|
-
"tab-menu": () => import("../tab-menu-
|
|
178
|
+
webcomponent: () => import("../webcomponent-3A5MZQJX.js"),
|
|
179
|
+
widgets: () => import("../widgets-WYT4EAMQ.js"),
|
|
180
|
+
menu: () => import("../menu-T3KIPZY2.js"),
|
|
181
|
+
"tab-menu": () => import("../tab-menu-VAV24BQS.js")
|
|
179
182
|
};
|
|
180
183
|
|
|
181
184
|
// packages/gen1/src/runtime/index.ts
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { GroupNode, Unit, ViewNode } from '../contracts/unit';
|
|
1
|
+
import type { GroupNode, Node, Unit, ViewNode } from '../contracts/unit';
|
|
2
2
|
export declare function findMenu(items: readonly ViewNode[], id: string): GroupNode | undefined;
|
|
3
|
+
/** Shared by rendering and pre-mount validation; a referenced panel need not carry menu:true. */
|
|
4
|
+
export declare function resolveSubmenu(unit: Unit, control: Node): GroupNode | undefined;
|
|
3
5
|
export declare function isDropdownPanel(unit: Unit, id: string): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HostBridge, Node, Unit } from '../contracts/unit';
|
|
2
|
+
/** Reject before mount/update so the host can fall back instead of drawing an inert capability-dependent unit. */
|
|
3
|
+
export declare function checkPresentation(unit: Unit, host: HostBridge): void;
|
|
4
|
+
/** Read a primitive snapshot: hosts may return a fresh state object on each read. */
|
|
5
|
+
export declare function useExitPending(control: Node, unitId: string, host: HostBridge): boolean;
|
|
@@ -122,16 +122,16 @@
|
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
"modules": {
|
|
125
|
-
"table": "table-
|
|
126
|
-
"remote-table": "remote-table-
|
|
125
|
+
"table": "table-LJXFEGOH.js",
|
|
126
|
+
"remote-table": "remote-table-IHAQVZBS.js",
|
|
127
127
|
"media": "media-IECUTXW5.js",
|
|
128
|
-
"webcomponent": "webcomponent-
|
|
129
|
-
"widgets": "widgets-
|
|
130
|
-
"menu": "menu-
|
|
131
|
-
"tab-menu": "tab-menu-
|
|
132
|
-
"select": "select-
|
|
133
|
-
"date": "date-
|
|
134
|
-
"autocomplete": "autocomplete-
|
|
135
|
-
"rich-text": "rich-text-
|
|
128
|
+
"webcomponent": "webcomponent-3A5MZQJX.js",
|
|
129
|
+
"widgets": "widgets-WYT4EAMQ.js",
|
|
130
|
+
"menu": "menu-T3KIPZY2.js",
|
|
131
|
+
"tab-menu": "tab-menu-VAV24BQS.js",
|
|
132
|
+
"select": "select-LQJLARZJ.js",
|
|
133
|
+
"date": "date-EHBEJXA7.js",
|
|
134
|
+
"autocomplete": "autocomplete-P5BK4OPY.js",
|
|
135
|
+
"rich-text": "rich-text-GR36HPMI.js"
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isUnit,
|
|
4
4
|
useControlValue,
|
|
5
5
|
useFire
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DTEXGDWU.js";
|
|
7
7
|
import "./chunk-Y2YDC5B7.js";
|
|
8
8
|
|
|
9
9
|
// packages/gen1/src/runtime/web-components.tsx
|
|
@@ -220,7 +220,12 @@ function WebComponentView({ control, unit, ctx }) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
return atom(control.component, props, slots, control.component === "cx-input" ? control.disabled === true : disabled, {
|
|
223
|
-
fire: (trigger, event) =>
|
|
223
|
+
fire: (trigger, event) => {
|
|
224
|
+
const triggers = unit.triggers[control.id];
|
|
225
|
+
const distinctLifecycle = triggers?.some((key) => key === "dropdownShow" || key === "dropdownHide");
|
|
226
|
+
const routed = control.component === "cx-dropdown" && distinctLifecycle ? trigger === "show" ? "dropdownShow" : trigger === "hide" ? "dropdownHide" : trigger : trigger;
|
|
227
|
+
return !disabled && fire(control.id, routed, { domEvent: event });
|
|
228
|
+
},
|
|
224
229
|
change: (name, value, trigger, event) => {
|
|
225
230
|
if (disabled) return;
|
|
226
231
|
setState((previous) => ({ ...previous, [name]: value }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangelogic/myos-gen1",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"gen1-build": "./scripts/build.mjs"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@orangelogic/design-system-react": "1.0.0-alpha.
|
|
48
|
+
"@orangelogic/design-system-react": "1.0.0-alpha.15",
|
|
49
49
|
"react": "^19.3.0",
|
|
50
50
|
"react-dom": "^19.3.0"
|
|
51
51
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
export const eventsActionsFixture = new URL('../contracts/fixtures/events-actions/v1/examples.json', import.meta.url);
|
|
6
|
+
|
|
7
|
+
/** Copy test data only to the caller's test fixture path; never to the served contract tree. */
|
|
8
|
+
export async function syncEventsActionsFixture({ destination, check = false }) {
|
|
9
|
+
if (!destination) throw new Error('An events/actions test fixture destination is required.');
|
|
10
|
+
const bytes = await readFile(eventsActionsFixture);
|
|
11
|
+
if (check) {
|
|
12
|
+
const current = await readFile(destination).catch(() => null);
|
|
13
|
+
if (!current?.equals(bytes)) throw new Error('Events/actions fixture drift: ' + destination);
|
|
14
|
+
} else {
|
|
15
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
16
|
+
await writeFile(destination, bytes);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const destination = args.find(arg => arg !== '--check');
|
|
23
|
+
await syncEventsActionsFixture({ destination, check: args.includes('--check') });
|
|
24
|
+
}
|
|
@@ -43,6 +43,8 @@ export async function copyGen1Contracts({ destination, check = false }) {
|
|
|
43
43
|
async function copy(directory, prefix = '') {
|
|
44
44
|
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
45
45
|
const path = prefix + entry.name;
|
|
46
|
+
// Private host examples are test data, never external authoring contracts.
|
|
47
|
+
if (path === 'fixtures/events-actions') continue;
|
|
46
48
|
if (entry.isDirectory()) { await copy(resolve(directory,entry.name),path+'/'); continue; }
|
|
47
49
|
const bytes = await readFile(resolve(directory,entry.name));
|
|
48
50
|
const target = resolve(destination,path);
|