@tamagui/tailwind 0.0.0-bootstrap.0 → 3.0.0-beta.643.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/cjs/candidate.cjs +385 -0
- package/dist/cjs/candidate.native.cjs +431 -0
- package/dist/cjs/candidate.native.js +433 -0
- package/dist/cjs/candidate.native.js.map +1 -0
- package/dist/cjs/frontend.cjs +80 -0
- package/dist/cjs/frontend.native.cjs +95 -0
- package/dist/cjs/frontend.native.js +97 -0
- package/dist/cjs/frontend.native.js.map +1 -0
- package/dist/cjs/index.cjs +39 -0
- package/dist/cjs/index.native.cjs +41 -0
- package/dist/cjs/index.native.js +43 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/styled.cjs +30 -0
- package/dist/cjs/styled.native.cjs +32 -0
- package/dist/cjs/styled.native.js +34 -0
- package/dist/cjs/styled.native.js.map +1 -0
- package/dist/cjs/types.cjs +17 -0
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/vite/state.cjs +249 -0
- package/dist/cjs/vite/state.native.cjs +331 -0
- package/dist/cjs/vite/state.native.js +333 -0
- package/dist/cjs/vite/state.native.js.map +1 -0
- package/dist/cjs/vite.cjs +148 -0
- package/dist/cjs/vite.native.cjs +188 -0
- package/dist/cjs/vite.native.js +190 -0
- package/dist/cjs/vite.native.js.map +1 -0
- package/dist/esm/candidate.mjs +360 -0
- package/dist/esm/candidate.mjs.map +1 -0
- package/dist/esm/candidate.native.js +404 -0
- package/dist/esm/candidate.native.js.map +1 -0
- package/dist/esm/frontend.mjs +57 -0
- package/dist/esm/frontend.mjs.map +1 -0
- package/dist/esm/frontend.native.js +70 -0
- package/dist/esm/frontend.native.js.map +1 -0
- package/dist/esm/index.mjs +11 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +11 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/styled.mjs +10 -0
- package/dist/esm/styled.mjs.map +1 -0
- package/dist/esm/styled.native.js +10 -0
- package/dist/esm/styled.native.js.map +1 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/types.native.js +0 -0
- package/dist/esm/vite/state.mjs +215 -0
- package/dist/esm/vite/state.mjs.map +1 -0
- package/dist/esm/vite/state.native.js +295 -0
- package/dist/esm/vite/state.native.js.map +1 -0
- package/dist/esm/vite.mjs +116 -0
- package/dist/esm/vite.mjs.map +1 -0
- package/dist/esm/vite.native.js +154 -0
- package/dist/esm/vite.native.js.map +1 -0
- package/package.json +88 -5
- package/src/candidate.ts +527 -0
- package/src/frontend.ts +116 -0
- package/src/index.tsx +24 -0
- package/src/styled.tsx +52 -0
- package/src/types.ts +226 -0
- package/src/vite/state.ts +274 -0
- package/src/vite.ts +204 -0
- package/types/candidate.d.ts +23 -0
- package/types/candidate.d.ts.map +1 -0
- package/types/frontend.d.ts +20 -0
- package/types/frontend.d.ts.map +1 -0
- package/types/index.d.ts +8 -0
- package/types/index.d.ts.map +1 -0
- package/types/styled.d.ts +12 -0
- package/types/styled.d.ts.map +1 -0
- package/types/types.d.ts +158 -0
- package/types/types.d.ts.map +1 -0
- package/types/vite/state.d.ts +28 -0
- package/types/vite/state.d.ts.map +1 -0
- package/types/vite.d.ts +20 -0
- package/types/vite.d.ts.map +1 -0
- package/README.md +0 -1
package/src/vite.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tailwind build integration for Tamagui.
|
|
3
|
+
*
|
|
4
|
+
* Applications that author with `@tamagui/tailwind` change only the plugin import:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { tamaguiPlugin } from '@tamagui/tailwind/vite'
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* This wraps the base `@tamagui/vite-plugin` compiler plugins, reuses their one
|
|
11
|
+
* Tamagui config loader, adds `@tamagui/tailwind` to compiler component provenance,
|
|
12
|
+
* and adds the official Tailwind scanner/compiler for the candidates Tamagui's own
|
|
13
|
+
* grammar does not claim. Nothing here is reachable from the `@tamagui/tailwind`
|
|
14
|
+
* root: the runtime package never imports the Tailwind engine or Vite.
|
|
15
|
+
*/
|
|
16
|
+
import {
|
|
17
|
+
createTamaguiPlugins,
|
|
18
|
+
type TamaguiVitePluginOptions,
|
|
19
|
+
type ViteTamaguiLoader,
|
|
20
|
+
} from '@tamagui/vite-plugin/internal'
|
|
21
|
+
import path from 'node:path'
|
|
22
|
+
import type {
|
|
23
|
+
Environment,
|
|
24
|
+
Plugin,
|
|
25
|
+
PluginOption,
|
|
26
|
+
ResolvedConfig,
|
|
27
|
+
ViteDevServer,
|
|
28
|
+
} from 'vite'
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
createTailwindScannerState,
|
|
32
|
+
isTamaguiCoreResetCSS,
|
|
33
|
+
TAILWIND_RESOLVED_ID,
|
|
34
|
+
TAILWIND_VIRTUAL_ID,
|
|
35
|
+
updateTailwindForWatchChange,
|
|
36
|
+
wrapWithTamaguiLayer,
|
|
37
|
+
} from './vite/state'
|
|
38
|
+
|
|
39
|
+
export { TAILWIND_RESOLVED_ID, TAILWIND_VERSION, TAILWIND_VIRTUAL_ID } from './vite/state'
|
|
40
|
+
|
|
41
|
+
function isNative(environment?: Environment) {
|
|
42
|
+
return environment?.name === 'ios' || environment?.name === 'android'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function isNotClient(environment?: Environment) {
|
|
46
|
+
return !!environment?.name && environment.name !== 'client'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function createTailwindPlugin(loader: ViteTamaguiLoader): Plugin {
|
|
50
|
+
const state = createTailwindScannerState()
|
|
51
|
+
let config: ResolvedConfig
|
|
52
|
+
let server: ViteDevServer | undefined
|
|
53
|
+
|
|
54
|
+
const configure = async (addWatchFile: (file: string) => void) =>
|
|
55
|
+
state.configure(
|
|
56
|
+
config.root,
|
|
57
|
+
loader.getGeneration(),
|
|
58
|
+
await loader.getTamaguiConfig(),
|
|
59
|
+
addWatchFile,
|
|
60
|
+
(glob) => server?.watcher.add(glob)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const isAppJSXSource = (filePath: string) => {
|
|
64
|
+
if (!/\.[jt]sx$/.test(filePath)) return false
|
|
65
|
+
const relative = path.relative(config.root, filePath)
|
|
66
|
+
return (
|
|
67
|
+
relative !== '' &&
|
|
68
|
+
relative !== '..' &&
|
|
69
|
+
!relative.startsWith(`..${path.sep}`) &&
|
|
70
|
+
!relative.split(path.sep).includes('node_modules')
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const clientTailwindModule = () =>
|
|
75
|
+
server?.environments.client?.moduleGraph.getModuleById(TAILWIND_RESOLVED_ID)
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
name: 'tamagui-tailwind',
|
|
79
|
+
enforce: 'pre',
|
|
80
|
+
|
|
81
|
+
config() {
|
|
82
|
+
return {
|
|
83
|
+
optimizeDeps: {
|
|
84
|
+
// Tailwind components reach the shared renderer through
|
|
85
|
+
// `@tamagui/core/internal-runtime`, while regular components reach it through
|
|
86
|
+
// `@tamagui/core`. Optimizing both entries together puts them in one chunk
|
|
87
|
+
// graph, so there is a single `@tamagui/web` instance and both frontends see
|
|
88
|
+
// the same config singleton and contexts.
|
|
89
|
+
include: ['@tamagui/tailwind', '@tamagui/core/internal-runtime'],
|
|
90
|
+
},
|
|
91
|
+
resolve: {
|
|
92
|
+
dedupe: ['@tamagui/tailwind'],
|
|
93
|
+
},
|
|
94
|
+
define: {
|
|
95
|
+
// Runtime-generated and SSR fallback rules must participate in the same
|
|
96
|
+
// cascade order as compiler-extracted Tamagui CSS. Without this, the
|
|
97
|
+
// unlayered runtime duplicate beats official Tailwind utilities.
|
|
98
|
+
'process.env.TAMAGUI_CSS_LAYER': JSON.stringify('tamagui'),
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
configResolved(resolvedConfig) {
|
|
104
|
+
config = resolvedConfig
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
configureServer(_server) {
|
|
108
|
+
server = _server
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
hotUpdate: {
|
|
112
|
+
order: 'post',
|
|
113
|
+
async handler(options) {
|
|
114
|
+
if (this.environment.name !== 'client') return
|
|
115
|
+
// a config change already triggers a full reload from the base plugin; drop the
|
|
116
|
+
// scanner so the next request recompiles against the new grammar view
|
|
117
|
+
if (loader.isEvaluationDependency(options.file)) {
|
|
118
|
+
state.clear()
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
if (!(await configure(() => {}))) return
|
|
122
|
+
const changed =
|
|
123
|
+
options.type === 'delete'
|
|
124
|
+
? await state.removeSource(options.file)
|
|
125
|
+
: await state.scanSource(options.file, await options.read())
|
|
126
|
+
if (!changed) return
|
|
127
|
+
const virtualModule = clientTailwindModule()
|
|
128
|
+
if (!virtualModule) return
|
|
129
|
+
this.environment.moduleGraph.invalidateModule(virtualModule)
|
|
130
|
+
return [...options.modules, virtualModule]
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
async watchChange(id, change) {
|
|
135
|
+
if (config.command !== 'build') return
|
|
136
|
+
if (loader.isEvaluationDependency(id)) {
|
|
137
|
+
state.clear()
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
await updateTailwindForWatchChange(state, id, change.event, () =>
|
|
141
|
+
configure((file) => this.addWatchFile(file))
|
|
142
|
+
)
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
resolveId(source) {
|
|
146
|
+
if (isNative(this.environment) || isNotClient(this.environment)) return
|
|
147
|
+
if (source === TAILWIND_VIRTUAL_ID) return TAILWIND_RESOLVED_ID
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
async load(id) {
|
|
151
|
+
if (id !== TAILWIND_RESOLVED_ID) return
|
|
152
|
+
if (isNative(this.environment) || isNotClient(this.environment)) return
|
|
153
|
+
if (!(await configure((file) => this.addWatchFile(file)))) return ''
|
|
154
|
+
return state.css
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
transform: {
|
|
158
|
+
order: 'pre',
|
|
159
|
+
async handler(code, id) {
|
|
160
|
+
if (isNative(this.environment)) return
|
|
161
|
+
|
|
162
|
+
const [validId] = id.split('?')
|
|
163
|
+
|
|
164
|
+
// Tamagui's reset belongs in the Tamagui layer so official Tailwind's theme
|
|
165
|
+
// and utilities layers order after it
|
|
166
|
+
if (isTamaguiCoreResetCSS(validId)) {
|
|
167
|
+
return { code: wrapWithTamaguiLayer(code), map: null }
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// the config loader needs Vite's evaluation environment, which is installed by
|
|
171
|
+
// the base plugin's configureServer/buildStart
|
|
172
|
+
if (!loader.getEnvironment()) return
|
|
173
|
+
if (!isAppJSXSource(validId)) return
|
|
174
|
+
if (!(await configure((file) => this.addWatchFile(file)))) return
|
|
175
|
+
|
|
176
|
+
if (await state.scanSource(validId, code)) {
|
|
177
|
+
const virtualModule = clientTailwindModule()
|
|
178
|
+
if (virtualModule) {
|
|
179
|
+
server?.environments.client?.moduleGraph.invalidateModule(virtualModule)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const dependency of loader.getEvaluationDependencies()) {
|
|
183
|
+
this.addWatchFile(dependency)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// the virtual stylesheet is a client-only import: server bundles must not
|
|
187
|
+
// reference it, and it is emitted once per app module so any entry pulls it in
|
|
188
|
+
if (isNotClient(this.environment)) return
|
|
189
|
+
return { code: `${code}\nimport "${TAILWIND_VIRTUAL_ID}";`, map: null }
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function tamaguiPlugin(options: TamaguiVitePluginOptions = {}): PluginOption {
|
|
196
|
+
const { plugins, loader } = createTamaguiPlugins({
|
|
197
|
+
...options,
|
|
198
|
+
components: [
|
|
199
|
+
...new Set([...(options.components ?? ['tamagui']), '@tamagui/tailwind']),
|
|
200
|
+
],
|
|
201
|
+
wrapExtractedCSS: wrapWithTamaguiLayer,
|
|
202
|
+
})
|
|
203
|
+
return [...plugins, createTailwindPlugin(loader)]
|
|
204
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type StyleFrontendConfig } from '@tamagui/core/internal-runtime';
|
|
2
|
+
import { type GrammarConfigView } from '@tamagui/style-grammar/runtime';
|
|
3
|
+
export declare function getStyleGrammarConfig(config: StyleFrontendConfig): GrammarConfigView;
|
|
4
|
+
export declare function isTokenValueProp(prop: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Append a contribution at the end of the forward pass.
|
|
7
|
+
*
|
|
8
|
+
* Plain re-assignment keeps a key's FIRST insertion position, so a restated
|
|
9
|
+
* shorthand would stay behind a longhand authored between the two occurrences:
|
|
10
|
+
* `p-4 px-2 p-6` has to resolve `paddingLeft` from `p-6`, and `pt-2 p-4 pt-8` has to
|
|
11
|
+
* resolve `paddingTop` from `pt-8`. Deleting the key first moves it to the end,
|
|
12
|
+
* which is the authored order the shared per-longhand merge reads.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setInAuthoredOrder(target: Record<string, any>, key: string, value: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Tokenize a className into ordinary props and internal value-program contributions,
|
|
17
|
+
* once per class per config.
|
|
18
|
+
* User-defined tokens drive resolution; Tailwind's color/spacing scales are never
|
|
19
|
+
* hardcoded. Classes the grammar does not claim stay in `className` verbatim, in
|
|
20
|
+
* author order, so official Tailwind CSS still applies them on web.
|
|
21
|
+
*/
|
|
22
|
+
export declare function preprocessTailwindClassName(props: Record<string, any>, config: StyleFrontendConfig, preservePassthroughPosition?: boolean): Record<string, any>;
|
|
23
|
+
//# sourceMappingURL=candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../src/candidate.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAUL,KAAK,iBAAiB,EAEvB,MAAM,gCAAgC,CAAA;AAevC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,GAAG,iBAAiB,CAMpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AA4WD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,GAAG,GACT,IAAI,CAGN;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,2BAA2B,UAAQ,GAClC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAyFrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type StyleFrontend, type StyleFrontendConfig } from '@tamagui/core/internal-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The Tailwind frontend descriptor.
|
|
4
|
+
*
|
|
5
|
+
* `preprocessProps` is the single Tailwind pass: it tokenizes `className` once and
|
|
6
|
+
* emits ordinary props plus internal program contributions in authored order.
|
|
7
|
+
* Everything after this point — value programs,
|
|
8
|
+
* per-longhand forward merging, web lowering, native evaluation — is shared.
|
|
9
|
+
*
|
|
10
|
+
* Owned candidates are never string-merged: each contributes at its authored
|
|
11
|
+
* position and the shared resolver's last-contribution-wins rule decides. That is
|
|
12
|
+
* why `tailwind-merge` is not a dependency here.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Parse a static class string (a `styled()` base, a string variant value, a string
|
|
16
|
+
* compound-variant style) into ordinary style props.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseStaticStyle(input: string, config: StyleFrontendConfig): Record<string, any>;
|
|
19
|
+
export declare const tailwindStyleFrontend: StyleFrontend;
|
|
20
|
+
//# sourceMappingURL=frontend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../src/frontend.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAA;AAGvC;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAErB;AAsED,eAAO,MAAM,qBAAqB,EAAE,aAenC,CAAA"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TailwindText, TailwindView } from './types';
|
|
2
|
+
export declare const View: TailwindView;
|
|
3
|
+
export declare const Text: TailwindText;
|
|
4
|
+
export { styled } from './styled';
|
|
5
|
+
export { parseStaticStyle, tailwindStyleFrontend } from './frontend';
|
|
6
|
+
export { preprocessTailwindClassName } from './candidate';
|
|
7
|
+
export type * from './types';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIzD,eAAO,MAAM,IAAI,EAAoC,YAAY,CAAA;AACjE,eAAO,MAAM,IAAI,EAAoC,YAAY,CAAA;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,mBAAmB,SAAS,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetTailwindNonStyleProps, GetTailwindRef, GetTailwindVariantProps, TailwindComponent, TailwindStyledOptions, TailwindVariantDefinitions, TailwindVariantProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Class-first `styled()`. The base is a class string, variant values are class
|
|
4
|
+
* strings, and the resulting component accepts `className` plus its variants —
|
|
5
|
+
* never Tamagui inline style props.
|
|
6
|
+
*
|
|
7
|
+
* The class base and variant values are parsed once per (component, config) pair
|
|
8
|
+
* by the frontend's `normalizeStaticConfig`, so authoring cost is not per render.
|
|
9
|
+
*/
|
|
10
|
+
export declare function styled<Parent extends TailwindComponent<any, any, any>, Variants extends TailwindVariantDefinitions = {}>(Component: Parent, baseClassName: string, options?: TailwindStyledOptions<Variants>): TailwindComponent<GetTailwindRef<Parent>, GetTailwindNonStyleProps<Parent>, GetTailwindVariantProps<Parent> & TailwindVariantProps<Variants>>;
|
|
11
|
+
export declare function styled<Parent extends TailwindComponent<any, any, any>, Variants extends TailwindVariantDefinitions = {}>(Component: Parent, options?: TailwindStyledOptions<Variants>): TailwindComponent<GetTailwindRef<Parent>, GetTailwindNonStyleProps<Parent>, GetTailwindVariantProps<Parent> & TailwindVariantProps<Variants>>;
|
|
12
|
+
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAIhB;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,MAAM,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC/C,QAAQ,SAAS,0BAA0B,GAAG,EAAE,EAEhD,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GACxC,iBAAiB,CAClB,cAAc,CAAC,MAAM,CAAC,EACtB,wBAAwB,CAAC,MAAM,CAAC,EAChC,uBAAuB,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CACjE,CAAA;AACD,wBAAgB,MAAM,CACpB,MAAM,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC/C,QAAQ,SAAS,0BAA0B,GAAG,EAAE,EAEhD,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GACxC,iBAAiB,CAClB,cAAc,CAAC,MAAM,CAAC,EACtB,wBAAwB,CAAC,MAAM,CAAC,EAChC,uBAAuB,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CACjE,CAAA"}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { FrontendStaticConfig } from '@tamagui/core/internal-runtime';
|
|
2
|
+
import type { AriaAttributes, CSSProperties, FunctionComponent, HTMLAttributes, ReactElement, ReactNode, Ref as ReactRef } from 'react';
|
|
3
|
+
import type { PressableProps, StyleProp, Text as ReactNativeText, TextProps as ReactNativeTextProps, TextStyle, View as ReactNativeView, ViewProps as ReactNativeViewProps, ViewStyle } from 'react-native';
|
|
4
|
+
type WebEventProps = {
|
|
5
|
+
onMouseEnter?: HTMLAttributes<HTMLDivElement>['onMouseEnter'];
|
|
6
|
+
onMouseLeave?: HTMLAttributes<HTMLDivElement>['onMouseLeave'];
|
|
7
|
+
onMouseDown?: HTMLAttributes<HTMLDivElement>['onMouseDown'];
|
|
8
|
+
onMouseUp?: HTMLAttributes<HTMLDivElement>['onMouseUp'];
|
|
9
|
+
onMouseMove?: HTMLAttributes<HTMLDivElement>['onMouseMove'];
|
|
10
|
+
onMouseOver?: HTMLAttributes<HTMLDivElement>['onMouseOver'];
|
|
11
|
+
onMouseOut?: HTMLAttributes<HTMLDivElement>['onMouseOut'];
|
|
12
|
+
onFocus?: HTMLAttributes<HTMLDivElement>['onFocus'];
|
|
13
|
+
onBlur?: HTMLAttributes<HTMLDivElement>['onBlur'];
|
|
14
|
+
onClick?: HTMLAttributes<HTMLDivElement>['onClick'];
|
|
15
|
+
onDoubleClick?: HTMLAttributes<HTMLDivElement>['onDoubleClick'];
|
|
16
|
+
onContextMenu?: HTMLAttributes<HTMLDivElement>['onContextMenu'];
|
|
17
|
+
onWheel?: HTMLAttributes<HTMLDivElement>['onWheel'];
|
|
18
|
+
onKeyDown?: HTMLAttributes<HTMLDivElement>['onKeyDown'];
|
|
19
|
+
onKeyUp?: HTMLAttributes<HTMLDivElement>['onKeyUp'];
|
|
20
|
+
onChange?: HTMLAttributes<HTMLDivElement>['onChange'];
|
|
21
|
+
onInput?: HTMLAttributes<HTMLDivElement>['onInput'];
|
|
22
|
+
onBeforeInput?: HTMLAttributes<HTMLDivElement>['onBeforeInput'];
|
|
23
|
+
onScroll?: HTMLAttributes<HTMLDivElement>['onScroll'];
|
|
24
|
+
onCopy?: HTMLAttributes<HTMLDivElement>['onCopy'];
|
|
25
|
+
onCut?: HTMLAttributes<HTMLDivElement>['onCut'];
|
|
26
|
+
onPaste?: HTMLAttributes<HTMLDivElement>['onPaste'];
|
|
27
|
+
onDrag?: HTMLAttributes<HTMLDivElement>['onDrag'];
|
|
28
|
+
onDragStart?: HTMLAttributes<HTMLDivElement>['onDragStart'];
|
|
29
|
+
onDragEnd?: HTMLAttributes<HTMLDivElement>['onDragEnd'];
|
|
30
|
+
onDragEnter?: HTMLAttributes<HTMLDivElement>['onDragEnter'];
|
|
31
|
+
onDragLeave?: HTMLAttributes<HTMLDivElement>['onDragLeave'];
|
|
32
|
+
onDragOver?: HTMLAttributes<HTMLDivElement>['onDragOver'];
|
|
33
|
+
onDrop?: HTMLAttributes<HTMLDivElement>['onDrop'];
|
|
34
|
+
onPointerDown?: HTMLAttributes<HTMLDivElement>['onPointerDown'];
|
|
35
|
+
onPointerMove?: HTMLAttributes<HTMLDivElement>['onPointerMove'];
|
|
36
|
+
onPointerUp?: HTMLAttributes<HTMLDivElement>['onPointerUp'];
|
|
37
|
+
onPointerCancel?: HTMLAttributes<HTMLDivElement>['onPointerCancel'];
|
|
38
|
+
};
|
|
39
|
+
type TailwindComponentState = {
|
|
40
|
+
unmounted: boolean | 'should-enter';
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
hover?: boolean;
|
|
43
|
+
press?: boolean;
|
|
44
|
+
pressIn?: boolean;
|
|
45
|
+
focus?: boolean;
|
|
46
|
+
focusVisible?: boolean;
|
|
47
|
+
focusWithin?: boolean;
|
|
48
|
+
};
|
|
49
|
+
type TailwindCommonProps = AriaAttributes & WebEventProps & {
|
|
50
|
+
target?: string;
|
|
51
|
+
htmlFor?: string;
|
|
52
|
+
asChild?: boolean | 'except-style' | 'except-style-web' | 'web';
|
|
53
|
+
dangerouslySetInnerHTML?: {
|
|
54
|
+
__html: string;
|
|
55
|
+
};
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
debug?: boolean | 'break' | 'verbose' | 'visualize' | 'profile';
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
themeShallow?: boolean;
|
|
60
|
+
id?: string;
|
|
61
|
+
render?: keyof HTMLElementTagNameMap | (string & {}) | ReactElement | ((props: Record<string, any> & {
|
|
62
|
+
ref?: ReactRef<any>;
|
|
63
|
+
}, state: TailwindComponentState) => ReactElement);
|
|
64
|
+
theme?: string | null;
|
|
65
|
+
group?: string | boolean;
|
|
66
|
+
container?: boolean;
|
|
67
|
+
untilMeasured?: 'hide' | 'show';
|
|
68
|
+
name?: string;
|
|
69
|
+
tabIndex?: string | number;
|
|
70
|
+
role?: HTMLAttributes<HTMLDivElement>['role'];
|
|
71
|
+
disableOptimization?: boolean;
|
|
72
|
+
forceStyle?: 'hover' | 'press' | 'focus' | 'focusVisible' | 'focusWithin';
|
|
73
|
+
disableClassName?: boolean;
|
|
74
|
+
hitSlop?: number | {
|
|
75
|
+
top?: number;
|
|
76
|
+
left?: number;
|
|
77
|
+
bottom?: number;
|
|
78
|
+
right?: number;
|
|
79
|
+
} | null;
|
|
80
|
+
animatedBy?: string | null;
|
|
81
|
+
onPress?: PressableProps['onPress'];
|
|
82
|
+
onLongPress?: PressableProps['onLongPress'];
|
|
83
|
+
onPressIn?: PressableProps['onPress'];
|
|
84
|
+
onPressOut?: PressableProps['onPress'];
|
|
85
|
+
};
|
|
86
|
+
type LooseCombinedObjects<A extends object, B extends object> = A | B | (A & B);
|
|
87
|
+
export type TailwindViewNonStyleProps = Omit<ReactNativeViewProps, 'children' | 'display' | 'hitSlop' | 'pointerEvents' | 'style' | keyof WebEventProps> & TailwindCommonProps & {
|
|
88
|
+
style?: StyleProp<LooseCombinedObjects<CSSProperties, ViewStyle>>;
|
|
89
|
+
};
|
|
90
|
+
export type TailwindTextNonStyleProps = Omit<ReactNativeTextProps, 'children' | 'style' | keyof WebEventProps> & TailwindCommonProps & {
|
|
91
|
+
style?: StyleProp<LooseCombinedObjects<CSSProperties, TextStyle>>;
|
|
92
|
+
};
|
|
93
|
+
type MeasureOnSuccessCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
|
|
94
|
+
export interface TailwindElementMethods {
|
|
95
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
|
96
|
+
measureInWindow(callback: (x: number, y: number, width: number, height: number) => void): void;
|
|
97
|
+
measureLayout(relativeToNativeNode: ReactNativeView | HTMLElement, onSuccess: (left: number, top: number, width: number, height: number) => void, onFail?: () => void): void;
|
|
98
|
+
focus(): void;
|
|
99
|
+
blur(): void;
|
|
100
|
+
}
|
|
101
|
+
export type TailwindViewElement = (HTMLElement & TailwindElementMethods) | ReactNativeView;
|
|
102
|
+
export type TailwindTextElement = (HTMLElement & TailwindElementMethods) | ReactNativeText;
|
|
103
|
+
/**
|
|
104
|
+
* The complete styling surface of a `@tamagui/tailwind` component.
|
|
105
|
+
*
|
|
106
|
+
* Everything else a component accepts is ordinary behavior: children, refs,
|
|
107
|
+
* accessibility, events, ids, and the raw platform `style` escape hatch, all
|
|
108
|
+
* inherited from the shared non-style prop types. Tamagui inline style props
|
|
109
|
+
* (`padding`, `bg`, shorthands, state/media clauses, theme style props) are
|
|
110
|
+
* deliberately absent — that authoring syntax belongs to `@tamagui/core`.
|
|
111
|
+
*/
|
|
112
|
+
export type TailwindStyleProps = {
|
|
113
|
+
className?: string;
|
|
114
|
+
};
|
|
115
|
+
/** `true`/`false` matchers become a boolean prop; every other matcher is its own literal. */
|
|
116
|
+
type VariantAcceptedValue<Key> = Key extends 'true' | 'false' ? boolean : Key;
|
|
117
|
+
/**
|
|
118
|
+
* Finite variant inference: one optional prop per variant, accepting exactly the
|
|
119
|
+
* matchers that variant declares. It never reaches core's style prop graph.
|
|
120
|
+
*/
|
|
121
|
+
export type TailwindVariantProps<Variants> = Variants extends object ? {
|
|
122
|
+
[Key in keyof Variants]?: VariantAcceptedValue<keyof Variants[Key]>;
|
|
123
|
+
} : {};
|
|
124
|
+
/** Variant values are class strings — the same authoring syntax as `className`. */
|
|
125
|
+
export type TailwindVariantDefinitions = {
|
|
126
|
+
[variantName: string]: {
|
|
127
|
+
[matcher: string]: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export type TailwindCompoundVariant<Variants> = TailwindVariantProps<Variants> & {
|
|
131
|
+
style: string;
|
|
132
|
+
};
|
|
133
|
+
export type TailwindStyledOptions<Variants extends TailwindVariantDefinitions> = {
|
|
134
|
+
displayName?: string;
|
|
135
|
+
variants?: Variants;
|
|
136
|
+
defaultVariants?: TailwindVariantProps<Variants>;
|
|
137
|
+
compoundVariants?: readonly TailwindCompoundVariant<Variants>[];
|
|
138
|
+
};
|
|
139
|
+
export interface TailwindComponent<Ref = any, NonStyleProps = {}, VariantProps = {}> extends FunctionComponent<NonStyleProps & TailwindStyleProps & VariantProps & {
|
|
140
|
+
ref?: ReactRef<Ref>;
|
|
141
|
+
}> {
|
|
142
|
+
staticConfig: FrontendStaticConfig;
|
|
143
|
+
/** phantom carrier so `styled()` can recover the parts of a parent component */
|
|
144
|
+
__tailwind?: {
|
|
145
|
+
ref: Ref;
|
|
146
|
+
props: NonStyleProps;
|
|
147
|
+
variants: VariantProps;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export type GetTailwindRef<Component> = Component extends TailwindComponent<infer Ref, any, any> ? Ref : any;
|
|
151
|
+
export type GetTailwindNonStyleProps<Component> = Component extends TailwindComponent<any, infer Props, any> ? Props : {};
|
|
152
|
+
export type GetTailwindVariantProps<Component> = Component extends TailwindComponent<any, any, infer Variants> ? Variants : {};
|
|
153
|
+
export type TailwindView = TailwindComponent<TailwindViewElement, TailwindViewNonStyleProps>;
|
|
154
|
+
export type TailwindText = TailwindComponent<TailwindTextElement, TailwindTextNonStyleProps>;
|
|
155
|
+
export type TailwindViewProps = TailwindViewNonStyleProps & TailwindStyleProps;
|
|
156
|
+
export type TailwindTextProps = TailwindTextNonStyleProps & TailwindStyleProps;
|
|
157
|
+
export {};
|
|
158
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,QAAQ,EAChB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,IAAI,IAAI,eAAe,EACvB,SAAS,IAAI,oBAAoB,EACjC,SAAS,EACT,IAAI,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AG,CAAC;QAAC,KAAK,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAA;CACxE;AAED,MAAM,MAAM,cAAc,CAAC,SAAS,IAClC,SAAS,SAAS,iBAAiB,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAA;AAEtE,MAAM,MAAM,wBAAwB,CAAC,SAAS,IAC5C,SAAS,SAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,CAAA;AAEzE,MAAM,MAAM,uBAAuB,CAAC,SAAS,IAC3C,SAAS,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAA;AAE/E,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAC1C,mBAAmB,EACnB,yBAAyB,CAC1B,CAAA;AACD,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAC1C,mBAAmB,EACnB,yBAAyB,CAC1B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type GrammarSourceConfig } from '@tamagui/style-grammar/runtime';
|
|
2
|
+
export declare const TAILWIND_VERSION = "4.3.0";
|
|
3
|
+
export declare const TAILWIND_VIRTUAL_ID = "virtual:tamagui-tailwind.css";
|
|
4
|
+
export declare const TAILWIND_RESOLVED_ID = "\0virtual:tamagui-tailwind.css";
|
|
5
|
+
export declare function wrapWithTamaguiLayer(css: string): string;
|
|
6
|
+
export declare function isTamaguiCoreResetCSS(id: string): boolean;
|
|
7
|
+
export type TailwindScannerState = ReturnType<typeof createTailwindScannerState>;
|
|
8
|
+
export type TailwindWatchEvent = 'create' | 'update' | 'delete';
|
|
9
|
+
/**
|
|
10
|
+
* The official Tailwind scanner and compiler, owned by `@tamagui/tailwind/vite`.
|
|
11
|
+
*
|
|
12
|
+
* It compiles only the candidates Tamagui's own grammar does not claim: claimed
|
|
13
|
+
* candidates already became Tamagui atoms through the shared renderer, so emitting
|
|
14
|
+
* them again would duplicate the rules and hand the cascade to whichever landed
|
|
15
|
+
* last. There is no style-mode gate here — the state exists because the app
|
|
16
|
+
* imported the Tailwind plugin.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createTailwindScannerState(): {
|
|
19
|
+
clear: () => void;
|
|
20
|
+
configure: (nextRoot: string, nextGeneration: number, config: GrammarSourceConfig | null | undefined, onDependency: (file: string) => void, onSourceGlob?: (glob: string) => void) => Promise<boolean>;
|
|
21
|
+
removeSource: (id: string) => Promise<boolean>;
|
|
22
|
+
scanSource: (id: string, source: string) => Promise<boolean>;
|
|
23
|
+
readonly enabled: boolean;
|
|
24
|
+
readonly css: string;
|
|
25
|
+
readonly candidateCount: number;
|
|
26
|
+
};
|
|
27
|
+
export declare function updateTailwindForWatchChange(state: TailwindScannerState, id: string, event: TailwindWatchEvent, configure: () => Promise<boolean>): Promise<boolean>;
|
|
28
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/vite/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAA;AAKvC,eAAO,MAAM,gBAAgB,UAAU,CAAA;AACvC,eAAO,MAAM,mBAAmB,iCAAiC,CAAA;AACjE,eAAO,MAAM,oBAAoB,mCAA6B,CAAA;AAE9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAMzD;AAQD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEhF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AA2B/D;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B;;0BA0B5B,MAAM,kBACA,MAAM,UACd,mBAAmB,GAAG,IAAI,GAAG,SAAS,gBAChC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,iBACtB,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KACnC,OAAO,CAAC,OAAO,CAAC;uBAiGa,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;qBAT3B,MAAM,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;;;;EA6BxE;AAED,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,oBAAoB,EAC3B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
package/types/vite.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tailwind build integration for Tamagui.
|
|
3
|
+
*
|
|
4
|
+
* Applications that author with `@tamagui/tailwind` change only the plugin import:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { tamaguiPlugin } from '@tamagui/tailwind/vite'
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* This wraps the base `@tamagui/vite-plugin` compiler plugins, reuses their one
|
|
11
|
+
* Tamagui config loader, adds `@tamagui/tailwind` to compiler component provenance,
|
|
12
|
+
* and adds the official Tailwind scanner/compiler for the candidates Tamagui's own
|
|
13
|
+
* grammar does not claim. Nothing here is reachable from the `@tamagui/tailwind`
|
|
14
|
+
* root: the runtime package never imports the Tailwind engine or Vite.
|
|
15
|
+
*/
|
|
16
|
+
import { type TamaguiVitePluginOptions } from '@tamagui/vite-plugin/internal';
|
|
17
|
+
import type { PluginOption } from 'vite';
|
|
18
|
+
export { TAILWIND_RESOLVED_ID, TAILWIND_VERSION, TAILWIND_VIRTUAL_ID } from './vite/state';
|
|
19
|
+
export declare function tamaguiPlugin(options?: TamaguiVitePluginOptions): PluginOption;
|
|
20
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,+BAA+B,CAAA;AAEtC,OAAO,KAAK,EAGV,YAAY,EAGb,MAAM,MAAM,CAAA;AAWb,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AA4J1F,wBAAgB,aAAa,CAAC,OAAO,GAAE,wBAA6B,GAAG,YAAY,CASlF"}
|
package/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# @tamagui/tailwind
|