chiplet 0.5.0 → 0.6.0

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.
@@ -17,13 +17,19 @@
17
17
  color-scheme: dark;
18
18
  }
19
19
  ._7t9dxb5 {
20
- border-radius: var(--_7t9dxb0);
20
+ color-scheme: light dark;
21
21
  }
22
22
  ._7t9dxb6 {
23
+ color-scheme: dark light;
24
+ }
25
+ ._7t9dxb7 {
26
+ border-radius: var(--_7t9dxb0);
27
+ }
28
+ ._7t9dxb8 {
23
29
  border-radius: 100vmax;
24
30
  }
25
31
  @supports (corner-shape: squircle) {
26
- ._7t9dxb5 {
32
+ ._7t9dxb7 {
27
33
  border-radius: calc(var(--_7t9dxb0) * 2);
28
34
  corner-shape: squircle;
29
35
  }
@@ -1,11 +1,11 @@
1
1
  import './../../../assets/token.css.ts.vanilla-B3LtFaO7.css';
2
2
  import './../../../assets/theme.css.ts.vanilla-Bjn8sb_B.css';
3
- import './../../../assets/global.css.ts.vanilla-CTwjHiaM.css';
3
+ import './../../../assets/global.css.ts.vanilla-C6UQbnfq.css';
4
4
  import './../../../assets/index.css.ts.vanilla-9qGDrdgn.css';
5
5
  import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
6
6
 
7
7
  var ButtonAfterStyle = '_1cabe9m1k';
8
- var ButtonStyle = createRuntimeFn({defaultClassName:'_1cabe9mq',variantClassNames:{color:{'default':'_1cabe9mr',primary:'_1cabe9ms',success:'_1cabe9mt',warning:'_1cabe9mu',danger:'_1cabe9mv'},variant:{primary:'_1cabe9mw',secondary:'_1cabe9mx',tertiary:'_1cabe9my'},size:{small:'_1cabe9mz',medium:'_1cabe9m10',large:'_1cabe9m11'},shape:{rounded:'_1cabe9m12 _7t9dxb5',circular:'_1cabe9m13 _7t9dxb6'},block:{true:'_1cabe9m14'}},defaultVariants:{},compoundVariants:[[{variant:'primary',color:'default'},'_1cabe9m15'],[{variant:'primary',color:'primary'},'_1cabe9m16'],[{variant:'primary',color:'success'},'_1cabe9m17'],[{variant:'primary',color:'warning'},'_1cabe9m18'],[{variant:'primary',color:'danger'},'_1cabe9m19'],[{variant:'secondary',color:'default'},'_1cabe9m1a'],[{variant:'secondary',color:'primary'},'_1cabe9m1b'],[{variant:'secondary',color:'success'},'_1cabe9m1c'],[{variant:'secondary',color:'warning'},'_1cabe9m1d'],[{variant:'secondary',color:'danger'},'_1cabe9m1e'],[{variant:'tertiary',color:'default'},'_1cabe9m1f'],[{variant:'tertiary',color:'primary'},'_1cabe9m1g'],[{variant:'tertiary',color:'success'},'_1cabe9m1h'],[{variant:'tertiary',color:'warning'},'_1cabe9m1i'],[{variant:'tertiary',color:'danger'},'_1cabe9m1j']]});
8
+ var ButtonStyle = createRuntimeFn({defaultClassName:'_1cabe9mq',variantClassNames:{color:{'default':'_1cabe9mr',primary:'_1cabe9ms',success:'_1cabe9mt',warning:'_1cabe9mu',danger:'_1cabe9mv'},variant:{primary:'_1cabe9mw',secondary:'_1cabe9mx',tertiary:'_1cabe9my'},size:{small:'_1cabe9mz',medium:'_1cabe9m10',large:'_1cabe9m11'},shape:{rounded:'_1cabe9m12 _7t9dxb7',circular:'_1cabe9m13 _7t9dxb8'},block:{true:'_1cabe9m14'}},defaultVariants:{},compoundVariants:[[{variant:'primary',color:'default'},'_1cabe9m15'],[{variant:'primary',color:'primary'},'_1cabe9m16'],[{variant:'primary',color:'success'},'_1cabe9m17'],[{variant:'primary',color:'warning'},'_1cabe9m18'],[{variant:'primary',color:'danger'},'_1cabe9m19'],[{variant:'secondary',color:'default'},'_1cabe9m1a'],[{variant:'secondary',color:'primary'},'_1cabe9m1b'],[{variant:'secondary',color:'success'},'_1cabe9m1c'],[{variant:'secondary',color:'warning'},'_1cabe9m1d'],[{variant:'secondary',color:'danger'},'_1cabe9m1e'],[{variant:'tertiary',color:'default'},'_1cabe9m1f'],[{variant:'tertiary',color:'primary'},'_1cabe9m1g'],[{variant:'tertiary',color:'success'},'_1cabe9m1h'],[{variant:'tertiary',color:'warning'},'_1cabe9m1i'],[{variant:'tertiary',color:'danger'},'_1cabe9m1j']]});
9
9
  var IconButtonStyle = '_1cabe9m1l';
10
10
  var InteractiveStyle = '_1cabe9mp';
11
11
  var LinkButtonStyle = '_1cabe9m1m';
@@ -1,12 +1,12 @@
1
1
  import './../../../assets/token.css.ts.vanilla-B3LtFaO7.css';
2
2
  import './../../../assets/theme.css.ts.vanilla-Bjn8sb_B.css';
3
- import './../../../assets/global.css.ts.vanilla-CTwjHiaM.css';
3
+ import './../../../assets/global.css.ts.vanilla-C6UQbnfq.css';
4
4
  import './../../../assets/index.css.ts.vanilla-kgyRRvgH.css';
5
5
  import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
6
6
 
7
7
  var InputAfterStyle = '_6iao7kr';
8
8
  var InputBeforeStyle = '_6iao7kq';
9
- var InputStyle = createRuntimeFn({defaultClassName:'_6iao7kk _7t9dxb5',variantClassNames:{variant:{primary:'_6iao7kl',secondary:'_6iao7km'},size:{small:'_6iao7kn',medium:'_6iao7ko',large:'_6iao7kp'}},defaultVariants:{},compoundVariants:[]});
9
+ var InputStyle = createRuntimeFn({defaultClassName:'_6iao7kk _7t9dxb7',variantClassNames:{variant:{primary:'_6iao7kl',secondary:'_6iao7km'},size:{small:'_6iao7kn',medium:'_6iao7ko',large:'_6iao7kp'}},defaultVariants:{},compoundVariants:[]});
10
10
  var SearchInputBeforeStyle = '_6iao7ks';
11
11
 
12
12
  export { InputAfterStyle, InputBeforeStyle, InputStyle, SearchInputBeforeStyle };
@@ -1,15 +1,22 @@
1
1
  'use strict';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { use } from 'react';
2
4
  import { createPortal } from 'react-dom';
5
+ import { ThemeContext } from '../../theme/ThemeContext.js';
3
6
 
4
7
  function Portal(props) {
5
8
  let { container } = props;
9
+ const scope = use(ThemeContext);
6
10
  if (!container && typeof document !== "undefined") {
7
11
  container = document.body;
8
12
  }
9
13
  if (!container) {
10
14
  return null;
11
15
  }
12
- return createPortal(props.children, container);
16
+ return createPortal(
17
+ scope === null ? props.children : /* @__PURE__ */ jsx("div", { className: scope.className, style: { display: "contents" }, children: props.children }),
18
+ container
19
+ );
13
20
  }
14
21
 
15
22
  export { Portal };
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.js","sources":["../../../src/component/popover/Portal.tsx"],"sourcesContent":["import { createPortal } from 'react-dom'\n\nexport interface PortalProps extends React.PropsWithChildren {\n container?: Element | DocumentFragment | null | undefined\n}\n\nexport function Portal(props: PortalProps) {\n let { container } = props\n\n if (!container && typeof document !== 'undefined') {\n container = document.body\n }\n\n if (!container) {\n return null\n }\n\n return createPortal(props.children, container)\n}\n"],"names":[],"mappings":";;;AAMO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB;AACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA;AAEpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,WAAA,CAAA,CAAa;AACjD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACvB;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW;AACd,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,YAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,SAAS,CAAA;AAC/C;;"}
1
+ {"version":3,"file":"Portal.js","sources":["../../../src/component/popover/Portal.tsx"],"sourcesContent":["import { ThemeContext } from '#theme'\nimport { use } from 'react'\nimport { createPortal } from 'react-dom'\n\nexport interface PortalProps extends React.PropsWithChildren {\n container?: Element | DocumentFragment | null | undefined\n}\n\nexport function Portal(props: PortalProps) {\n let { container } = props\n\n // Portaled content leaves the themed root, so re-establish the active\n // 'ThemeContext' scope around it here rather than in\n // 'usePopover'/'useTooltip'/'useDialog': those hooks only produce props\n // for the positioned element, and merging the scope classes onto that\n // element would compete with the overlay's own surface styles in the\n // cascade.\n const scope = use(ThemeContext)\n\n if (!container && typeof document !== 'undefined') {\n container = document.body\n }\n\n if (!container) {\n return null\n }\n\n return createPortal(\n scope === null ? (\n props.children\n ) : (\n <div className={scope.className} style={{ display: 'contents' }}>\n {props.children}\n </div>\n ),\n container\n )\n}\n"],"names":[],"mappings":";;;;;;AAQO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB;AACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA;AAQpB,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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AA,CAAA,CAAA,CAAA,GAAO,CAAA,CAAE,OAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAC3D,gBAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EACT,CAAA;AAAA,CAAA,CAAA,CAAA,CAEF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CACF;AACF;;"}
@@ -1,13 +1,13 @@
1
1
  import './../../../assets/token.css.ts.vanilla-B3LtFaO7.css';
2
2
  import './../../../assets/theme.css.ts.vanilla-Bjn8sb_B.css';
3
- import './../../../assets/global.css.ts.vanilla-CTwjHiaM.css';
3
+ import './../../../assets/global.css.ts.vanilla-C6UQbnfq.css';
4
4
  import './../../../assets/index.css.ts.vanilla-CvQQLJ-M.css';
5
5
  import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
6
6
 
7
- var DialogStyle = createRuntimeFn({defaultClassName:'_1b443hhi _7t9dxb5',variantClassNames:{size:{auto:'_1b443hhj',stretch:'_1b443hhk',small:'_1b443hhl',medium:'_1b443hhm',large:'_1b443hhn'}},defaultVariants:{},compoundVariants:[]});
8
- var PopoverStyle = createRuntimeFn({defaultClassName:'_1b443hho _7t9dxb5',variantClassNames:{position:{above:'_1b443hhp','above-start':'_1b443hhq','above-end':'_1b443hhr',below:'_1b443hhs','below-start':'_1b443hht','below-end':'_1b443hhu',before:'_1b443hhv','before-start':'_1b443hhw','before-end':'_1b443hhx',after:'_1b443hhy','after-start':'_1b443hhz','after-end':'_1b443hh10'}},defaultVariants:{},compoundVariants:[]});
7
+ var DialogStyle = createRuntimeFn({defaultClassName:'_1b443hhi _7t9dxb7',variantClassNames:{size:{auto:'_1b443hhj',stretch:'_1b443hhk',small:'_1b443hhl',medium:'_1b443hhm',large:'_1b443hhn'}},defaultVariants:{},compoundVariants:[]});
8
+ var PopoverStyle = createRuntimeFn({defaultClassName:'_1b443hho _7t9dxb7',variantClassNames:{position:{above:'_1b443hhp','above-start':'_1b443hhq','above-end':'_1b443hhr',below:'_1b443hhs','below-start':'_1b443hht','below-end':'_1b443hhu',before:'_1b443hhv','before-start':'_1b443hhw','before-end':'_1b443hhx',after:'_1b443hhy','after-start':'_1b443hhz','after-end':'_1b443hh10'}},defaultVariants:{},compoundVariants:[]});
9
9
  var TooltipArrowStyle = createRuntimeFn({defaultClassName:'_1b443hh12',variantClassNames:{axis:{block:'_1b443hh13',inline:'_1b443hh14'}},defaultVariants:{},compoundVariants:[]});
10
- var TooltipStyle = '_1b443hh11 _7t9dxb5';
10
+ var TooltipStyle = '_1b443hh11 _7t9dxb7';
11
11
 
12
12
  export { DialogStyle, PopoverStyle, TooltipArrowStyle, TooltipStyle };
13
13
  //# sourceMappingURL=index.css.js.map
@@ -1,6 +1,6 @@
1
1
  import './../../../assets/token.css.ts.vanilla-B3LtFaO7.css';
2
2
  import './../../../assets/theme.css.ts.vanilla-Bjn8sb_B.css';
3
- import './../../../assets/global.css.ts.vanilla-CTwjHiaM.css';
3
+ import './../../../assets/global.css.ts.vanilla-C6UQbnfq.css';
4
4
  import './../../../assets/index.css.ts.vanilla-C_RzxiYH.css';
5
5
  import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
6
6
 
@@ -12,7 +12,7 @@ var ItemAfterStyle = '_1asxz9rq';
12
12
  var ItemBeforeStyle = '_1asxz9rp';
13
13
  var ItemContentStyle = '_1asxz9ro';
14
14
  var ItemIconStyle = '_1asxz9rr';
15
- var ItemStyle = createRuntimeFn({defaultClassName:'_1asxz9rm _7t9dxb5',variantClassNames:{danger:{true:'_1asxz9rn'}},defaultVariants:{},compoundVariants:[]});
15
+ var ItemStyle = createRuntimeFn({defaultClassName:'_1asxz9rm _7t9dxb7',variantClassNames:{danger:{true:'_1asxz9rn'}},defaultVariants:{},compoundVariants:[]});
16
16
  var ListStyle = '_1asxz9rl';
17
17
  var SeparatorStyle = '_1asxz9rs';
18
18
 
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export * from '@opentelemetry/semantic-conventions';
3
3
  export { ATTR_EXCEPTION_CAUSE, logger } from './infra/logging/logger.js';
4
4
  export { AbortError, NetworkError, NotFoundError, NotSupportedError, TimeoutError } from './util/document/error.js';
5
- export { ActiveSelector, CircleStyle, DarkColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, SquircleStyle, radiusVar, stretch } from './theme/global.css.js';
5
+ export { ActiveSelector, CircleStyle, DarkColorScheme, DarkLightColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, LightDarkColorScheme, SquircleStyle, radiusVar, stretch } from './theme/global.css.js';
6
6
  export { AggregationTemporality, ConsoleMetricExporter, InMemoryMetricExporter, MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
7
7
  export { ArticleStyle } from './component/style/article.css.js';
8
8
  export { AutoComplete } from './component/select/AutoComplete.js';
@@ -60,6 +60,8 @@ export { ShadowRoot } from './component/popover/ShadowRoot.js';
60
60
  export { SpanStatusCode } from '@opentelemetry/api';
61
61
  export { Spinner } from './component/progress/Spinner.js';
62
62
  export { Switch } from './component/checkbox/Switch.js';
63
+ export { ThemeContext } from './theme/ThemeContext.js';
64
+ export { ThemeProvider } from './theme/ThemeProvider.js';
63
65
  export { Tooltip } from './component/popover/Tooltip.js';
64
66
  export { TreeNode } from './util/tree/node.js';
65
67
  export { VirtualActive, VirtualActiveSelector, VirtualDisabled, VirtualDisabledSelector, VirtualFocus, VirtualFocusSelector } from './util/document/accessibility.css.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ import { createContext } from 'react';
3
+
4
+ const ThemeContext = createContext(null);
5
+ ThemeContext.displayName = "ThemeContext";
6
+
7
+ export { ThemeContext };
8
+ //# sourceMappingURL=ThemeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.js","sources":["../../src/theme/ThemeContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\n/**\n * @internal\n */\nexport interface ThemeContext {\n className: string\n}\n\n/**\n * @internal\n */\nexport const ThemeContext = createContext<ThemeContext | null>(null)\n\nThemeContext.displayName = 'ThemeContext'\n"],"names":[],"mappings":";;;AAYO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAmC,CAAA,CAAA,CAAA,CAAI,CAAA;AAEnE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import { ThemeContext } from './ThemeContext.js';
5
+ import { GlobalContainerStyle, LightColorScheme, DarkColorScheme, DarkLightColorScheme } from './global.css.js';
6
+
7
+ function ThemeProvider(props) {
8
+ const { colorScheme = "auto", children } = props;
9
+ const className = clsx(
10
+ GlobalContainerStyle,
11
+ colorScheme === "light" && LightColorScheme,
12
+ colorScheme === "dark" && DarkColorScheme,
13
+ colorScheme === "dark light" && DarkLightColorScheme
14
+ );
15
+ return /* @__PURE__ */ jsx(ThemeContext, { value: { className }, children });
16
+ }
17
+
18
+ export { ThemeProvider };
19
+ //# sourceMappingURL=ThemeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../src/theme/ThemeProvider.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport type { ColorScheme } from './ColorScheme'\nimport { ThemeContext } from './ThemeContext'\nimport {\n DarkColorScheme,\n DarkLightColorScheme,\n GlobalContainerStyle,\n LightColorScheme,\n} from './global.css'\n\nexport interface ThemeProviderProps extends React.PropsWithChildren {\n colorScheme?: ColorScheme | undefined\n}\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n const { colorScheme = 'auto', children } = props\n\n const className = clsx(\n GlobalContainerStyle,\n colorScheme === 'light' && LightColorScheme,\n colorScheme === 'dark' && DarkColorScheme,\n colorScheme === 'dark light' && DarkLightColorScheme\n )\n\n return <ThemeContext value={{ className }}>{children}</ThemeContext>\n}\n"],"names":[],"mappings":";;;;;;AAcO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B;AACvD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAClC;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAS,CAAA;AACvD;;"}
@@ -1,18 +1,20 @@
1
1
  import './../assets/token.css.ts.vanilla-B3LtFaO7.css';
2
2
  import './../assets/theme.css.ts.vanilla-Bjn8sb_B.css';
3
- import './../assets/global.css.ts.vanilla-CTwjHiaM.css';
3
+ import './../assets/global.css.ts.vanilla-C6UQbnfq.css';
4
4
 
5
5
  var ActiveSelector = ':is(:active, [data-active-_19byneq1="true"])';
6
- var CircleStyle = '_7t9dxb6';
6
+ var CircleStyle = '_7t9dxb8';
7
7
  var DarkColorScheme = '_7t9dxb4';
8
+ var DarkLightColorScheme = '_7t9dxb6';
8
9
  var DisabledSelector = ':is(:disabled, [aria-disabled="true"])';
9
10
  var FocusSelector = ':where(:focus-visible, [data-focus-visible-_19byneq0="true"])';
10
11
  var GlobalContainerStyle = '_7t9dxb2 _1ajkdfx0 _15shvv40';
11
12
  var HighlightName = 'highlight-_7t9dxb1';
12
13
  var LightColorScheme = '_7t9dxb3';
13
- var SquircleStyle = '_7t9dxb5';
14
+ var LightDarkColorScheme = '_7t9dxb5';
15
+ var SquircleStyle = '_7t9dxb7';
14
16
  var radiusVar = 'var(--_7t9dxb0)';
15
17
  var stretch = ['-webkit-fill-available','stretch'];
16
18
 
17
- export { ActiveSelector, CircleStyle, DarkColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, SquircleStyle, radiusVar, stretch };
19
+ export { ActiveSelector, CircleStyle, DarkColorScheme, DarkLightColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, LightDarkColorScheme, SquircleStyle, radiusVar, stretch };
18
20
  //# sourceMappingURL=global.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"global.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -2,9 +2,11 @@
2
2
  export { ColorScheme } from './ColorScheme.js';
3
3
  export { defineTheme } from './defineTheme.js';
4
4
  export { BASE_COLOR, TRANSPARENT, complement, contrastColor, contrastRatio, mix, opacity, palette, rgbaToRgb, shade, tint, tone } from './palette.js';
5
+ export { ThemeContext } from './ThemeContext.js';
6
+ export { ThemeProvider } from './ThemeProvider.js';
5
7
  export { typography } from './typography.js';
6
8
  export { useSystemColorScheme } from './useSystemColorScheme.js';
7
9
  export { token, tokenClass } from './token.css.js';
8
10
  export { theme, themeClass } from './theme.css.js';
9
- export { ActiveSelector, CircleStyle, DarkColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, SquircleStyle, radiusVar, stretch } from './global.css.js';
11
+ export { ActiveSelector, CircleStyle, DarkColorScheme, DarkLightColorScheme, DisabledSelector, FocusSelector, GlobalContainerStyle, HighlightName, LightColorScheme, LightDarkColorScheme, SquircleStyle, radiusVar, stretch } from './global.css.js';
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiplet",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "React component, hook, and utility library.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,5 @@
1
+ import { ThemeContext } from '#theme'
2
+ import { use } from 'react'
1
3
  import { createPortal } from 'react-dom'
2
4
 
3
5
  export interface PortalProps extends React.PropsWithChildren {
@@ -7,6 +9,14 @@ export interface PortalProps extends React.PropsWithChildren {
7
9
  export function Portal(props: PortalProps) {
8
10
  let { container } = props
9
11
 
12
+ // Portaled content leaves the themed root, so re-establish the active
13
+ // 'ThemeContext' scope around it here rather than in
14
+ // 'usePopover'/'useTooltip'/'useDialog': those hooks only produce props
15
+ // for the positioned element, and merging the scope classes onto that
16
+ // element would compete with the overlay's own surface styles in the
17
+ // cascade.
18
+ const scope = use(ThemeContext)
19
+
10
20
  if (!container && typeof document !== 'undefined') {
11
21
  container = document.body
12
22
  }
@@ -15,5 +25,14 @@ export function Portal(props: PortalProps) {
15
25
  return null
16
26
  }
17
27
 
18
- return createPortal(props.children, container)
28
+ return createPortal(
29
+ scope === null ? (
30
+ props.children
31
+ ) : (
32
+ <div className={scope.className} style={{ display: 'contents' }}>
33
+ {props.children}
34
+ </div>
35
+ ),
36
+ container
37
+ )
19
38
  }
@@ -0,0 +1,15 @@
1
+ import { createContext } from 'react'
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ export interface ThemeContext {
7
+ className: string
8
+ }
9
+
10
+ /**
11
+ * @internal
12
+ */
13
+ export const ThemeContext = createContext<ThemeContext | null>(null)
14
+
15
+ ThemeContext.displayName = 'ThemeContext'
@@ -0,0 +1,26 @@
1
+ import clsx from 'clsx'
2
+ import type { ColorScheme } from './ColorScheme'
3
+ import { ThemeContext } from './ThemeContext'
4
+ import {
5
+ DarkColorScheme,
6
+ DarkLightColorScheme,
7
+ GlobalContainerStyle,
8
+ LightColorScheme,
9
+ } from './global.css'
10
+
11
+ export interface ThemeProviderProps extends React.PropsWithChildren {
12
+ colorScheme?: ColorScheme | undefined
13
+ }
14
+
15
+ export function ThemeProvider(props: ThemeProviderProps) {
16
+ const { colorScheme = 'auto', children } = props
17
+
18
+ const className = clsx(
19
+ GlobalContainerStyle,
20
+ colorScheme === 'light' && LightColorScheme,
21
+ colorScheme === 'dark' && DarkColorScheme,
22
+ colorScheme === 'dark light' && DarkLightColorScheme
23
+ )
24
+
25
+ return <ThemeContext value={{ className }}>{children}</ThemeContext>
26
+ }
@@ -37,7 +37,10 @@ export const GlobalContainerStyle = style([
37
37
  font: theme.body2,
38
38
  WebkitFontSmoothing: 'antialiased',
39
39
  color: theme.color,
40
- colorScheme: 'light dark', // https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark
40
+ // Enables 'light-dark()' in the theme tokens; it resolves only with an
41
+ // explicit 'color-scheme'.
42
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark
43
+ colorScheme: 'light dark',
41
44
  background: theme.paper.background,
42
45
  },
43
46
  ])
@@ -54,6 +57,16 @@ export const DarkColorScheme = style({
54
57
  colorScheme: 'dark',
55
58
  })
56
59
 
60
+ // Standalone 'light dark' opt-in for containers that do not carry
61
+ // 'GlobalContainerStyle'.
62
+ export const LightDarkColorScheme = style({
63
+ colorScheme: 'light dark',
64
+ })
65
+
66
+ export const DarkLightColorScheme = style({
67
+ colorScheme: 'dark light',
68
+ })
69
+
57
70
  export const SquircleStyle = style({
58
71
  borderRadius: radiusVar,
59
72
  '@supports': {
@@ -4,6 +4,10 @@ export * from './defineTheme'
4
4
 
5
5
  export * from './palette'
6
6
 
7
+ export * from './ThemeContext'
8
+
9
+ export * from './ThemeProvider'
10
+
7
11
  export * from './typography'
8
12
 
9
13
  export * from './useSystemColorScheme'