@brickflow/ui 0.0.34 → 0.0.36
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/module.json +1 -1
- package/dist/module.mjs +25 -24
- package/dist/runtime/components/Button/variants.demo.vue +1 -1
- package/dist/runtime/pages/ui.vue +4 -0
- package/dist/runtime/tailwind.d.ts +7 -3
- package/dist/runtime/tailwind.js +1 -1
- package/dist/runtime/ui-page.css +1 -0
- package/dist/runtime/ui.css +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import tailwindcss from '@tailwindcss/vite';
|
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
4
|
import { readdir, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { join, basename, extname, dirname, resolve, relative } from 'node:path';
|
|
6
|
-
import { isBrickflowUiStyleReference, getBrickflowUiStyleReferencePath,
|
|
6
|
+
import { isBrickflowUiStyleReference, getBrickflowUiStyleReferencePath, defineBrickflowUi } from '../dist/runtime/tailwind.js';
|
|
7
7
|
import { generateFonts, FontAssetType, OtherAssetType } from 'fantasticon';
|
|
8
8
|
|
|
9
9
|
const ICON_FILE_PATTERN = /\.svg$/i;
|
|
@@ -157,25 +157,23 @@ const replaceUiConfigMacros = (code, config, styles, id, error) => {
|
|
|
157
157
|
return result + code.slice(cursor);
|
|
158
158
|
}
|
|
159
159
|
const genericStart = start + UI_CONFIG_MACRO.length;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (depth === 0) {
|
|
175
|
-
break;
|
|
160
|
+
let callStart = genericStart;
|
|
161
|
+
if (code[genericStart] === "<") {
|
|
162
|
+
let depth = 0;
|
|
163
|
+
let index = genericStart;
|
|
164
|
+
for (; index < code.length; index += 1) {
|
|
165
|
+
if (code[index] === "<") {
|
|
166
|
+
depth += 1;
|
|
167
|
+
}
|
|
168
|
+
if (code[index] === ">") {
|
|
169
|
+
depth -= 1;
|
|
170
|
+
}
|
|
171
|
+
if (depth === 0) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
176
174
|
}
|
|
175
|
+
callStart = index + 1;
|
|
177
176
|
}
|
|
178
|
-
let callStart = index + 1;
|
|
179
177
|
while (/\s/u.test(code[callStart] ?? "")) {
|
|
180
178
|
callStart += 1;
|
|
181
179
|
}
|
|
@@ -396,14 +394,17 @@ const brickflowUiStylePlugin = (options) => ({
|
|
|
396
394
|
},
|
|
397
395
|
name: "brickflow-ui-style",
|
|
398
396
|
async transform(code, id) {
|
|
399
|
-
|
|
397
|
+
const cleanId = id.split("?")[0] ?? id;
|
|
398
|
+
const isVirtualModule = cleanId.startsWith("\0") || cleanId.startsWith("virtual:");
|
|
399
|
+
const isVueSubmodule = cleanId.endsWith(".vue") && id.includes("?vue");
|
|
400
|
+
if (isVirtualModule || isVueSubmodule && !code.includes(UI_CONFIG_MACRO) || !SCRIPT_FILE_PATTERN.test(id) || !code.includes("UI_STYLE.") && !code.includes("UI_CONFIG.") && !code.includes(UI_CONFIG_MACRO)) {
|
|
400
401
|
return null;
|
|
401
402
|
}
|
|
402
403
|
this.addWatchFile?.(options.configPath);
|
|
403
404
|
const styles = await options.getStyles();
|
|
404
405
|
const config = await options.getConfig();
|
|
405
|
-
const isConfigFile = normalizePath(
|
|
406
|
-
const hasUiConfigMacro = code.includes(UI_CONFIG_MACRO);
|
|
406
|
+
const isConfigFile = normalizePath(cleanId) === normalizePath(options.configPath);
|
|
407
|
+
const hasUiConfigMacro = cleanId.endsWith(".vue") && code.includes(UI_CONFIG_MACRO);
|
|
407
408
|
let changed = false;
|
|
408
409
|
const codeWithUiConfigMacros = hasUiConfigMacro ? replaceUiConfigMacros(code, config, styles, id, this.error.bind(this)) : code;
|
|
409
410
|
if (codeWithUiConfigMacros !== code) {
|
|
@@ -678,7 +679,7 @@ const module$1 = defineNuxtModule({
|
|
|
678
679
|
);
|
|
679
680
|
};
|
|
680
681
|
const loadUiConfig = async () => {
|
|
681
|
-
const validateConfig =
|
|
682
|
+
const validateConfig = defineBrickflowUi;
|
|
682
683
|
return validateConfig(
|
|
683
684
|
await loadConfig.import(resolvedConfigPath).catch(() => ({}))
|
|
684
685
|
);
|
|
@@ -755,10 +756,10 @@ const module$1 = defineNuxtModule({
|
|
|
755
756
|
const uiConfigTemplate = addTemplate({
|
|
756
757
|
filename: "brickflow/brickflow-ui-config.mjs",
|
|
757
758
|
getContents: () => [
|
|
758
|
-
`import {
|
|
759
|
+
`import { defineBrickflowUi } from ${JSON.stringify(resolver.resolve("./runtime/tailwind").replaceAll("\\", "/"))}`,
|
|
759
760
|
`import rawConfig from ${JSON.stringify(resolvedConfigPath.replaceAll("\\", "/"))}`,
|
|
760
761
|
"",
|
|
761
|
-
"const config =
|
|
762
|
+
"const config = defineBrickflowUi(rawConfig)",
|
|
762
763
|
"",
|
|
763
764
|
"export const UI_STYLE = config.uiStyles",
|
|
764
765
|
"export const UI_CONFIG = config.uiConfig",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
const UI_CONFIG = defineUiConfig();
|
|
3
2
|
export const uiDemo = {
|
|
4
3
|
title: "Color & Variants"
|
|
5
4
|
};
|
|
@@ -7,6 +6,7 @@ export const uiDemo = {
|
|
|
7
6
|
|
|
8
7
|
<script setup>
|
|
9
8
|
import Button from "./index.vue";
|
|
9
|
+
const UI_CONFIG = defineUiConfig();
|
|
10
10
|
const colors = Object.entries(UI_CONFIG.colorClasses).map(([name, classes]) => ({
|
|
11
11
|
name,
|
|
12
12
|
variants: Object.keys(classes)
|
|
@@ -721,6 +721,10 @@ watch(
|
|
|
721
721
|
</main>
|
|
722
722
|
</template>
|
|
723
723
|
|
|
724
|
+
<style src="../ui-page.css">
|
|
725
|
+
|
|
726
|
+
</style>
|
|
727
|
+
|
|
724
728
|
<style module>
|
|
725
729
|
:global(.ui-code-comment){color:var(--color-zinc-500)}:global(.ui-code-string){color:var(--color-emerald-400)}:global(.ui-code-keyword){color:var(--color-blue-400)}:global(.ui-code-number){color:var(--color-amber-300)}:global(.ui-code-tag){color:var(--color-cyan-500)}:global(.ui-code-attribute){color:var(--color-violet-300)}:global(.ui-code-punctuation){color:var(--color-zinc-400)}:global(.ui-color-swatch){background:var(--ui-color-swatch);border:1px solid hsla(0,0%,100%,.1);border-radius:.2rem;display:inline-block;height:.65rem;margin-right:.25rem;opacity:.85;vertical-align:-.1rem;width:.65rem}.mobileNavigation{width:min(18rem,calc(100vw - 3rem))}@media (width >= 40rem){.styleGrid{grid-template-columns:minmax(12rem,.8fr) minmax(0,1.8fr)}}.styleValue :global(.ui-code-keyword){color:var(--color-zinc-500)}.styleValue :global(.ui-code-attribute){color:var(--color-zinc-200)}.styleValue :global(.ui-code-string){color:var(--color-zinc-300)}.styleValue :global(.ui-code-number){color:var(--color-zinc-400)}.styleValue :global(.ui-code-punctuation){color:var(--color-zinc-500)}
|
|
726
730
|
</style>
|
|
@@ -10,6 +10,10 @@ export type BrickflowUiConfigValue = BrickflowUiConfigObject | BrickflowUiStyleR
|
|
|
10
10
|
export interface BrickflowUiStyleReference {
|
|
11
11
|
readonly [UI_STYLE_REFERENCE]: readonly string[];
|
|
12
12
|
}
|
|
13
|
+
/** A chainable compile-time reference to a string in `uiStyles`. */
|
|
14
|
+
export type BrickflowUiStyleReferenceValue = string & {
|
|
15
|
+
readonly [key: string]: any;
|
|
16
|
+
};
|
|
13
17
|
declare global {
|
|
14
18
|
interface BrickflowUiConfigSchema {
|
|
15
19
|
}
|
|
@@ -41,12 +45,12 @@ type BrickflowUiConfigValidation<TConfig extends BrickflowUiConfigObject> = keyo
|
|
|
41
45
|
export declare const emptyUiStyles: {};
|
|
42
46
|
export declare const emptyUiConfig: {};
|
|
43
47
|
export declare const emptyBrickflowUiConfig: BrickflowUiConfig<typeof emptyUiStyles, typeof emptyUiConfig>;
|
|
44
|
-
export declare function
|
|
45
|
-
export declare function
|
|
48
|
+
export declare function defineBrickflowUi(): BrickflowUiConfig<typeof emptyUiStyles, typeof emptyUiConfig>;
|
|
49
|
+
export declare function defineBrickflowUi<const TStyles extends BrickflowUiConfigStylePaths, const TConfig extends BrickflowUiConfigObject>(config: BrickflowUiConfigContext & BrickflowUiConfigInput<BrickflowUiStrictStyles<TStyles>, TConfig> & BrickflowUiConfigValidation<TConfig>): BrickflowUiConfig<TStyles, TConfig>;
|
|
46
50
|
export declare const uiStyles: {};
|
|
47
51
|
export declare const uiConfig: {};
|
|
48
52
|
/** A compile-time reference to a value in `uiStyles`, for use inside `uiConfig`. */
|
|
49
|
-
export declare const UI_STYLE:
|
|
53
|
+
export declare const UI_STYLE: BrickflowUiStyleReferenceValue;
|
|
50
54
|
export declare const isBrickflowUiStyleReference: (value: unknown) => value is BrickflowUiStyleReference;
|
|
51
55
|
export declare const getBrickflowUiStyleReferencePath: (value: BrickflowUiStyleReference) => readonly string[];
|
|
52
56
|
export default emptyBrickflowUiConfig;
|
package/dist/runtime/tailwind.js
CHANGED
|
@@ -5,7 +5,7 @@ export const emptyBrickflowUiConfig = {
|
|
|
5
5
|
uiConfig: emptyUiConfig,
|
|
6
6
|
uiStyles: emptyUiStyles
|
|
7
7
|
};
|
|
8
|
-
export function
|
|
8
|
+
export function defineBrickflowUi(config = {}) {
|
|
9
9
|
const uiConfig2 = config.uiConfig ?? emptyUiConfig;
|
|
10
10
|
const uiStyles2 = config.uiStyles ?? emptyUiStyles;
|
|
11
11
|
validateUiConfig(uiConfig2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";@source "./pages";@source "./components";
|
package/dist/runtime/ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@theme{--breakpoint-*:initial}@custom-variant dk (@media (width >= 1440px));@custom-variant lp (@media (width < 1440px));@custom-variant tb (@media (width < 1024px));@custom-variant mb (@media (width < 768px));@custom-variant ms (@media (width < 480px));@media (width < 1440px){.dkHidden{display:none!important}}@media (width < 1024px),(width >= 1440px){.lpHidden{display:none!important}}@media (width < 768px),(width >= 1024px){.tbHidden{display:none!important}}@media (width < 480px),(width >= 768px){.mbHidden{display:none!important}}@media (width >= 480px){.msHidden{display:none!important}}
|
|
1
|
+
@theme{--breakpoint-*:initial}@custom-variant dk (@media (width >= 1440px));@custom-variant lp (@media (width < 1440px));@custom-variant tb (@media (width < 1024px));@custom-variant mb (@media (width < 768px));@custom-variant ms (@media (width < 480px));@media (width < 1440px){.dkHidden{display:none!important}}@media (width < 1024px),(width >= 1440px){.lpHidden{display:none!important}}@media (width < 768px),(width >= 1024px){.tbHidden{display:none!important}}@media (width < 480px),(width >= 768px){.mbHidden{display:none!important}}@media (width >= 480px){.msHidden{display:none!important}}
|