UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

124 lines (123 loc) 4.66 kB
"use client"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; 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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var StackToolbar_exports = {}; __export(StackToolbar_exports, { StackToolbar: () => StackToolbar, StackToolbarBadge: () => StackToolbarBadge, StackToolbarButton: () => StackToolbarButton, StackToolbarIcon: () => StackToolbarIcon, StackToolbarLabel: () => StackToolbarLabel, StackToolbarMenu: () => StackToolbarMenu, StackToolbarMenuAction: () => StackToolbarMenuAction, StackToolbarSearchBarSlot: () => StackToolbarSearchBarSlot, StackToolbarSpacer: () => StackToolbarSpacer, StackToolbarView: () => StackToolbarView, appendStackToolbarPropsToOptions: () => appendStackToolbarPropsToOptions }); module.exports = __toCommonJS(StackToolbar_exports); var import_react = require("react"); var import_use_isomorphic_layout_effect = require("@vxrn/use-isomorphic-layout-effect"); var import_children = require("../../headless/children.cjs"); var import_useNavigation = require("../../router/useNavigation.cjs"); var import_StackToolbarImplementation = require("./StackToolbarImplementation.cjs"); var import_StackToolbar = require("./StackToolbar.shared"); function appendStackToolbarPropsToOptions(options, props, implementation) { const optionsWithConfig = (0, import_StackToolbar.appendStackToolbarConfig)(options, props); return implementation ? implementation.appendPropsToOptions(optionsWithConfig, props) : optionsWithConfig; } function StackToolbarComponent(props) { const navigation = (0, import_useNavigation.useNavigation)(); const implementation = (0, import_StackToolbarImplementation.getStackToolbarImplementation)(); const options = (0, import_react.useMemo)(() => appendStackToolbarPropsToOptions({}, props, implementation), [implementation, props.placement, props.asChild, props.children, props.disableImePadding, props.tintColor, props.backgroundColor]); (0, import_use_isomorphic_layout_effect.useIsomorphicLayoutEffect)(() => { navigation.setOptions(options); }, [navigation, options]); return implementation?.render(props) ?? null; } function StackToolbarButton(_props) { return null; } function StackToolbarMenu(_props) { return null; } function StackToolbarMenuAction(_props) { return null; } function StackToolbarSpacer(_props) { return null; } function StackToolbarSearchBarSlot(_props) { return null; } function StackToolbarView(_props) { return null; } function StackToolbarLabel(_props) { return null; } function StackToolbarIcon(_props) { return null; } function StackToolbarBadge(_props) { return null; } Object.assign(StackToolbarButton, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "button" }); Object.assign(StackToolbarMenu, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "menu" }); Object.assign(StackToolbarMenuAction, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "menuAction" }); Object.assign(StackToolbarSpacer, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "spacer" }); Object.assign(StackToolbarSearchBarSlot, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "searchBarSlot" }); Object.assign(StackToolbarView, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "view" }); Object.assign(StackToolbarLabel, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "label" }); Object.assign(StackToolbarIcon, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "icon" }); Object.assign(StackToolbarBadge, { [import_StackToolbarImplementation.STACK_TOOLBAR_CHILD]: "badge" }); const StackToolbar = Object.assign(StackToolbarComponent, { [import_children.NAVIGATOR_CONFIG]: true, Button: StackToolbarButton, Menu: StackToolbarMenu, MenuAction: StackToolbarMenuAction, Spacer: StackToolbarSpacer, SearchBarSlot: StackToolbarSearchBarSlot, View: StackToolbarView, Label: StackToolbarLabel, Icon: StackToolbarIcon, Badge: StackToolbarBadge });