@brickflow/ui 0.0.56 → 0.0.58
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.d.mts +4 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +35 -7
- package/dist/runtime/brickflow-ui.d.ts +1 -0
- package/dist/runtime/components/Button/index.vue +5 -3
- package/dist/runtime/components/Dialog/DemoContent.vue +33 -0
- package/dist/runtime/components/Dialog/DemoForm.vue +54 -0
- package/dist/runtime/components/Dialog/DemoSimple.vue +23 -0
- package/dist/runtime/components/Dialog/DemoStack.vue +41 -0
- package/dist/runtime/components/Dialog/Host.vue +654 -0
- package/dist/runtime/components/Dialog/basic.demo.vue +27 -0
- package/dist/runtime/components/Dialog/form.demo.vue +34 -0
- package/dist/runtime/components/Dialog/index.vue +53 -0
- package/dist/runtime/components/Dialog/scroll.demo.vue +27 -0
- package/dist/runtime/components/Dialog/stack.demo.vue +19 -0
- package/dist/runtime/components/Form/index.vue +46 -1
- package/dist/runtime/components/Form/login.demo.vue +12 -1
- package/dist/runtime/components/Form/rules.demo.vue +108 -0
- package/dist/runtime/components/Icon/gallery.demo.vue +1 -1
- package/dist/runtime/components/Icon/index.vue +3 -1
- package/dist/runtime/components/Input/index.vue +151 -27
- package/dist/runtime/components/Input/label.demo.vue +15 -3
- package/dist/runtime/components/Input/mask.demo.vue +73 -0
- package/dist/runtime/components/Input/variants.demo.vue +16 -0
- package/dist/runtime/components/InputNumber/controls.demo.vue +145 -0
- package/dist/runtime/components/InputNumber/denominator.demo.vue +1 -1
- package/dist/runtime/components/InputNumber/index.vue +29 -8
- package/dist/runtime/components/TransitionSize/duration.demo.vue +88 -0
- package/dist/runtime/components/TransitionSize/flex.demo.vue +112 -0
- package/dist/runtime/components/TransitionSize/height.demo.vue +88 -0
- package/dist/runtime/components/TransitionSize/index.vue +69 -27
- package/dist/runtime/components/TransitionSize/width.demo.vue +88 -0
- package/dist/runtime/composables/useBrickflow.d.ts +2 -0
- package/dist/runtime/composables/useDialog.d.ts +38 -0
- package/dist/runtime/composables/useDialog.js +40 -0
- package/dist/runtime/composables/useFieldRules.d.ts +16 -0
- package/dist/runtime/composables/useFieldRules.js +42 -0
- package/dist/runtime/composables/useScreen.d.ts +8 -0
- package/dist/runtime/plugins/dialog.d.ts +3 -0
- package/dist/runtime/plugins/dialog.js +22 -0
- package/dist/runtime/tailwind.d.ts +1 -1
- package/dist/runtime/tailwind.js +2 -2
- package/dist/runtime/utils/rules.d.ts +34 -0
- package/dist/runtime/utils/rules.js +68 -0
- package/dist/types.d.mts +4 -0
- package/package.json +7 -6
- package/dist/runtime/icon-font.d.ts +0 -4
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as nuxt_schema from 'nuxt/schema';
|
|
2
2
|
export { BrickflowConfig } from '../dist/runtime/composables/useBrickflow.js';
|
|
3
|
+
export { DialogController, DialogHandle, DialogOptions } from '../dist/runtime/composables/useDialog.js';
|
|
3
4
|
export { BrickflowI18n, BrickflowRouteLocationParam } from '../dist/runtime/composables/useTranslate.js';
|
|
5
|
+
export { Rule, RuleMessages, rule } from '../dist/runtime/utils/rules.js';
|
|
4
6
|
|
|
5
7
|
interface ModuleOptions {
|
|
6
8
|
componentPrefix?: string;
|
|
@@ -9,7 +11,7 @@ interface ModuleOptions {
|
|
|
9
11
|
theme?: boolean;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
declare const _default:
|
|
14
|
+
declare const _default: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
13
15
|
|
|
14
16
|
export { _default as default };
|
|
15
17
|
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, resolvePath, addTypeTemplate, addTemplate, updateTemplates, addImports, addComponentsDir } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, resolvePath, addTypeTemplate, addTemplate, updateTemplates, addImports, addPlugin, addComponentsDir } from '@nuxt/kit';
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
4
|
import { mkdir, access, readFile, writeFile, readdir } from 'node:fs/promises';
|
|
5
5
|
import { join, parse, basename, extname, dirname, resolve, relative } from 'node:path';
|
|
6
6
|
import { isBrickflowUiStyleReference, getBrickflowUiStyleReferencePath, defineBrickflowUi } from '../dist/runtime/tailwind.js';
|
|
7
7
|
import { generateFonts, FontAssetType, OtherAssetType } from 'fantasticon';
|
|
8
|
+
export { rule } from '../dist/runtime/utils/rules.js';
|
|
8
9
|
|
|
9
10
|
const getIconFontCssPath$1 = (outputDir, name) => join(outputDir, `${name}.minify.css`);
|
|
10
11
|
async function generateIcons({ inputDir, name, outputDir }) {
|
|
@@ -150,7 +151,9 @@ const resolveUiStyleConfigPath = (id, path) => {
|
|
|
150
151
|
return path;
|
|
151
152
|
}
|
|
152
153
|
const componentName = basename(cleanId, extname(cleanId));
|
|
153
|
-
const
|
|
154
|
+
const parentName = basename(dirname(cleanId));
|
|
155
|
+
const isComponentFile = basename(dirname(dirname(cleanId))) === "components";
|
|
156
|
+
const configName = isComponentFile || componentName === "index" || componentName.endsWith(".demo") ? parentName : componentName;
|
|
154
157
|
return [toCamelCase(configName), ...path];
|
|
155
158
|
};
|
|
156
159
|
const resolveStyleValue = (styles, id, path) => {
|
|
@@ -177,7 +180,7 @@ const resolveUiConfigStyleReferences = (value, styles, id) => {
|
|
|
177
180
|
}
|
|
178
181
|
return styleValue;
|
|
179
182
|
}
|
|
180
|
-
if (typeof value === "string") {
|
|
183
|
+
if (typeof value === "string" || typeof value === "boolean" || typeof value === "number") {
|
|
181
184
|
return value;
|
|
182
185
|
}
|
|
183
186
|
return Object.fromEntries(
|
|
@@ -266,7 +269,7 @@ const collectUiStylePathsFromCode = (code) => {
|
|
|
266
269
|
return paths.filter((path) => path.length > 0);
|
|
267
270
|
};
|
|
268
271
|
const collectUiConfigValuePaths = (value, prefix) => {
|
|
269
|
-
if (typeof value === "string" || isBrickflowUiStyleReference(value)) {
|
|
272
|
+
if (typeof value === "string" || typeof value === "boolean" || typeof value === "number" || isBrickflowUiStyleReference(value)) {
|
|
270
273
|
return [prefix];
|
|
271
274
|
}
|
|
272
275
|
return Object.entries(value).flatMap(
|
|
@@ -357,7 +360,7 @@ const collectUiStylePathsWithConfig = (code, id, config) => {
|
|
|
357
360
|
const requiredPath = [...referencePath.slice(0, prefixLength), ...configPath.slice(1)];
|
|
358
361
|
configReferences.push(`UI_STYLE.${requiredPath.join(".")}`);
|
|
359
362
|
}
|
|
360
|
-
} else if (typeof value
|
|
363
|
+
} else if (typeof value === "object") {
|
|
361
364
|
for (const [key, childValue] of Object.entries(value)) {
|
|
362
365
|
addConfigReferences(childValue, [...configPath, key]);
|
|
363
366
|
}
|
|
@@ -394,7 +397,16 @@ const createUiConfigLiteralTypeDeclaration = (paths, config) => [
|
|
|
394
397
|
"declare global {",
|
|
395
398
|
...renderInterfaceDeclaration("BrickflowUiConfigLiteralPaths", paths, void 0, (path) => {
|
|
396
399
|
const value = config ? readPath(config, path) : void 0;
|
|
397
|
-
|
|
400
|
+
if (typeof value === "string") {
|
|
401
|
+
return toStringLiteral(value);
|
|
402
|
+
}
|
|
403
|
+
if (typeof value === "boolean") {
|
|
404
|
+
return String(value);
|
|
405
|
+
}
|
|
406
|
+
if (typeof value === "number") {
|
|
407
|
+
return String(value);
|
|
408
|
+
}
|
|
409
|
+
return "string";
|
|
398
410
|
}),
|
|
399
411
|
"}",
|
|
400
412
|
"",
|
|
@@ -805,6 +817,19 @@ const module$1 = defineNuxtModule({
|
|
|
805
817
|
].join("\n");
|
|
806
818
|
}
|
|
807
819
|
});
|
|
820
|
+
addTemplate({
|
|
821
|
+
filename: "brickflow/brickflow-ui-icons.d.mts",
|
|
822
|
+
getContents: async () => {
|
|
823
|
+
const iconNames = iconFont ? await getIconFontNames(iconFont.inputDir) : [];
|
|
824
|
+
const iconNameType = iconNames.length ? iconNames.map((name) => JSON.stringify(name)).join(" | ") : "never";
|
|
825
|
+
return [
|
|
826
|
+
`export type IconName = ${iconNameType}`,
|
|
827
|
+
"export const firstIconName: IconName",
|
|
828
|
+
"export const iconNames: readonly IconName[]",
|
|
829
|
+
""
|
|
830
|
+
].join("\n");
|
|
831
|
+
}
|
|
832
|
+
});
|
|
808
833
|
const uiConfigTemplate = addTemplate({
|
|
809
834
|
filename: "brickflow/brickflow-ui-config.mjs",
|
|
810
835
|
getContents: () => [
|
|
@@ -977,6 +1002,8 @@ const module$1 = defineNuxtModule({
|
|
|
977
1002
|
viteConfig.plugins.push(tailwindcss());
|
|
978
1003
|
});
|
|
979
1004
|
addImports([
|
|
1005
|
+
{ as: "useDialog", from: resolver.resolve("./runtime/composables/useDialog"), name: "useDialog" },
|
|
1006
|
+
{ from: resolver.resolve("./runtime/utils/rules"), name: "rule" },
|
|
980
1007
|
...["provideBrickflow", "useBrickflow", "BrickflowConfig"].map((name) => ({
|
|
981
1008
|
from: resolver.resolve("./runtime/composables/useBrickflow"),
|
|
982
1009
|
name,
|
|
@@ -992,8 +1019,9 @@ const module$1 = defineNuxtModule({
|
|
|
992
1019
|
type: name !== "useTheme"
|
|
993
1020
|
}))
|
|
994
1021
|
]);
|
|
1022
|
+
addPlugin({ mode: "all", src: resolver.resolve("./runtime/plugins/dialog.ts") });
|
|
995
1023
|
addComponentsDir({
|
|
996
|
-
ignore: ["**/*.demo.vue"],
|
|
1024
|
+
ignore: ["**/*.demo.vue", "**/Dialog/Host.vue", "**/Dialog/DemoContent.vue"],
|
|
997
1025
|
path: resolver.resolve("./runtime/components"),
|
|
998
1026
|
pathPrefix: false,
|
|
999
1027
|
prefix: options.componentPrefix ?? "Brick"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { IconName } from '#brickflow-ui'
|
|
3
|
+
|
|
2
4
|
const UI_CONFIG = defineUiConfig<{
|
|
3
5
|
colorClasses: Record<string, Record<string, string>>
|
|
4
6
|
colorDefault: string
|
|
5
|
-
loadingIconName:
|
|
7
|
+
loadingIconName: IconName
|
|
6
8
|
loadingIconTransition: string
|
|
7
9
|
sizeClasses: Record<string, string>
|
|
8
10
|
sizeDefault: string
|
|
@@ -28,14 +30,14 @@
|
|
|
28
30
|
block?: boolean
|
|
29
31
|
color?: ButtonColor
|
|
30
32
|
disabled?: boolean
|
|
31
|
-
icon?:
|
|
33
|
+
icon?: IconName
|
|
32
34
|
loading?: boolean
|
|
33
35
|
rounded?: boolean
|
|
34
36
|
size?: ButtonSize
|
|
35
37
|
square?: boolean
|
|
36
38
|
target?: '_blank' | '_parent' | '_self' | '_top' | null | (Record<string, never> & string)
|
|
37
39
|
to?: RouteLocationRaw
|
|
38
|
-
trailingIcon?:
|
|
40
|
+
trailingIcon?: IconName
|
|
39
41
|
type?: 'button' | 'reset' | 'submit'
|
|
40
42
|
variant?: ButtonVariant
|
|
41
43
|
}>(),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useDialog } from '../../composables/useDialog'
|
|
3
|
+
import Button from '../Button/index.vue'
|
|
4
|
+
|
|
5
|
+
defineProps<{ text: string }>()
|
|
6
|
+
|
|
7
|
+
const dialog = useDialog()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="min-h-0 space-y-4 overflow-y-auto bg-linear-to-tr from-violet-900 to-gray-800 p-5">
|
|
12
|
+
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
13
|
+
<p class="font-semibold">{{ text }}</p>
|
|
14
|
+
<Button
|
|
15
|
+
color="plain"
|
|
16
|
+
@click="dialog.close()"
|
|
17
|
+
>
|
|
18
|
+
Close
|
|
19
|
+
</Button>
|
|
20
|
+
</div>
|
|
21
|
+
<p class="text-sm text-zinc-200">Scroll this content, then swipe down from the top edge to move the sheet.</p>
|
|
22
|
+
<ul class="divide-y divide-white/10">
|
|
23
|
+
<li
|
|
24
|
+
v-for="i in 40"
|
|
25
|
+
:key="i"
|
|
26
|
+
class="flex items-center justify-between gap-4 py-2 text-sm"
|
|
27
|
+
>
|
|
28
|
+
<span>Activity {{ i }}</span>
|
|
29
|
+
<span class="text-zinc-300">{{ i % 2 ? 'Updated' : 'Created' }}</span>
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { useDialog } from '../../composables/useDialog'
|
|
5
|
+
import Button from '../Button/index.vue'
|
|
6
|
+
import Input from '../Input/index.vue'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{ onSave: (name: string) => void }>()
|
|
9
|
+
const dialog = useDialog()
|
|
10
|
+
const name = ref('')
|
|
11
|
+
|
|
12
|
+
function save(): void {
|
|
13
|
+
const value = name.value.trim()
|
|
14
|
+
if (!value) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
props.onSave(value)
|
|
18
|
+
dialog.close()
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<form
|
|
24
|
+
class="space-y-4 p-5"
|
|
25
|
+
@submit.prevent="save"
|
|
26
|
+
>
|
|
27
|
+
<div class="space-y-1">
|
|
28
|
+
<h2 class="font-semibold">Create a project</h2>
|
|
29
|
+
<p class="text-sm text-zinc-300">Form state belongs to the dialog content.</p>
|
|
30
|
+
</div>
|
|
31
|
+
<Input
|
|
32
|
+
:value="name"
|
|
33
|
+
label="Project name"
|
|
34
|
+
placeholder="My project"
|
|
35
|
+
autocomplete="off"
|
|
36
|
+
@input="name = $event"
|
|
37
|
+
/>
|
|
38
|
+
<div class="flex flex-wrap gap-2">
|
|
39
|
+
<Button
|
|
40
|
+
type="submit"
|
|
41
|
+
:disabled="!name.trim()"
|
|
42
|
+
>
|
|
43
|
+
Save project
|
|
44
|
+
</Button>
|
|
45
|
+
<Button
|
|
46
|
+
color="plain"
|
|
47
|
+
type="button"
|
|
48
|
+
@click="dialog.close()"
|
|
49
|
+
>
|
|
50
|
+
Cancel
|
|
51
|
+
</Button>
|
|
52
|
+
</div>
|
|
53
|
+
</form>
|
|
54
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useDialog } from '../../composables/useDialog'
|
|
3
|
+
import Button from '../Button/index.vue'
|
|
4
|
+
|
|
5
|
+
defineProps<{ title: string }>()
|
|
6
|
+
|
|
7
|
+
const dialog = useDialog()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="space-y-4 p-5">
|
|
12
|
+
<div class="space-y-1">
|
|
13
|
+
<h2 class="font-semibold">{{ title }}</h2>
|
|
14
|
+
<p class="text-sm text-zinc-300">The placement changes; this content component stays the same.</p>
|
|
15
|
+
</div>
|
|
16
|
+
<Button
|
|
17
|
+
color="plain"
|
|
18
|
+
@click="dialog.close()"
|
|
19
|
+
>
|
|
20
|
+
Close
|
|
21
|
+
</Button>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineAsyncComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { useDialog } from '../../composables/useDialog'
|
|
5
|
+
import Button from '../Button/index.vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{ level: number }>()
|
|
8
|
+
const dialog = useDialog()
|
|
9
|
+
const LazyDemoStack = defineAsyncComponent(() => import('./DemoStack.vue'))
|
|
10
|
+
|
|
11
|
+
function openNext(): void {
|
|
12
|
+
dialog.open(LazyDemoStack, { level: props.level + 1 })
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="space-y-4 p-5">
|
|
18
|
+
<div class="space-y-1">
|
|
19
|
+
<h2 class="font-semibold">Dialog {{ level }}</h2>
|
|
20
|
+
<p class="text-sm text-zinc-300">
|
|
21
|
+
Stack depth: {{ dialog.stack.length }}. Closing the top reveals the previous one.
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="flex flex-wrap gap-2">
|
|
25
|
+
<Button @click="openNext">Open on top</Button>
|
|
26
|
+
<Button
|
|
27
|
+
color="plain"
|
|
28
|
+
@click="dialog.close()"
|
|
29
|
+
>
|
|
30
|
+
Close top
|
|
31
|
+
</Button>
|
|
32
|
+
<Button
|
|
33
|
+
color="plain"
|
|
34
|
+
variant="ghost"
|
|
35
|
+
@click="dialog.closeAll()"
|
|
36
|
+
>
|
|
37
|
+
Close all
|
|
38
|
+
</Button>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|