@almadar/ui 1.0.13 → 1.0.14

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.
@@ -1,4 +1,4 @@
1
- import { ThemeProvider, useTheme } from './chunk-DTKTZ3UR.js';
1
+ import { ThemeProvider, useTheme } from './chunk-I5RSZIOE.js';
2
2
 
3
3
  // context/DesignThemeContext.tsx
4
4
  var DesignThemeProvider = ThemeProvider;
@@ -1,7 +1,30 @@
1
1
  import { useUISlotManager } from './chunk-7NEWMNNU.js';
2
- import { createContext, useMemo, useState, useEffect, useCallback, useContext } from 'react';
2
+ import { createContext, useMemo, useContext, useState, useEffect, useCallback } from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
+ var UISlotContext = createContext(null);
6
+ function UISlotProvider({ children }) {
7
+ const slotManager = useUISlotManager();
8
+ const contextValue = useMemo(() => slotManager, [slotManager]);
9
+ return /* @__PURE__ */ jsx(UISlotContext.Provider, { value: contextValue, children });
10
+ }
11
+ function useUISlots() {
12
+ const context = useContext(UISlotContext);
13
+ if (!context) {
14
+ throw new Error(
15
+ "useUISlots must be used within a UISlotProvider. Make sure your component tree is wrapped with <UISlotProvider>."
16
+ );
17
+ }
18
+ return context;
19
+ }
20
+ function useSlotContent(slot) {
21
+ const { getContent } = useUISlots();
22
+ return getContent(slot);
23
+ }
24
+ function useSlotHasContent(slot) {
25
+ const { hasContent } = useUISlots();
26
+ return hasContent(slot);
27
+ }
5
28
  var BUILT_IN_THEMES = [
6
29
  {
7
30
  name: "wireframe",
@@ -163,28 +186,5 @@ function useTheme() {
163
186
  return context;
164
187
  }
165
188
  var ThemeContext_default = ThemeContext;
166
- var UISlotContext = createContext(null);
167
- function UISlotProvider({ children }) {
168
- const slotManager = useUISlotManager();
169
- const contextValue = useMemo(() => slotManager, [slotManager]);
170
- return /* @__PURE__ */ jsx(UISlotContext.Provider, { value: contextValue, children });
171
- }
172
- function useUISlots() {
173
- const context = useContext(UISlotContext);
174
- if (!context) {
175
- throw new Error(
176
- "useUISlots must be used within a UISlotProvider. Make sure your component tree is wrapped with <UISlotProvider>."
177
- );
178
- }
179
- return context;
180
- }
181
- function useSlotContent(slot) {
182
- const { getContent } = useUISlots();
183
- return getContent(slot);
184
- }
185
- function useSlotHasContent(slot) {
186
- const { hasContent } = useUISlots();
187
- return hasContent(slot);
188
- }
189
189
 
190
190
  export { BUILT_IN_THEMES, ThemeContext_default, ThemeProvider, UISlotContext, UISlotProvider, useSlotContent, useSlotHasContent, useTheme, useUISlots };