UNPKG

@skiyee/uni-ui

Version:

一个由原子化CSS驱动、符合直觉设计、高度定制化、面向AI时代的移动端 UI 库,助力开发者打造独特且差异化的移动端应用程序

7 lines 1.06 kB
/** * @skiyee/uni-ui v1.0.0 * @author skiyee(https://github.com/skiyee) * @license Apache License 2.0 * @copyright 2025-present skiyee All rights reserved. **/ const e=require(`../_virtual/rolldown_runtime.cjs`),t=e.__toESM(require(`vue`));function n(e,n){let i=(0,t.getCurrentInstance)(),a=(0,t.shallowReactive)([]),o=(0,t.shallowReactive)([]),s=e=>{e.proxy&&(o.push((0,t.markRaw)(e)),a.push((0,t.markRaw)(e.proxy)),r(i,o,n))},c=e=>{e.proxy&&(o.splice(o.indexOf((0,t.markRaw)(e)),1),a.splice(a.indexOf((0,t.markRaw)(e.proxy)),1))};return n=>((0,t.provide)(e,Object.assign({add:s,remove:c,children:o},n)),{internalChildren:o,publicChildren:a})}function r(e,t,n){let r=i(e&&e.subTree&&e.subTree.children,n);t.sort((e,t)=>r.indexOf(e.vnode)-r.indexOf(t.vnode))}function i(e,t){let n=[],r=e=>{Array.isArray(e)&&e.forEach(e=>{if(a(e)){if(t){if(e.type&&e.type.name===t){n.push(e);return}}else n.push(e);e.component?.subTree&&r(e.component.subTree.children),e.children&&r(e.children)}})};return r(e),n}function a(e){return e?e.__v_isVNode===!0:!1}exports.useProvide=n;