@hanzo/ui 8.4.10 → 8.4.12
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.
- package/dist/box.cjs +21 -1
- package/dist/box.d.ts.map +1 -1
- package/dist/box.js +21 -1
- package/dist/box.js.map +1 -1
- package/dist/gallery.html +1 -1
- package/dist/index.node.js +65 -0
- package/dist/root.node.js +98 -0
- package/package.json +2 -1
package/dist/box.cjs
CHANGED
|
@@ -39,6 +39,21 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
39
39
|
const react_1 = require("react");
|
|
40
40
|
const gui_1 = require("@hanzo/gui");
|
|
41
41
|
const tw_1 = require("./tw.cjs");
|
|
42
|
+
/**
|
|
43
|
+
* The display each element has before any class touches it.
|
|
44
|
+
*
|
|
45
|
+
* Box stated `block` for everything, which is the div's answer and wrong for the
|
|
46
|
+
* inline ones: a converted `<a>` became a full-width block, so two links that had
|
|
47
|
+
* sat side by side in a sentence stacked and the footer grew from 47px to 112px.
|
|
48
|
+
* Anything absent here is `block`, which is right for div, p, section, the
|
|
49
|
+
* headings, the lists and the landmarks.
|
|
50
|
+
*
|
|
51
|
+
* A class still wins — `flex` says flex, and silence says whatever the element
|
|
52
|
+
* already was.
|
|
53
|
+
*/
|
|
54
|
+
const INLINE = new Set(['a', 'span', 'em', 'strong', 'b', 'i', 'u', 's', 'small',
|
|
55
|
+
'abbr', 'cite', 'code', 'kbd', 'samp', 'var', 'sub', 'sup', 'mark', 'q', 'time',
|
|
56
|
+
'label', 'output', 'bdi', 'bdo', 'ruby', 'wbr']);
|
|
42
57
|
/** Properties a frame ignores and a DOM element passes to its children. */
|
|
43
58
|
const TEXT_PROPS = ['fontSize', 'lineHeight', 'fontWeight', 'letterSpacing',
|
|
44
59
|
'textTransform', 'fontFamily', 'fontStyle', 'textAlign', 'color',
|
|
@@ -76,12 +91,17 @@ const BoxInner = (0, react_1.forwardRef)(function Box({ className, children, 'ar
|
|
|
76
91
|
// class said otherwise, so `leading-relaxed` still wins.
|
|
77
92
|
if (!('lineHeight' in text))
|
|
78
93
|
text.lineHeight = 'inherit';
|
|
94
|
+
// A list item needs `display: list-item` or it loses its marker, and gui's
|
|
95
|
+
// display prop has no such value — its set is block/contents/flex/inline/…
|
|
96
|
+
// So it rides as a plain style, where it also outranks the class gui emits.
|
|
97
|
+
if (tag === 'li' && !('display' in props))
|
|
98
|
+
text.display = 'list-item';
|
|
79
99
|
const style = Object.keys(text).length
|
|
80
100
|
? { ...text, ...rest.style }
|
|
81
101
|
: rest.style;
|
|
82
102
|
// Explicit props win: a caller who states a value directly means it, and the
|
|
83
103
|
// classes are what they are migrating away from.
|
|
84
|
-
const frame = ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ref: tag ? undefined : ref, asChild: tag ? true : undefined, display:
|
|
104
|
+
const frame = ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ref: tag ? undefined : ref, asChild: tag ? true : undefined, display: tag && INLINE.has(tag) ? 'inline' : 'block',
|
|
85
105
|
// A View does not shrink; a div does. Left at the View's default, every
|
|
86
106
|
// converted flex child held its full basis and overflowed its row instead
|
|
87
107
|
// of sharing it — two half-width columns came out 608px each in a 1216px
|
package/dist/box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../src/box.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAM,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../src/box.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAA6B,KAAK,SAAS,EAAE,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,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAAE,KAC1C,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;eAEf,GAAG"}
|
package/dist/box.js
CHANGED
|
@@ -36,6 +36,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
36
36
|
import { createElement, forwardRef } from 'react';
|
|
37
37
|
import { YStack } from '@hanzo/gui';
|
|
38
38
|
import { tw } from './tw.js';
|
|
39
|
+
/**
|
|
40
|
+
* The display each element has before any class touches it.
|
|
41
|
+
*
|
|
42
|
+
* Box stated `block` for everything, which is the div's answer and wrong for the
|
|
43
|
+
* inline ones: a converted `<a>` became a full-width block, so two links that had
|
|
44
|
+
* sat side by side in a sentence stacked and the footer grew from 47px to 112px.
|
|
45
|
+
* Anything absent here is `block`, which is right for div, p, section, the
|
|
46
|
+
* headings, the lists and the landmarks.
|
|
47
|
+
*
|
|
48
|
+
* A class still wins — `flex` says flex, and silence says whatever the element
|
|
49
|
+
* already was.
|
|
50
|
+
*/
|
|
51
|
+
const INLINE = new Set(['a', 'span', 'em', 'strong', 'b', 'i', 'u', 's', 'small',
|
|
52
|
+
'abbr', 'cite', 'code', 'kbd', 'samp', 'var', 'sub', 'sup', 'mark', 'q', 'time',
|
|
53
|
+
'label', 'output', 'bdi', 'bdo', 'ruby', 'wbr']);
|
|
39
54
|
/** Properties a frame ignores and a DOM element passes to its children. */
|
|
40
55
|
const TEXT_PROPS = ['fontSize', 'lineHeight', 'fontWeight', 'letterSpacing',
|
|
41
56
|
'textTransform', 'fontFamily', 'fontStyle', 'textAlign', 'color',
|
|
@@ -73,12 +88,17 @@ const BoxInner = forwardRef(function Box({ className, children, 'aria-hidden': h
|
|
|
73
88
|
// class said otherwise, so `leading-relaxed` still wins.
|
|
74
89
|
if (!('lineHeight' in text))
|
|
75
90
|
text.lineHeight = 'inherit';
|
|
91
|
+
// A list item needs `display: list-item` or it loses its marker, and gui's
|
|
92
|
+
// display prop has no such value — its set is block/contents/flex/inline/…
|
|
93
|
+
// So it rides as a plain style, where it also outranks the class gui emits.
|
|
94
|
+
if (tag === 'li' && !('display' in props))
|
|
95
|
+
text.display = 'list-item';
|
|
76
96
|
const style = Object.keys(text).length
|
|
77
97
|
? { ...text, ...rest.style }
|
|
78
98
|
: rest.style;
|
|
79
99
|
// Explicit props win: a caller who states a value directly means it, and the
|
|
80
100
|
// classes are what they are migrating away from.
|
|
81
|
-
const frame = (_jsx(YStack, { ref: tag ? undefined : ref, asChild: tag ? true : undefined, display:
|
|
101
|
+
const frame = (_jsx(YStack, { ref: tag ? undefined : ref, asChild: tag ? true : undefined, display: tag && INLINE.has(tag) ? 'inline' : 'block',
|
|
82
102
|
// A View does not shrink; a div does. Left at the View's default, every
|
|
83
103
|
// converted flex child held its full basis and overflowed its row instead
|
|
84
104
|
// of sharing it — two half-width columns came out 608px each in a 1216px
|
package/dist/box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sourceRoot":"","sources":["../src/box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,EAAE,EAAmB,MAAM,MAAM,CAAA;AAE1C,2EAA2E;AAC3E,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe;IACzE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO;IAChE,oBAAoB,EAAE,YAAY;IAClC,8EAA8E;IAC9E,2EAA2E;IAC3E,4EAA4E;IAC5E,6EAA6E;IAC7E,wBAAwB;IACxB,oBAAoB,CAAU,CAAA;AAoDhC,MAAM,QAAQ,GAAG,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M,IACL,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAC1B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC/B,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;QACpD,wEAAwE;QACxE,0EAA0E;QAC1E,yEAAyE;QACzE,gEAAgE;QAChE,2EAA2E;QAC3E,2EAA2E;QAC3E,MAAM,EAAE,CAAC,iBACI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,KACjF,KAAgB,KAIjB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,IAAe,CAAC,EACjC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,IAAI,SAAS,EAChD,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,YAK7B,GAAG;YACF,CAAC,CAAC,aAAa,CACX,GAAG,EACH,EAAE,GAAI,IAAe,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,IAAI,SAAS,EAAE,KAAK,EAAE,EACnE,QAAQ,CACT;YACH,CAAC,CAAC,QAAQ,GACL,CACV,CAAA;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,QAEW,CAAA;AAE9B,eAAe,GAAG,CAAA"}
|
package/dist/gallery.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.4.
|
|
1
|
+
<!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.4.12</title><style>/* @hanzo/ui — generated by scripts/gen-css.mjs. Do not edit. */
|
|
2
2
|
:root { --hanzo-ui-styles: 1; }
|
|
3
3
|
/* Hanzo Design System — the entry point. Import THIS one file.
|
|
4
4
|
*
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @hanzo/ui — the one Hanzo component library, on @hanzo/gui + @hanzo/design.
|
|
2
|
+
//
|
|
3
|
+
// ONE substrate: every component renders through @hanzo/gui primitives, so the
|
|
4
|
+
// same import works on web, native (expo) and desktop (Tauri). The ROOT barrel is
|
|
5
|
+
// the canonical component API apps import; the product layer and the design
|
|
6
|
+
// tokens are their own subpaths, so importing a Button never drags in a chart.
|
|
7
|
+
//
|
|
8
|
+
// import { Button, Card, Dialog, DropdownMenu, Input, Toaster } from '@hanzo/ui' // component API
|
|
9
|
+
// import { PageHeader, Sparkline, EmptyState } from '@hanzo/ui/product' // product/app layer
|
|
10
|
+
// import { RecordsView, registerField } from '@hanzo/ui/data' // metadata record layer
|
|
11
|
+
// import { ModelSelector } from '@hanzo/ui/models' // unified model picker
|
|
12
|
+
// import { cn, themes, colors } from '@hanzo/ui/core' // design core + tokens
|
|
13
|
+
// import '@hanzo/ui/theme.css' // the self-contained identity
|
|
14
|
+
//
|
|
15
|
+
// Styling is theme tokens, never utility classes: `$background`, `$color12`,
|
|
16
|
+
// `$borderColor` resolve through the gui token config on every host. Touch
|
|
17
|
+
// targets meet the 44px floor via `hitSlop`, never via padding.
|
|
18
|
+
// Named, not `export *`.
|
|
19
|
+
//
|
|
20
|
+
// This module is a client boundary ('use client' above), and Next 16 refuses
|
|
21
|
+
// `export *` across one: "It's currently unsupported to use `export *` in a client
|
|
22
|
+
// boundary." Every app importing the root barrel failed to build on that one line.
|
|
23
|
+
//
|
|
24
|
+
// Naming them also restores tree-shaking, which `export *` defeats — a bundler
|
|
25
|
+
// cannot prove which members are unused through a star, so importing Button pulled
|
|
26
|
+
// the whole surface in.
|
|
27
|
+
//
|
|
28
|
+
// ./backends/gui declares these as explicit named blocks and this list mirrors it.
|
|
29
|
+
//
|
|
30
|
+
// It is maintained BY HAND — `scripts/gen-primitives.mjs` writes `src/primitives/`,
|
|
31
|
+
// not this file, so nothing regenerates it and nothing used to notice when the two
|
|
32
|
+
// drifted. Glass, Grid, Section and CardMedia were all exported by the backend and
|
|
33
|
+
// absent here, which means a consumer could not import them AT ALL: the component
|
|
34
|
+
// existed, the docs named it, and `import { Grid } from '@hanzo/ui'` was undefined.
|
|
35
|
+
// `src/__tests__/barrel.test.ts` now fails when the two disagree.
|
|
36
|
+
export { AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardMedia, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Em, Glass, Fill, H1, H2, H3, H4, H5, H6, Heading, Image, Input, Label, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Paragraph, Screen, ScrollView, Section, Separator, SizableText, Slider, Spacer, Span, Spinner, Strong, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Text, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, View, XStack, YStack, ZStack, badgeVariants, buttonVariants, toast, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, RadioGroup, RadioGroupItem, ToggleGroup, ToggleGroupItem, } from './backends/gui/index.js';
|
|
37
|
+
// LAYOUT — the stacks and the type scale reach consumers through the component
|
|
38
|
+
// barrel above, which already names XStack/YStack/ZStack, the type scale
|
|
39
|
+
// (SizableText, Paragraph, Heading, H1-H6, Span, Strong, Em) and Image, Spacer,
|
|
40
|
+
// ScrollView, View and Text. This block adds only what that one lacks.
|
|
41
|
+
//
|
|
42
|
+
// It used to repeat all twenty, and TypeScript rejects a name exported twice from
|
|
43
|
+
// one module: `error TS2300: Duplicate identifier 'Em'` and nineteen more, so
|
|
44
|
+
// `tsc -p tsconfig.build.json` failed and @hanzo/ui could not build AT ALL. That
|
|
45
|
+
// took the whole cicd lane down with it — the test gate runs
|
|
46
|
+
// `pnpm --filter @hanzo/ui... build` first, so no test ever ran and ui.hanzo.ai
|
|
47
|
+
// could not ship.
|
|
48
|
+
//
|
|
49
|
+
// The concern the duplication came from is real and still holds: a name must be
|
|
50
|
+
// on the ROOT barrel to reach a consumer — 8.0.65 added these to the backend only
|
|
51
|
+
// and the dist still had no XStack, a green release that changed nothing. The fix
|
|
52
|
+
// for that is to name it once here, not twice.
|
|
53
|
+
export { Anchor, } from './backends/gui/index.js';
|
|
54
|
+
// `Hanzo` — the root, and the only thing an app mounts. It carries the gui
|
|
55
|
+
// config and the generated stylesheet, so `npm i @hanzo/ui` is the whole setup:
|
|
56
|
+
// no gui.config.ts, no CSS import, no generator script.
|
|
57
|
+
export { Hanzo } from './root.node.js';
|
|
58
|
+
// `cn` — the class-name composer, surfaced for convenience.
|
|
59
|
+
export { cn } from './core/cn.js';
|
|
60
|
+
// The design-token scale (colors, dark/light themes, radii, spacing, typography)
|
|
61
|
+
// lives on the `@hanzo/ui/core` / `@hanzo/ui/tokens` subpath — pure data, no
|
|
62
|
+
// runtime.
|
|
63
|
+
export { tw } from './tw.js';
|
|
64
|
+
export { Box } from './box.js';
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* `Hanzo` — the root. The only thing an app has to mount.
|
|
5
|
+
*
|
|
6
|
+
* import { Hanzo, Button } from '@hanzo/ui'
|
|
7
|
+
* <Hanzo><Button>Ship</Button></Hanzo>
|
|
8
|
+
*
|
|
9
|
+
* No config file, no CSS import, no generator script, no bundler aliases. Three
|
|
10
|
+
* things used to be the app's job and are now the package's:
|
|
11
|
+
*
|
|
12
|
+
* the config — @hanzo/gui resolves `$3` / `$background` / `$borderColor`
|
|
13
|
+
* against ONE process-global config, and @hanzo/ui owns it (gui-config.ts).
|
|
14
|
+
* It is passed here as a value, not imported for its side effect: Vite 8
|
|
15
|
+
* ignores package.json `sideEffects` ARRAYS outright, so a bare
|
|
16
|
+
* `import './gui-config.js'` is dropped and the first render dies on "Missing
|
|
17
|
+
* hanzogui config". A value a rendered component needs cannot be shaken out.
|
|
18
|
+
*
|
|
19
|
+
* the stylesheet — `styles.css` is generated at OUR publish time by rendering
|
|
20
|
+
* every component and harvesting the atomic CSS that render produces
|
|
21
|
+
* (scripts/gen-css.mjs). It used to be each app's job to run a generator and
|
|
22
|
+
* import its output; hanzo.app never did, and shipped 103 `_bg-` classes
|
|
23
|
+
* against zero `_bg-` rules with a green build the whole time.
|
|
24
|
+
*
|
|
25
|
+
* the theme — gui throws "Missing theme." for any component without a root
|
|
26
|
+
* theme context, so there is no version of this that works with no root at
|
|
27
|
+
* all. Dark-first, matching the Hanzo identity.
|
|
28
|
+
*
|
|
29
|
+
* `disableInjectCSS` because the sheet is a real file. Left on, the provider
|
|
30
|
+
* inlines `config.getCSS()` into the document on every streaming flush — that is
|
|
31
|
+
* how hanzo.ai once shipped thirteen byte-identical copies, 591,305 of its
|
|
32
|
+
* 638,443 bytes. A file is cached once and costs nothing after the first page.
|
|
33
|
+
* Styles gui generates at runtime for props we could not know at publish time
|
|
34
|
+
* still reach the document: that path is `insertStyleRules`, and it is not what
|
|
35
|
+
* this flag controls.
|
|
36
|
+
*/
|
|
37
|
+
import { GuiProvider } from '@hanzo/gui';
|
|
38
|
+
import { TelemetryProvider } from '@hanzogui/telemetry';
|
|
39
|
+
import { useEffect } from 'react';
|
|
40
|
+
import { apply, read } from '@hanzo/appearance/state';
|
|
41
|
+
import { config } from './gui-config.js';
|
|
42
|
+
// styles.css is omitted from the node entry: node cannot load a stylesheet.
|
|
43
|
+
/** A stylesheet that did not reach the document is invisible until someone opens
|
|
44
|
+
* production. `styles.css` declares `--hanzo-ui-styles`, so the check is one
|
|
45
|
+
* lookup, it runs once, and it names the fix. Development only.
|
|
46
|
+
*
|
|
47
|
+
* Only a sheet with an OWNER ELEMENT counts. A bundler that processed the CSS
|
|
48
|
+
* emits a `<link>` or a `<style>`; jsdom loads no CSS at all, so a document
|
|
49
|
+
* with no such element cannot answer the question and must not be asked —
|
|
50
|
+
* throwing there breaks every consumer's unit tests to report a condition that
|
|
51
|
+
* cannot exist. Counting SHEETS instead of elements is what made that happen:
|
|
52
|
+
* the gui runtime inserts its own ownerless sheet while this module is being
|
|
53
|
+
* imported, so by first render jsdom was never empty and every jest consumer
|
|
54
|
+
* rendering `<Hanzo>` threw. */
|
|
55
|
+
let checked = false;
|
|
56
|
+
const styled = () => [...document.styleSheets].some((s) => s.ownerNode);
|
|
57
|
+
const assertStylesheet = () => {
|
|
58
|
+
if (checked || typeof document === 'undefined' || !styled())
|
|
59
|
+
return;
|
|
60
|
+
checked = true;
|
|
61
|
+
if (getComputedStyle(document.documentElement).getPropertyValue('--hanzo-ui-styles').trim())
|
|
62
|
+
return;
|
|
63
|
+
throw new Error('@hanzo/ui: styles.css did not reach the document. <Hanzo> imports it, so a bundler ' +
|
|
64
|
+
'that does not process CSS imported from node_modules has dropped it. Import it ' +
|
|
65
|
+
"directly instead: import '@hanzo/ui/styles.css'.");
|
|
66
|
+
};
|
|
67
|
+
export const Hanzo = ({ children, theme = 'dark', analytics }) => {
|
|
68
|
+
if (process.env.NODE_ENV !== 'production')
|
|
69
|
+
assertStylesheet();
|
|
70
|
+
// A person's stored type size, density and accent, put on the document.
|
|
71
|
+
//
|
|
72
|
+
// Unconditional, unlike `analytics`, and the difference is the whole reason
|
|
73
|
+
// that one is a prop. Analytics starts a conversation with a server the app
|
|
74
|
+
// did not ask for; this reads a preference the PERSON already set on this
|
|
75
|
+
// device and honours it. An app that has to opt in is an app that forgets to,
|
|
76
|
+
// and then the setting silently does nothing on that surface — which is worse
|
|
77
|
+
// than not offering it.
|
|
78
|
+
//
|
|
79
|
+
// Costs nothing when unused: an axis nobody set is absent rather than
|
|
80
|
+
// neutral, so `apply()` removes the property instead of stamping a `1` that
|
|
81
|
+
// would outrank a brand's own scale.
|
|
82
|
+
//
|
|
83
|
+
// This is the MOUNT half only. First paint still wants `bootScript()` in
|
|
84
|
+
// <head>, because no component can run before the document exists.
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
apply(read());
|
|
87
|
+
}, []);
|
|
88
|
+
const tree = (_jsx(GuiProvider, { config: config, defaultTheme: theme, disableInjectCSS: true, children: children }));
|
|
89
|
+
// OUTSIDE the gui provider: capture is delegated at the document, so it does
|
|
90
|
+
// not need to be inside the styled tree, and an app that renders its own
|
|
91
|
+
// `<TelemetryProvider/>` above `<Hanzo>` then nests two providers of the same
|
|
92
|
+
// kind rather than interleaving them with the theme.
|
|
93
|
+
if (!analytics)
|
|
94
|
+
return tree;
|
|
95
|
+
return _jsx(TelemetryProvider, { ...(analytics === true ? {} : analytics), children: tree });
|
|
96
|
+
};
|
|
97
|
+
export default Hanzo;
|
|
98
|
+
//# sourceMappingURL=root.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Hanzo UI — the one canonical Hanzo component library, on @hanzo/gui + @hanzo/design. ONE substrate: every component renders through @hanzo/gui primitives, so the same import works on web, native (expo) and desktop (Tauri). Self-contained (theme.css), presentational, host-agnostic, clean-room.",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"node": "./dist/index.node.js",
|
|
9
10
|
"import": "./dist/index.js",
|
|
10
11
|
"require": "./dist/index.cjs",
|
|
11
12
|
"default": "./dist/index.js"
|