UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

926 lines (924 loc) • 47.3 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var Containers_native_exports = {}; __export(Containers_native_exports, { Button: () => Button, ControlGroup: () => ControlGroup, DisclosureGroup: () => DisclosureGroup, Divider: () => Divider, Form: () => Form, GeometryReader: () => GeometryReader, Glass: () => Glass, GlassEffectContainer: () => GlassEffectContainer, Grid: () => Grid, GridRow: () => GridRow, Group: () => Group, GroupBox: () => GroupBox, HStack: () => HStack, Host: () => Host, InsideContainer: () => import_containerChildren.InsideContainer, LabeledContent: () => LabeledContent, LazyHGrid: () => LazyHGrid, LazyHStack: () => LazyHStack, LazyVGrid: () => LazyVGrid, LazyVStack: () => LazyVStack, Link: () => Link, List: () => List, Overlay: () => Overlay, OverlayContent: () => OverlayContent, ScrollView: () => ScrollView, ScrollViewReader: () => ScrollViewReader, Section: () => Section, Slot: () => Slot, Spacer: () => Spacer, SwipeActions: () => SwipeActions, SwipeActionsActions: () => SwipeActionsActions, VStack: () => VStack, ViewSlot: () => ViewSlot, ViewThatFits: () => ViewThatFits, ZStack: () => ZStack, assertOneNativeChildren: () => import_containerChildren.assertOneNativeChildren }); module.exports = __toCommonJS(Containers_native_exports); var import_jsx_runtime = require("react/jsx-runtime"); var import_react = require("react"); var import_react_native = require("react-native"); var import_swiftStyleNative = require("./generated/swiftStyleNative.native.js"); var import_viewSlots = require("./generated/viewSlots.native.js"); var import_OneNativeButtonNativeComponent = __toESM(require("./specs/OneNativeButtonNativeComponent.native.js"), 1); var import_OneNativeContainerSlotNativeComponent = __toESM(require("./specs/OneNativeContainerSlotNativeComponent.native.js"), 1); var import_OneNativeControlGroupNativeComponent = __toESM(require("./specs/OneNativeControlGroupNativeComponent.native.js"), 1); var import_OneNativeDisclosureGroupNativeComponent = __toESM(require("./specs/OneNativeDisclosureGroupNativeComponent.native.js"), 1); var import_OneNativeDividerNativeComponent = __toESM(require("./specs/OneNativeDividerNativeComponent.native.js"), 1); var import_OneNativeFormNativeComponent = __toESM(require("./specs/OneNativeFormNativeComponent.native.js"), 1); var import_OneNativeGlassNativeComponent = __toESM(require("./specs/OneNativeGlassNativeComponent.native.js"), 1); var import_OneNativeGlassEffectContainerNativeComponent = __toESM(require("./specs/OneNativeGlassEffectContainerNativeComponent.native.js"), 1); var import_OneNativeGeometryReaderNativeComponent = __toESM(require("./specs/OneNativeGeometryReaderNativeComponent.native.js"), 1); var import_OneNativeGroupNativeComponent = __toESM(require("./specs/OneNativeGroupNativeComponent.native.js"), 1); var import_OneNativeHostNativeComponent = __toESM(require("./specs/OneNativeHostNativeComponent.native.js"), 1); var import_OneNativeLabeledContentNativeComponent = __toESM(require("./specs/OneNativeLabeledContentNativeComponent.native.js"), 1); var import_OneNativeGroupBoxNativeComponent = __toESM(require("./specs/OneNativeGroupBoxNativeComponent.native.js"), 1); var import_OneNativeViewThatFitsNativeComponent = __toESM(require("./specs/OneNativeViewThatFitsNativeComponent.native.js"), 1); var import_OneNativeLazyHStackNativeComponent = __toESM(require("./specs/OneNativeLazyHStackNativeComponent.native.js"), 1); var import_OneNativeLazyVStackNativeComponent = __toESM(require("./specs/OneNativeLazyVStackNativeComponent.native.js"), 1); var import_OneNativeLazyVGridNativeComponent = __toESM(require("./specs/OneNativeLazyVGridNativeComponent.native.js"), 1); var import_OneNativeLazyHGridNativeComponent = __toESM(require("./specs/OneNativeLazyHGridNativeComponent.native.js"), 1); var import_OneNativeGridNativeComponent = __toESM(require("./specs/OneNativeGridNativeComponent.native.js"), 1); var import_OneNativeGridRowNativeComponent = __toESM(require("./specs/OneNativeGridRowNativeComponent.native.js"), 1); var import_OneNativeLinkNativeComponent = __toESM(require("./specs/OneNativeLinkNativeComponent.native.js"), 1); var import_OneNativeListNativeComponent = __toESM(require("./specs/OneNativeListNativeComponent.native.js"), 1); var import_OneNativeOverlayNativeComponent = __toESM(require("./specs/OneNativeOverlayNativeComponent.native.js"), 1); var import_OneNativeOverlayContentNativeComponent = __toESM(require("./specs/OneNativeOverlayContentNativeComponent.native.js"), 1); var import_OneNativeScrollViewNativeComponent = __toESM(require("./specs/OneNativeScrollViewNativeComponent.native.js"), 1); var import_OneNativeScrollViewReaderNativeComponent = __toESM(require("./specs/OneNativeScrollViewReaderNativeComponent.native.js"), 1); var import_OneNativeSwipeActionsNativeComponent = __toESM(require("./specs/OneNativeSwipeActionsNativeComponent.native.js"), 1); var import_OneNativeSwipeActionsActionsNativeComponent = __toESM(require("./specs/OneNativeSwipeActionsActionsNativeComponent.native.js"), 1); var import_OneNativeSectionNativeComponent = __toESM(require("./specs/OneNativeSectionNativeComponent.native.js"), 1); var import_OneNativeSpacerNativeComponent = __toESM(require("./specs/OneNativeSpacerNativeComponent.native.js"), 1); var import_OneNativeZStackNativeComponent = __toESM(require("./specs/OneNativeZStackNativeComponent.native.js"), 1); var import_swiftui = require("./generated/swiftui.native.js"); var import_controlled = require("./controlled.native.js"); var import_labeledContent = require("./labeledContent.native.js"); var import_Pager = require("./Pager.native.js"); var import_Tabs = require("./Tabs.native.js"); var import_viewportStyle = require("./viewportStyle.native.js"); var import_listTypes = require("./listTypes.native.js"); var import_groupTypes = require("./groupTypes.native.js"); var import_containerTypes = require("./generated/containerTypes.native.js"); var import_controlTypes = require("./generated/controlTypes.native.js"); var import_containerChildren = require("./containerChildren.native.js"); var import_NavigationStack = require("./NavigationStack.native.js"); var import_gridTypes = require("./gridTypes.native.js"); var containers = "Swift.Host, Swift.HStack, Swift.VStack, Swift.ZStack, Swift.Form, Swift.Section, Swift.Glass, Swift.GroupBox, Swift.ViewThatFits, Swift.GlassEffectContainer, Swift.List, Swift.ScrollView, Swift.LazyVStack, Swift.LazyHStack, Swift.LazyVGrid, Swift.LazyHGrid, Swift.Grid, Swift.GridRow, Swift.ControlGroup, Swift.DisclosureGroup, Swift.Link, Swift.Group, Swift.Overlay, Swift.SwipeActions, Swift.NavigationStack, Swift.Toolbar, or Swift.ToolbarItem"; function nativeEnvironmentProps(param) { var { colorScheme, dynamicTypeSize, controlSize, locale, tint, isEnabled } = param; var iosVersion = Number.parseFloat(String(import_react_native.Platform.Version)); if (colorScheme) (0, import_swiftui.assertSwiftUIValue)("ColorScheme", colorScheme, iosVersion); if (dynamicTypeSize) (0, import_swiftui.assertSwiftUIValue)("DynamicTypeSize", dynamicTypeSize, iosVersion); if (controlSize) (0, import_swiftui.assertSwiftUIValue)("ControlSize", controlSize, iosVersion); if (locale !== void 0 && (typeof locale !== "string" || !locale.trim())) throw new Error("Swift.Host and Swift.Form locale must be a non-empty identifier"); return { colorScheme: colorScheme !== null && colorScheme !== void 0 ? colorScheme : "", dynamicTypeSize: dynamicTypeSize !== null && dynamicTypeSize !== void 0 ? dynamicTypeSize : "", controlSize: controlSize !== null && controlSize !== void 0 ? controlSize : "", locale: locale !== null && locale !== void 0 ? locale : "", tint, isEnabled: isEnabled === void 0 ? "" : isEnabled ? "enabled" : "disabled" }; } function assertNoGreedyContainer(children, owner) { var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; try { for (var _iterator = import_react.Children.toArray(children)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var child = _step.value; if (!/* @__PURE__ */ (0, import_react.isValidElement)(child)) continue; var name = child.type === Form ? "Swift.Form" : child.type === List ? "Swift.List" : child.type === ScrollView ? "Swift.ScrollView" : child.type === import_Tabs.Tabs ? "Swift.Tabs" : child.type === import_Pager.Pager ? "Swift.Pager" : child.type === import_NavigationStack.NavigationStack ? "Swift.NavigationStack" : null; if (name) throw new Error(`${name} cannot be a child of ${owner}; give it its own box`); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } function HostStack(param) { var { name, axis, spacing = 0, alignment = "leading", colorScheme, dynamicTypeSize, controlSize, locale, tint, isEnabled, children, style, ...props } = param; if (!import_containerTypes.hostAxes.includes(axis)) throw new Error(`${name} axis must be one of ${import_containerTypes.hostAxes.join(", ")}`); if (!import_containerTypes.hostAlignments.includes(alignment)) throw new Error(`${name} alignment must be one of ${import_containerTypes.hostAlignments.join(", ")}`); if (!Number.isFinite(spacing) || spacing < 0) throw new Error(`${name} spacing must be a non-negative number`); assertNoGreedyContainer(children, name); (0, import_containerChildren.assertOneNativeChildren)(children, name); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeHostNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], axis, spacing, alignment, ...nativeEnvironmentProps({ colorScheme, dynamicTypeSize, controlSize, locale, tint, isEnabled }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Host(param) { var { axis = "vertical", ...props } = param; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HostStack, { ...props, name: "Swift.Host", axis }); } function HStack(props) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HostStack, { ...props, name: "Swift.HStack", axis: "horizontal" }); } function VStack(props) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HostStack, { ...props, name: "Swift.VStack", axis: "vertical" }); } function ZStack(param) { var { alignment = "center", children, style, ...props } = param; if (!import_containerTypes.zStackAlignments.includes(alignment)) throw new Error(`Swift.ZStack alignment must be one of ${import_containerTypes.zStackAlignments.join(", ")}`); assertNoGreedyContainer(children, "Swift.ZStack"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.ZStack"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeZStackNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Spacer(param) { var { minLength = 0, style, ...props } = param; var inside = (0, import_react.useContext)(import_containerChildren.InsideContainer); if (!inside) throw new Error(`Swift.Spacer must be a child of ${containers}`); if (!Number.isFinite(minLength) || minLength < 0) throw new Error("Swift.Spacer minLength must be a non-negative number"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeSpacerNativeComponent.default, { ...props, style, minLength }); } var formSizings = ["fill", "content"]; function Form(param) { var { children, style, sizing = "fill", colorScheme, dynamicTypeSize, controlSize, locale, tint, isEnabled, ...props } = param; if (!formSizings.includes(sizing)) throw new Error(`Swift.Form sizing must be one of ${formSizings.join(", ")}`); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Form"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeFormNativeComponent.default, { ...props, ...nativeEnvironmentProps({ colorScheme, dynamicTypeSize, controlSize, locale, tint, isEnabled }), sizing, style: sizing === "content" ? [{ alignSelf: "stretch" }, style] : [{ flex: 1 }, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }, sizing); } function Section(param) { var { title = "", footer = "", children, swiftStyle, style, ...props } = param; if (typeof title !== "string" || typeof footer !== "string") throw new Error("Swift.Section title and footer must be strings"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Section"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeSectionNativeComponent.default, { ...props, style: [{ flex: 1 }, style], title, footer, swiftStyle: (0, import_swiftStyleNative.swiftStyleNative)(swiftStyle), onNativeSDKEvent: function onNativeSDKEvent(param2) { var { nativeEvent } = param2; return (0, import_swiftStyleNative.dispatchSDKEvent)(swiftStyle, nativeEvent.name, nativeEvent.value); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function List(param) { var { listStyle = "automatic", children, selection, onSelectionChange, swiftStyle, style, ...props } = param; (0, import_swiftui.assertSwiftUIValue)("ListStyle", listStyle, Number.parseFloat(String(import_react_native.Platform.Version))); if (selection !== void 0 && (!Array.isArray(selection) || selection.some(function(value) { return typeof value !== "string"; }) || new Set(selection).size !== selection.length)) throw new Error("Swift.List selection must contain unique string tags"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.List"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeListNativeComponent.default, { ...props, style: (0, import_viewportStyle.viewportStyle)(style), listStyle, selection: JSON.stringify(selection !== null && selection !== void 0 ? selection : []), selectionIsControlled: selection !== void 0, swiftStyle: (0, import_swiftStyleNative.swiftStyleNative)(swiftStyle), onNativeListSelectionChange: function onNativeListSelectionChange(param2) { var { nativeEvent } = param2; var next = JSON.parse(nativeEvent.selection); if (!Array.isArray(next) || next.some(function(value) { return typeof value !== "string"; }) || new Set(next).size !== next.length) throw new Error("Swift.List received an invalid native selection"); onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(next); }, onNativeSDKEvent: function onNativeSDKEvent(param2) { var { nativeEvent } = param2; return (0, import_swiftStyleNative.dispatchSDKEvent)(swiftStyle, nativeEvent.name, nativeEvent.value); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function ScrollView(param) { var { axes = "vertical", showsIndicators = true, children, swiftStyle, style, ...props } = param; if (!import_listTypes.scrollViewAxes.includes(axes)) throw new Error(`Swift.ScrollView axes must be one of ${import_listTypes.scrollViewAxes.join(", ")}`); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.ScrollView"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeScrollViewNativeComponent.default, { ...props, style: (0, import_viewportStyle.viewportStyle)(style), axes, showsIndicators, swiftStyle: (0, import_swiftStyleNative.swiftStyleNative)(swiftStyle), onNativeSDKEvent: function onNativeSDKEvent(param2) { var { nativeEvent } = param2; return (0, import_swiftStyleNative.dispatchSDKEvent)(swiftStyle, nativeEvent.name, nativeEvent.value); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function unitPoint(anchor) { if (typeof anchor === "string") { if (!Object.hasOwn(import_listTypes.unitPoints, anchor)) throw new Error(`Swift.ScrollViewProxy.scrollTo anchor must be a UnitPoint: one of ${Object.keys(import_listTypes.unitPoints).join(", ")}, or { x, y }`); return import_listTypes.unitPoints[anchor]; } if (typeof anchor !== "object" || !Number.isFinite(anchor.x) || !Number.isFinite(anchor.y)) throw new Error("Swift.ScrollViewProxy.scrollTo anchor { x, y } must be finite numbers"); return anchor; } function ScrollViewReader(param) { var { children, style, ...props } = param; var host = (0, import_react.useRef)(null); var building = (0, import_react.useRef)(false); var [proxy] = (0, import_react.useState)(function() { return { scrollTo(id, anchor) { var _ref, _ref1; if (building.current) throw new Error("Swift.ScrollViewProxy.scrollTo cannot run while Swift.ScrollViewReader builds its content; call it from an event handler or effect"); if (typeof id !== "string") throw new Error("Swift.ScrollViewProxy.scrollTo id must be a string matching a swiftStyle.id"); var point = anchor == null ? null : unitPoint(anchor); if (!host.current) throw new Error("Swift.ScrollViewProxy.scrollTo needs its Swift.ScrollViewReader mounted"); import_OneNativeScrollViewReaderNativeComponent.Commands.scrollTo(host.current, id, point !== null, (_ref = point === null || point === void 0 ? void 0 : point.x) !== null && _ref !== void 0 ? _ref : 0, (_ref1 = point === null || point === void 0 ? void 0 : point.y) !== null && _ref1 !== void 0 ? _ref1 : 0); } }; }); if (typeof children !== "function") throw new Error("Swift.ScrollViewReader takes a render function of its proxy; pass (proxy) => content"); building.current = true; var content; try { content = children(proxy); } finally { building.current = false; } (0, import_containerChildren.assertOneNativeChildren)(content, "Swift.ScrollViewReader"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeScrollViewReaderNativeComponent.default, { ...props, ref: host, style: (0, import_viewportStyle.viewportStyle)(style), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children: content }) }); } function LazyVStack(param) { var { alignment = "center", spacing, children, style, ...props } = param; if (!import_listTypes.lazyVStackAlignments.includes(alignment)) throw new Error(`Swift.LazyVStack alignment must be one of ${import_listTypes.lazyVStackAlignments.join(", ")}`); if (spacing !== void 0 && (!Number.isFinite(spacing) || spacing < 0)) throw new Error("Swift.LazyVStack spacing must be a non-negative number"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.LazyVStack"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLazyVStackNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment, spacing: spacing !== null && spacing !== void 0 ? spacing : -1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function LazyHStack(param) { var { alignment = "center", spacing, children, style, ...props } = param; if (!import_listTypes.lazyHStackAlignments.includes(alignment)) throw new Error(`Swift.LazyHStack alignment must be one of ${import_listTypes.lazyHStackAlignments.join(", ")}`); if (spacing !== void 0 && (!Number.isFinite(spacing) || spacing < 0)) throw new Error("Swift.LazyHStack spacing must be a non-negative number"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.LazyHStack"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLazyHStackNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment, spacing: spacing !== null && spacing !== void 0 ? spacing : -1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function LazyVGrid(param) { var { columns, alignment = "center", spacing, children, style, ...props } = param; if (!import_gridTypes.gridHorizontalAlignments.includes(alignment)) throw new Error("Swift.LazyVGrid alignment must be leading, center, or trailing"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.LazyVGrid"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLazyVGridNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], columns: (0, import_gridTypes.gridItems)(columns, "Swift.LazyVGrid"), alignment, spacing: (0, import_gridTypes.gridSpacing)(spacing, "Swift.LazyVGrid"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function LazyHGrid(param) { var { rows, alignment = "center", spacing, children, style, ...props } = param; if (!import_gridTypes.gridVerticalAlignments.includes(alignment)) throw new Error("Swift.LazyHGrid alignment must be a SwiftUI VerticalAlignment"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.LazyHGrid"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLazyHGridNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], rows: (0, import_gridTypes.gridItems)(rows, "Swift.LazyHGrid"), alignment, spacing: (0, import_gridTypes.gridSpacing)(spacing, "Swift.LazyHGrid"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Grid(param) { var { alignment = "center", horizontalSpacing, verticalSpacing, children, style, ...props } = param; if (!import_gridTypes.gridAlignments.includes(alignment)) throw new Error("Swift.Grid alignment must be a SwiftUI Alignment"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Grid"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGridNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment, horizontalSpacing: (0, import_gridTypes.gridSpacing)(horizontalSpacing, "Swift.Grid horizontal"), verticalSpacing: (0, import_gridTypes.gridSpacing)(verticalSpacing, "Swift.Grid vertical"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function GridRow(param) { var { alignment, children, style, ...props } = param; if (alignment !== void 0 && !import_gridTypes.gridVerticalAlignments.includes(alignment)) throw new Error("Swift.GridRow alignment must be a SwiftUI VerticalAlignment"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.GridRow"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGridRowNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment: alignment !== null && alignment !== void 0 ? alignment : "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function LabeledContent(param) { var { label, value, systemImage, children, style, ...props } = param; var content = (0, import_labeledContent.labeledContentProps)({ label, value, systemImage, hasChildren: import_react.Children.toArray(children).length > 0 }); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.LabeledContent"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLabeledContentNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], label: content.label, value: content.value, systemImage: content.systemImage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function GroupBox(param) { var { label, children, style, ...props } = param; if (label !== void 0 && typeof label !== "string") throw new Error("GroupBox label must be a string when provided"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.GroupBox"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGroupBoxNativeComponent.default, { ...props, label: label !== null && label !== void 0 ? label : "", style: [{ alignSelf: "stretch" }, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function ViewThatFits(param) { var { axes = "both", children, style, ...props } = param; if (Number.parseFloat(String(import_react_native.Platform.Version)) < 16) throw new Error("Swift.ViewThatFits requires iOS 16 or newer"); if (!import_groupTypes.viewThatFitsAxes.includes(axes)) throw new Error(`Swift.ViewThatFits axes must be one of ${import_groupTypes.viewThatFitsAxes.join(", ")}`); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.ViewThatFits"); assertNoGreedyContainer(children, "Swift.ViewThatFits"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeViewThatFitsNativeComponent.default, { ...props, axes, style: [{ alignSelf: "stretch" }, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Button(param) { var { onPress, label = "", disabled = false, subtitle = "", systemImage = "", buttonRole = "", buttonStyle = "automatic", disclosureIndicator = false, children, swiftStyle, style, ...props } = param; if (typeof label !== "string") throw new Error("Button label must be a string"); var hasChildren = import_react.Children.toArray(children).length > 0; if (hasChildren && (label !== "" || systemImage !== "" || subtitle !== "")) throw new Error("Swift.Button takes either a label or children"); if (!label && !systemImage && !hasChildren) throw new Error("Button needs a label, a systemImage, or both"); if (buttonRole) (0, import_swiftui.assertSwiftUIValue)("ButtonRole", buttonRole, Number.parseFloat(String(import_react_native.Platform.Version))); (0, import_swiftui.assertSwiftUIValue)("PrimitiveButtonStyle", buttonStyle, Number.parseFloat(String(import_react_native.Platform.Version))); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Button"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeButtonNativeComponent.default, { ...props, style, swiftStyle: (0, import_swiftStyleNative.swiftStyleNative)(swiftStyle), onNativeSDKEvent: function onNativeSDKEvent(param2) { var { nativeEvent } = param2; return (0, import_swiftStyleNative.dispatchSDKEvent)(swiftStyle, nativeEvent.name, nativeEvent.value); }, label, disabled, subtitle, systemImage, buttonRole, buttonStyle, disclosureIndicator, onNativeButtonPress: function onNativeButtonPress(param2) { var { nativeEvent } = param2; return onPress === null || onPress === void 0 ? void 0 : onPress(); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Glass(param) { var { material, glassEffect, interactive = false, shape, cornerRadius, tint, colorScheme, children, style, ...props } = param; if (glassEffect !== void 0 && !import_controlTypes.glassEffects.includes(glassEffect)) throw new Error(`Swift.Glass glassEffect must be one of ${import_controlTypes.glassEffects.join(", ")}`); if (material !== void 0 && !import_controlTypes.materials.includes(material)) throw new Error(`Swift.Glass material must be one of ${import_controlTypes.materials.join(", ")}`); if (shape !== void 0 && !import_controlTypes.glassEffectShapes.includes(shape)) throw new Error(`Swift.Glass shape must be one of ${import_controlTypes.glassEffectShapes.join(", ")}`); if (cornerRadius !== void 0 && (!Number.isFinite(cornerRadius) || cornerRadius < 0)) throw new Error("Swift.Glass cornerRadius must be a non-negative number"); if (shape !== void 0 && shape !== "roundedRectangle" && cornerRadius !== void 0) throw new Error("Swift.Glass cornerRadius requires shape=\"roundedRectangle\""); if (colorScheme) (0, import_swiftui.assertSwiftUIValue)("ColorScheme", colorScheme, Number.parseFloat(String(import_react_native.Platform.Version))); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Glass"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGlassNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], material: material !== null && material !== void 0 ? material : "", glassEffect: glassEffect !== null && glassEffect !== void 0 ? glassEffect : material ? "" : "regular", interactive, shape: shape !== null && shape !== void 0 ? shape : "", cornerRadius: cornerRadius !== null && cornerRadius !== void 0 ? cornerRadius : -1, tint, colorScheme: colorScheme !== null && colorScheme !== void 0 ? colorScheme : "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function GlassEffectContainer(param) { var { spacing, children, style, ...props } = param; if (Number.parseFloat(String(import_react_native.Platform.Version)) < 26) throw new Error("Swift.GlassEffectContainer requires iOS 26 or newer"); if (spacing !== void 0 && !Number.isFinite(spacing)) throw new Error("Swift.GlassEffectContainer spacing must be finite"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.GlassEffectContainer"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGlassEffectContainerNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], spacing: spacing !== null && spacing !== void 0 ? spacing : 0, hasSpacing: spacing !== void 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function geometryNumber(value) { return typeof value === "number" && Number.isFinite(value) ? value : void 0; } function sameGeometry(a, b) { if (!a) return false; return a.size.width === b.size.width && a.size.height === b.size.height && a.globalFrame.x === b.globalFrame.x && a.globalFrame.y === b.globalFrame.y && a.globalFrame.width === b.globalFrame.width && a.globalFrame.height === b.globalFrame.height && a.localFrame.x === b.localFrame.x && a.localFrame.y === b.localFrame.y && a.localFrame.width === b.localFrame.width && a.localFrame.height === b.localFrame.height && a.safeAreaInsets.top === b.safeAreaInsets.top && a.safeAreaInsets.leading === b.safeAreaInsets.leading && a.safeAreaInsets.bottom === b.safeAreaInsets.bottom && a.safeAreaInsets.trailing === b.safeAreaInsets.trailing; } function GeometryReader(param) { var { children, style, ...props } = param; var [geometry, setGeometry] = (0, import_react.useState)(null); var latest = (0, import_react.useRef)(null); if (typeof children !== "function") throw new Error("Swift.GeometryReader takes a render function of its geometry; pass (geometry) => content"); var content = geometry === null ? null : children(geometry); (0, import_containerChildren.assertOneNativeChildren)(content, "Swift.GeometryReader"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGeometryReaderNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], onNativeGeometryReaderChange: function onNativeGeometryReaderChange(param2) { var { nativeEvent } = param2; var event = nativeEvent; var fields = [ "x", "y", "width", "height", "localX", "localY", "localWidth", "localHeight", "sizeWidth", "sizeHeight", "safeAreaTop", "safeAreaLeading", "safeAreaBottom", "safeAreaTrailing" ]; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; try { for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var field = _step.value; if (geometryNumber(event === null || event === void 0 ? void 0 : event[field]) === void 0) throw new Error("Swift.GeometryReader emitted an invalid geometry"); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } var values = event; var next = { size: { width: values.sizeWidth, height: values.sizeHeight }, safeAreaInsets: { top: values.safeAreaTop, leading: values.safeAreaLeading, bottom: values.safeAreaBottom, trailing: values.safeAreaTrailing }, globalFrame: { x: values.x, y: values.y, width: values.width, height: values.height }, localFrame: { x: values.localX, y: values.localY, width: values.localWidth, height: values.localHeight } }; if (sameGeometry(latest.current, next)) return; latest.current = next; setGeometry({ size: next.size, safeAreaInsets: next.safeAreaInsets, frame(coordinateSpace) { if (coordinateSpace === "global") return { ...next.globalFrame }; if (coordinateSpace === "local") return { ...next.localFrame }; throw new Error("Swift.GeometryProxy.frame supports global and local coordinate spaces; named spaces are not yet bound"); } }); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children: content }) }); } function ControlGroup(param) { var { label = "", systemImage = "", controlGroupStyle = "automatic", children, style, ...props } = param; if (typeof label !== "string" || typeof systemImage !== "string") throw new Error("Swift.ControlGroup label and systemImage must be strings"); (0, import_swiftui.assertSwiftUIValue)("ControlGroupStyle", controlGroupStyle, Number.parseFloat(String(import_react_native.Platform.Version))); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.ControlGroup"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeControlGroupNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], label, systemImage, controlGroupStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function DisclosureGroup(param) { var { label, isExpanded, onIsExpandedChange, revision = 0, children, style, ...props } = param; if (typeof label !== "string" || !label) throw new Error("Swift.DisclosureGroup label must be a non-empty string"); if (typeof isExpanded !== "boolean") throw new Error("Swift.DisclosureGroup isExpanded must be a boolean"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.DisclosureGroup"); var controlled = (0, import_controlled.useControlled)(function(event) { return onIsExpandedChange(event.value); }, revision); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeDisclosureGroupNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], label, isExpanded, acknowledgedEvent: controlled.acknowledgedEvent, revision, onNativeDisclosureGroupIsExpandedChange: function onNativeDisclosureGroupIsExpandedChange(param2) { var { nativeEvent } = param2; return controlled.onNativeChange(nativeEvent); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Divider(param) { var { children, style, ...props } = param; var inside = (0, import_react.useContext)(import_containerChildren.InsideContainer); if (!inside) throw new Error(`Swift.Divider must be a child of ${containers}`); if (import_react.Children.toArray(children).length > 0) throw new Error("Swift.Divider holds no content"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeDividerNativeComponent.default, { ...props, style }); } function Link(param) { var { destination, label = "", children, style, ...props } = param; if (typeof destination !== "string" || !destination) throw new Error("Swift.Link destination must be a non-empty string"); try { new URL(destination); } catch (unused) { throw new Error("Swift.Link destination must be a parseable URL"); } if (import_react.Children.toArray(children).length === 0 && !label) throw new Error("Swift.Link needs a label or children"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Link"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeLinkNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], destination, label, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function Group(param) { var { children, style, ...props } = param; (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Group"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeGroupNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function OverlayContent(param) { var { children, style, ...props } = param; (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Overlay.Content"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeOverlayContentNativeComponent.default, { ...props, style, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function OverlayFn(param) { var { alignment = "center", children, style, ...props } = param; if (!import_containerTypes.zStackAlignments.includes(alignment)) throw new Error(`Swift.Overlay alignment must be one of ${import_containerTypes.zStackAlignments.join(", ")}`); var markers = import_react.Children.toArray(children).filter(function(child) { return /* @__PURE__ */ (0, import_react.isValidElement)(child) && child.type === OverlayContent; }); if (markers.length > 1) throw new Error("Swift.Overlay takes a single Overlay.Content child"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.Overlay"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeOverlayNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment, slotName: "", slotValues: "[]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } var Overlay = Object.assign(OverlayFn, { Content: OverlayContent }); function ViewSlotFn(param) { var { name, options, children, style, ...props } = param; if (!Object.hasOwn(import_viewSlots.viewSlotAvailability, name)) throw new Error(`unknown Swift.ViewSlot: ${name}`); if (Number.parseFloat(String(import_react_native.Platform.Version)) < import_viewSlots.viewSlotAvailability[name]) throw new Error(`Swift.ViewSlot ${name} requires iOS ${import_viewSlots.viewSlotAvailability[name]} or later`); var markers = import_react.Children.toArray(children).filter(function(child) { return /* @__PURE__ */ (0, import_react.isValidElement)(child) && child.type === OverlayContent; }); if (markers.length !== 1) throw new Error("Swift.ViewSlot takes one ViewSlot.Content child"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.ViewSlot"); var preferenceEvent = Object.hasOwn(import_viewSlots.viewSlotEvents, name) ? import_viewSlots.viewSlotEvents[name] : void 0; if (preferenceEvent && typeof (options === null || options === void 0 ? void 0 : options.onValue) !== "function") throw new Error(`Swift.ViewSlot ${name}.onValue must be a callback`); var values = import_viewSlots.viewSlotArguments[name].map(function(argument) { var value = options === null || options === void 0 ? void 0 : options[argument.field]; if (argument.kind === "bindingBoolean" || argument.kind === "bindingString") { if (typeof value !== "object" || value === null || typeof value.value !== (argument.kind === "bindingBoolean" ? "boolean" : "string") || typeof value.onChange !== "function") throw new Error(`Swift.ViewSlot ${name}.${argument.field} must be a ${argument.kind === "bindingBoolean" ? "boolean" : "string"} binding`); return String(value.value); } if (argument.kind === "boolean") { if (typeof value !== "boolean") throw new Error(`Swift.ViewSlot ${name}.${argument.field} must be a boolean`); return String(value); } if (argument.kind === "string") { if (typeof value !== "string") throw new Error(`Swift.ViewSlot ${name}.${argument.field} must be a string`); return value; } if (typeof value !== "string" || !Object.hasOwn(argument.cases, value)) throw new Error(`Swift.ViewSlot ${name}.${argument.field} must be a declared SDK case`); if (Number.parseFloat(String(import_react_native.Platform.Version)) < argument.cases[value]) throw new Error(`Swift.ViewSlot ${name}.${argument.field}=${value} is unavailable on this iOS version`); return value; }); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeOverlayNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], alignment: "center", slotName: name, slotValues: JSON.stringify(values), onNativeSDKEvent: function onNativeSDKEvent(param2) { var { nativeEvent } = param2; if (nativeEvent.name !== name) throw new Error(`Swift.ViewSlot ${name} emitted an invalid binding event`); if (preferenceEvent) { var value; try { value = JSON.parse(nativeEvent.value); } catch (unused) { throw new Error(`Swift.ViewSlot ${name} emitted an invalid preference value`); } if (!(0, import_swiftStyleNative.validSDKEventValue)(value, preferenceEvent)) throw new Error(`Swift.ViewSlot ${name} emitted an invalid preference value`); options.onValue(value); return; } var argument = import_viewSlots.viewSlotArguments[name].find(function(item) { return item.kind === "bindingBoolean" || item.kind === "bindingString"; }); if (!argument) throw new Error(`Swift.ViewSlot ${name} emitted an unexpected event`); if (argument.kind === "bindingBoolean") { if (nativeEvent.value !== "true" && nativeEvent.value !== "false") throw new Error(`Swift.ViewSlot ${name} emitted an invalid boolean binding`); var binding = options[argument.field]; binding.onChange(nativeEvent.value === "true"); } else { var binding1 = options[argument.field]; binding1.onChange(nativeEvent.value); } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } var ViewSlot = Object.assign(ViewSlotFn, { Content: OverlayContent }); function SwipeActionsActions(param) { var { edge = "trailing", allowsFullSwipe = true, children, style, ...props } = param; if (!import_groupTypes.swipeActionsEdges.includes(edge)) throw new Error(`Swift.SwipeActions edge must be one of ${import_groupTypes.swipeActionsEdges.join(", ")}`); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.SwipeActions.Actions"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeSwipeActionsActionsNativeComponent.default, { ...props, style, edge, allowsFullSwipe, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } function SwipeActionsFn(param) { var { children, style, ...props } = param; var edges = import_react.Children.toArray(children).flatMap(function(child) { var _child_props_edge; return /* @__PURE__ */ (0, import_react.isValidElement)(child) && child.type === SwipeActionsActions ? [(_child_props_edge = child.props.edge) !== null && _child_props_edge !== void 0 ? _child_props_edge : "trailing"] : []; }); if (new Set(edges).size !== edges.length) throw new Error("Swift.SwipeActions takes at most one Actions group per edge"); (0, import_containerChildren.assertOneNativeChildren)(children, "Swift.SwipeActions"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeSwipeActionsNativeComponent.default, { ...props, style: [{ alignSelf: "stretch" }, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: true, children }) }); } var SwipeActions = Object.assign(SwipeActionsFn, { Actions: SwipeActionsActions }); function Slot(param) { var { height, width = 0, children, style, ...props } = param; var inside = (0, import_react.useContext)(import_containerChildren.InsideContainer); if (!inside) throw new Error(`Swift.Slot must be a child of ${containers}`); if (!Number.isFinite(height) || height <= 0) throw new Error("Swift.Slot height must be a positive number"); if (!Number.isFinite(width) || width < 0) throw new Error("Swift.Slot width must be a non-negative number"); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OneNativeContainerSlotNativeComponent.default, { ...props, style, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_containerChildren.InsideContainer, { value: false, children }) }); }