@hanzo/ui 8.11.2 → 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 +116 -0
- package/package.json +4 -3
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.
|
|
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
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client';// @hanzo/ui on the web, for BOTH of Next's bundlers.
|
|
2
|
+
//
|
|
3
|
+
// const withGui = require('@hanzo/ui/next')
|
|
4
|
+
// module.exports = withGui(nextConfig, __dirname)
|
|
5
|
+
//
|
|
6
|
+
// Every component here renders through @hanzo/gui, which is cross-platform: its
|
|
7
|
+
// dependency graph names `react-native`, and one of those — react-native-svg,
|
|
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
|
+
//
|
|
12
|
+
// Parsing ecmascript source code failed
|
|
13
|
+
// import type {HostComponent} from '.../HostComponent';
|
|
14
|
+
//
|
|
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.
|
|
22
|
+
//
|
|
23
|
+
// Declared for both bundlers together, in one file, because that is the failure
|
|
24
|
+
// this replaces: a webpack-only setting is silently absent under Turbopack, so
|
|
25
|
+
// `next dev` and `next build` disagree about whether the app compiles.
|
|
26
|
+
//
|
|
27
|
+
// Node-only (a build-time module) and dependency-free: it takes and returns a
|
|
28
|
+
// plain object, so it does not force `next` into anyone's type graph.
|
|
29
|
+
|
|
30
|
+
const { readdirSync } = require('node:fs')
|
|
31
|
+
const { join } = require('node:path')
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* react-native's web spelling, and the asset registry that ships beside it.
|
|
35
|
+
*
|
|
36
|
+
* The registry is named separately because it is the one module react-native-web
|
|
37
|
+
* does not answer to under the same path — an `Image` reaches for
|
|
38
|
+
* `@react-native/assets-registry/registry` and finds nothing.
|
|
39
|
+
*/
|
|
40
|
+
const ALIAS = {
|
|
41
|
+
'react-native': 'react-native-web',
|
|
42
|
+
'@react-native/assets-registry/registry': 'react-native-web/dist/modules/AssetRegistry',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** `.web.tsx` before `.tsx`. See (1) above. */
|
|
46
|
+
const EXTENSIONS = ['.web.tsx', '.web.ts', '.web.jsx', '.web.js']
|
|
47
|
+
|
|
48
|
+
/**
|
|
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.
|
|
54
|
+
*/
|
|
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
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Webpack's half. */
|
|
68
|
+
function webpackGui(config) {
|
|
69
|
+
config.resolve = config.resolve || {}
|
|
70
|
+
config.resolve.alias = { ...config.resolve.alias, ...ALIAS }
|
|
71
|
+
const had = config.resolve.extensions || ['.tsx', '.ts', '.jsx', '.js']
|
|
72
|
+
config.resolve.extensions = [...EXTENSIONS, ...had.filter((e) => !EXTENSIONS.includes(e))]
|
|
73
|
+
return config
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Wrap a Next config so @hanzo/ui builds on the web.
|
|
78
|
+
*
|
|
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.
|
|
86
|
+
*/
|
|
87
|
+
function withGui(nextConfig = {}, dir = process.cwd()) {
|
|
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 || {}
|
|
97
|
+
return {
|
|
98
|
+
...nextConfig,
|
|
99
|
+
transpilePackages: [...transpile],
|
|
100
|
+
turbopack: {
|
|
101
|
+
...turbo,
|
|
102
|
+
resolveAlias: { ...turbo.resolveAlias, ...ALIAS },
|
|
103
|
+
resolveExtensions: [
|
|
104
|
+
...EXTENSIONS,
|
|
105
|
+
...(turbo.resolveExtensions || ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.json']),
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
webpack(config, options) {
|
|
109
|
+
return webpackGui(theirs ? theirs(config, options) : config)
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = withGui
|
|
115
|
+
module.exports.withGui = withGui
|
|
116
|
+
module.exports.GUI_ALIAS = ALIAS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "8.
|
|
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": {
|
|
@@ -206,7 +206,8 @@
|
|
|
206
206
|
"import": "./dist/types.js",
|
|
207
207
|
"require": "./dist/types.cjs",
|
|
208
208
|
"default": "./dist/types.js"
|
|
209
|
-
}
|
|
209
|
+
},
|
|
210
|
+
"./next": "./dist/next.cjs"
|
|
210
211
|
},
|
|
211
212
|
"main": "./dist/index.cjs",
|
|
212
213
|
"module": "./dist/index.js",
|
|
@@ -310,7 +311,7 @@
|
|
|
310
311
|
"license": "MIT",
|
|
311
312
|
"author": "Hanzo AI <dev@hanzo.ai>",
|
|
312
313
|
"scripts": {
|
|
313
|
-
"build": "rm -rf dist dist-cjs && tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json --noCheck && mkdir -p dist/styles && node scripts/compose-theme.mjs && cp src/styles/motion.css dist/styles/motion.css && node scripts/postbuild.mjs && node scripts/gen-css.mjs",
|
|
314
|
+
"build": "rm -rf dist dist-cjs && tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json --noCheck && mkdir -p dist/styles && node scripts/compose-theme.mjs && cp src/styles/motion.css dist/styles/motion.css && cp src/next.cjs dist/next.cjs && node scripts/postbuild.mjs && node scripts/gen-css.mjs",
|
|
314
315
|
"clean": "rm -rf dist dist-cjs types",
|
|
315
316
|
"gen:primitives": "node scripts/gen-primitives.mjs",
|
|
316
317
|
"tc": "tsc --noEmit",
|