@hanzo/ui 8.12.0 → 8.12.1
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/gallery.html +1 -1
- package/dist/next.cjs +57 -22
- package/package.json +1 -1
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.12.
|
|
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.12.1</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
|
*
|
package/dist/next.cjs
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
'use client';// @hanzo/ui on the web, for BOTH of Next's bundlers.
|
|
2
2
|
//
|
|
3
|
-
// const
|
|
4
|
-
// module.exports = withGui(nextConfig)
|
|
3
|
+
// const withGui = require('@hanzo/ui/next')
|
|
4
|
+
// module.exports = withGui(nextConfig, __dirname)
|
|
5
5
|
//
|
|
6
6
|
// Every component here renders through @hanzo/gui, which is cross-platform: its
|
|
7
7
|
// dependency graph names `react-native`, and one of those — react-native-svg,
|
|
8
|
-
// under the icon set —
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// under the icon set — ships a native entry beside a `.web.js` sibling. Pick the
|
|
9
|
+
// native one on a web build and it is not a resolution failure, it is a PARSE
|
|
10
|
+
// failure, in Flow source, inside a dependency:
|
|
11
11
|
//
|
|
12
12
|
// Parsing ecmascript source code failed
|
|
13
|
-
// import type {HostComponent} from '
|
|
13
|
+
// import type {HostComponent} from '.../HostComponent';
|
|
14
14
|
//
|
|
15
|
-
// which reads as a broken
|
|
16
|
-
//
|
|
15
|
+
// which reads as a broken package rather than a missing setting. Three settings
|
|
16
|
+
// prevent it, and all three are needed:
|
|
17
|
+
//
|
|
18
|
+
// 1. `.web.*` resolves FIRST, so the web sibling wins.
|
|
19
|
+
// 2. `react-native` IS `react-native-web` here.
|
|
20
|
+
// 3. the gui graph is TRANSPILED, or a bundler treats those packages as opaque
|
|
21
|
+
// and never applies 1 or 2 inside them.
|
|
17
22
|
//
|
|
18
23
|
// Declared for both bundlers together, in one file, because that is the failure
|
|
19
|
-
// this replaces: a webpack-only
|
|
24
|
+
// this replaces: a webpack-only setting is silently absent under Turbopack, so
|
|
20
25
|
// `next dev` and `next build` disagree about whether the app compiles.
|
|
21
26
|
//
|
|
22
27
|
// Node-only (a build-time module) and dependency-free: it takes and returns a
|
|
23
28
|
// plain object, so it does not force `next` into anyone's type graph.
|
|
24
29
|
|
|
30
|
+
const { readdirSync } = require('node:fs')
|
|
31
|
+
const { join } = require('node:path')
|
|
32
|
+
|
|
25
33
|
/**
|
|
26
34
|
* react-native's web spelling, and the asset registry that ships beside it.
|
|
27
35
|
*
|
|
28
36
|
* The registry is named separately because it is the one module react-native-web
|
|
29
|
-
* does not
|
|
37
|
+
* does not answer to under the same path — an `Image` reaches for
|
|
30
38
|
* `@react-native/assets-registry/registry` and finds nothing.
|
|
31
39
|
*/
|
|
32
40
|
const ALIAS = {
|
|
@@ -34,12 +42,27 @@ const ALIAS = {
|
|
|
34
42
|
'@react-native/assets-registry/registry': 'react-native-web/dist/modules/AssetRegistry',
|
|
35
43
|
}
|
|
36
44
|
|
|
45
|
+
/** `.web.tsx` before `.tsx`. See (1) above. */
|
|
46
|
+
const EXTENSIONS = ['.web.tsx', '.web.ts', '.web.jsx', '.web.js']
|
|
47
|
+
|
|
37
48
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
49
|
+
* Every installed `@hanzogui/*`, DISCOVERED rather than listed.
|
|
50
|
+
*
|
|
51
|
+
* The gui runtime is ~60 packages and the set moves; a hardcoded list is a list
|
|
52
|
+
* that goes stale, and the symptom of a missing one is the parse error above
|
|
53
|
+
* rather than anything naming the package.
|
|
41
54
|
*/
|
|
42
|
-
|
|
55
|
+
function guiPackages(dir) {
|
|
56
|
+
for (const base of [dir, process.cwd()]) {
|
|
57
|
+
if (!base) continue
|
|
58
|
+
try {
|
|
59
|
+
return readdirSync(join(base, 'node_modules', '@hanzogui')).map((n) => `@hanzogui/${n}`)
|
|
60
|
+
} catch {
|
|
61
|
+
/* not installed here — try the next place */
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return []
|
|
65
|
+
}
|
|
43
66
|
|
|
44
67
|
/** Webpack's half. */
|
|
45
68
|
function webpackGui(config) {
|
|
@@ -53,21 +76,33 @@ function webpackGui(config) {
|
|
|
53
76
|
/**
|
|
54
77
|
* Wrap a Next config so @hanzo/ui builds on the web.
|
|
55
78
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
79
|
+
* `dir` is the app's own directory — pass `__dirname`. The `process.cwd()`
|
|
80
|
+
* fallback is a courtesy: a task runner invoking Next from a workspace root
|
|
81
|
+
* would look for `@hanzogui/*` where there is none and silently transpile
|
|
82
|
+
* nothing.
|
|
83
|
+
*
|
|
84
|
+
* Composes rather than replaces: an existing `webpack()` hook, `turbopack`
|
|
85
|
+
* settings and `transpilePackages` are all kept and extended.
|
|
58
86
|
*/
|
|
59
|
-
function withGui(nextConfig = {}) {
|
|
87
|
+
function withGui(nextConfig = {}, dir = process.cwd()) {
|
|
60
88
|
const theirs = nextConfig.webpack
|
|
89
|
+
const transpile = new Set([
|
|
90
|
+
...(nextConfig.transpilePackages || []),
|
|
91
|
+
'@hanzo/gui',
|
|
92
|
+
'@hanzo/ui',
|
|
93
|
+
'react-native-web',
|
|
94
|
+
...guiPackages(dir),
|
|
95
|
+
])
|
|
96
|
+
const turbo = nextConfig.turbopack || {}
|
|
61
97
|
return {
|
|
62
98
|
...nextConfig,
|
|
99
|
+
transpilePackages: [...transpile],
|
|
63
100
|
turbopack: {
|
|
64
|
-
...
|
|
65
|
-
resolveAlias: { ...
|
|
101
|
+
...turbo,
|
|
102
|
+
resolveAlias: { ...turbo.resolveAlias, ...ALIAS },
|
|
66
103
|
resolveExtensions: [
|
|
67
104
|
...EXTENSIONS,
|
|
68
|
-
...(
|
|
69
|
-
'.tsx', '.ts', '.jsx', '.js', '.mjs', '.json',
|
|
70
|
-
]),
|
|
105
|
+
...(turbo.resolveExtensions || ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.json']),
|
|
71
106
|
],
|
|
72
107
|
},
|
|
73
108
|
webpack(config, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.1",
|
|
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": {
|