vueless 0.0.7 → 0.0.9

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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
7
7
  "author": "Johnny Grid",
8
8
  "main": "index.js",
9
9
  "type": "module",
10
+ "files": ["src"],
10
11
  "scripts": {
11
12
  "lint": "eslint --ext .vue,.js,.ts --no-fix --ignore-path .eslintignore src/ .storybook/ tests/",
12
13
  "lint:fix": "eslint --ext .vue,.js,.ts --fix --ignore-path .eslintignore src/ .storybook/ tests/",
@@ -14,9 +15,9 @@
14
15
  "release": "release-it patch --ci",
15
16
  "release:production": "release-it minor --ci",
16
17
  "release:production-major": "release-it major --ci",
17
- "sb:dev-full": "STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
18
+ "sb:dev-full": "STORYBOOK_VUELESS_ENV=1 STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
18
19
  "sb:dev": "storybook dev -p 6006 --docs --no-open",
19
- "sb:build": "NO_PWA=1 storybook build --docs",
20
+ "sb:build": "STORYBOOK_VUELESS_ENV=1 storybook build",
20
21
  "sb:preview": "vite preview --host --outDir=storybook-static",
21
22
  "vueless:update": "yarn add -D file:../vite-plugin-vueless file:../vueless-storybook",
22
23
  "postinstall": "node .web-types-gen"
@@ -43,6 +44,7 @@
43
44
  "@vueless/storybook": "file:../vueless-storybook",
44
45
  "@vueless/vite-plugin": "file:../vite-plugin-vueless",
45
46
  "autoprefixer": "^10.4.19",
47
+ "cssnano": "^6.1.2",
46
48
  "eslint": "^8.55.0",
47
49
  "eslint-plugin-node": "^11.1.0",
48
50
  "eslint-plugin-prettier": "^5.0.1",
@@ -56,9 +58,10 @@
56
58
  "vite": "^5.1.1",
57
59
  "vite-plugin-compression": "^0.5.1",
58
60
  "vite-plugin-eslint": "^1.8.1",
59
- "vue": "^3.4.19",
60
- "vue-i18n": "^9.9.1",
61
- "vue-router": "^4.2.5"
61
+ "vue": "^3.4.19"
62
+ },
63
+ "resolutions": {
64
+ "string-width": "4.2.3"
62
65
  },
63
66
  "repository": {
64
67
  "type": "git",
@@ -82,9 +82,6 @@ export default class TailwindServiceDefault {
82
82
  "./src/**/*.{js,ts,jsx,tsx,vue}",
83
83
  "./vueless.config.{js,ts}",
84
84
  "./node_modules/vueless/**/*.{js,ts,vue}",
85
- // TODO: remove it after creating the package
86
- "./.vueless-layouts/**/*.{js,ts,vue}",
87
- "./.vueless-services/**/*.{js,ts,vue}",
88
85
  ],
89
86
  safelist: isProd ? prodSafelist : devSafelist,
90
87
  theme: {
@@ -93,13 +90,6 @@ export default class TailwindServiceDefault {
93
90
  brand: { ...brandPalette, DEFAULT: brandColor },
94
91
  gray: grayPalette,
95
92
  },
96
- spacing: {
97
- "safe-top": "env(safe-area-inset-top)",
98
- "safe-bottom": "env(safe-area-inset-bottom)",
99
- "safe-left": "env(safe-area-inset-left)",
100
- "safe-right": "env(safe-area-inset-right)",
101
- "mobile-menu-height": "3.5rem",
102
- },
103
93
  fontSize: {
104
94
  "2xs": ["0.625rem", "0.875rem"], // 10px
105
95
  },
@@ -3,7 +3,7 @@ import { defineConfig } from "cva";
3
3
  import { twMerge } from "tailwind-merge";
4
4
  import colors from "tailwindcss/colors";
5
5
  import { brandColors, grayColors } from "../service.tailwind";
6
- import vuelessConfig from "/vueless.config.js";
6
+ import vuelessConfig from "../../../../vueless.config.js";
7
7
 
8
8
  /*
9
9
  Export cva (class variance authority) methods extended with tailwind-merge.
@@ -112,33 +112,33 @@ const props = defineProps({
112
112
  },
113
113
  });
114
114
 
115
- const labelConfig = {
116
- wrapper: {
117
- base: `
118
- rounded-lg border border-solid border-gray-300 cursor-pointer relative w-full
119
- hover:border-gray-400 focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15]
120
- px-6 py-4`,
121
- },
122
- label: {
123
- base: "h-full w-full cursor-pointer",
124
- variants: {
125
- placement: {
126
- topInside: "left-0 !top-0",
127
- },
128
- },
129
- },
130
- description: {
131
- variants: {
132
- placement: {
133
- topInside: "pl-0",
134
- },
135
- },
136
- },
137
- };
115
+ // const labelConfig = {
116
+ // wrapper: {
117
+ // base: `
118
+ // rounded-lg border border-solid border-gray-300 cursor-pointer relative w-full
119
+ // hover:border-gray-400 focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15]
120
+ // px-6 py-4`,
121
+ // },
122
+ // label: {
123
+ // base: "h-full w-full cursor-pointer",
124
+ // variants: {
125
+ // placement: {
126
+ // topInside: "left-0 !top-0",
127
+ // },
128
+ // },
129
+ // },
130
+ // description: {
131
+ // variants: {
132
+ // placement: {
133
+ // topInside: "pl-0",
134
+ // },
135
+ // },
136
+ // },
137
+ // };
138
138
 
139
139
  const emit = defineEmits(["update:modelValue"]);
140
140
 
141
- const { radioAttrs, iconAttrs, wrapperAttrs, labelAttrs } = useAttrs(props);
141
+ const { radioAttrs, iconAttrs, wrapperAttrs /* labelAttrs */ } = useAttrs(props);
142
142
 
143
143
  const isMobileDevice = computed(() => {
144
144
  return store.getters["breakpoint/isMobileDevice"];
@@ -147,12 +147,22 @@ const { config, wrapperAttrs, containerAttrs, iconAttrs } = useAttrs(props);
147
147
  let generatedIcons = [];
148
148
 
149
149
  if (import.meta.env.PROD) {
150
- generatedIcons = Object.entries(
151
- import.meta.glob(`../../../../src/assets/images/.generated/**/*.svg`, {
152
- eager: true,
153
- query: "?component",
154
- }),
155
- );
150
+ // when building storybook from inside the package (only for Vueless contributors).
151
+ if (import.meta.env.STORYBOOK_VUELESS_ENV) {
152
+ generatedIcons = Object.entries(
153
+ import.meta.glob(`../assets/images/.generated/**/*.svg`, {
154
+ eager: true,
155
+ query: "?component",
156
+ }),
157
+ );
158
+ } else {
159
+ generatedIcons = Object.entries(
160
+ import.meta.glob(`../../../../src/assets/images/.generated/**/*.svg`, {
161
+ eager: true,
162
+ query: "?component",
163
+ }),
164
+ );
165
+ }
156
166
  }
157
167
 
158
168
  const dynamicComponent = computed(() => {
package/.browserslistrc DELETED
@@ -1,4 +0,0 @@
1
- > 1%
2
- last 2 versions
3
- not dead
4
- not ie 11
package/.editorconfig DELETED
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- insert_final_newline = true
7
- indent_style = space
8
- indent_size = 2
9
- trim_trailing_whitespace = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
package/.eslintignore DELETED
@@ -1,7 +0,0 @@
1
- /node_modules
2
- /dist
3
- /storybook-static
4
-
5
- # allow to format hidden folders
6
- !/.storybook
7
- !/.mono
package/.eslintrc.js DELETED
@@ -1,66 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- node: true,
5
- browser: true,
6
- es2020: true,
7
- },
8
- plugins: ["tailwindcss"],
9
- extends: [
10
- "eslint:recommended",
11
- "plugin:vue/vue3-recommended",
12
- "@vue/prettier",
13
- "plugin:prettier/recommended",
14
- "plugin:tailwindcss/recommended",
15
- ],
16
- rules: {
17
- "no-console": process.env.PROD ? "error" : "warn",
18
- "no-debugger": process.env.PROD ? "error" : "warn",
19
- "arrow-parens": ["error", "always"],
20
- curly: ["error", "multi-line"],
21
- "padding-line-between-statements": [
22
- "error",
23
- { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
24
- { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
25
- { blankLine: "always", prev: "directive", next: "*" },
26
- { blankLine: "any", prev: "directive", next: "directive" },
27
- { blankLine: "always", prev: "block-like", next: "*" },
28
- { blankLine: "always", prev: "*", next: "block-like" },
29
- { blankLine: "always", prev: "*", next: "return" },
30
- ],
31
- "vue/multi-word-component-names": [
32
- "error",
33
- { ignores: ["index", "Component", "Modal", "Page"] },
34
- ],
35
- "vue/max-len": ["error", { code: 120, template: 960, ignoreComments: true, ignoreUrls: true }],
36
- "vue/padding-line-between-blocks": ["error", "always"],
37
- "vue/v-on-event-hyphenation": ["error", "never"],
38
- "vue/no-v-html": "off",
39
- "tailwindcss/no-custom-classname": "off",
40
- "prettier/prettier": ["warn", { printWidth: 100, tabWidth: 2 }],
41
- },
42
- overrides: [
43
- {
44
- files: ["src/**/default.config.{js,ts}"],
45
- rules: {
46
- "vue/max-len": ["error", { code: 140 }],
47
- "prettier/prettier": ["warn", { printWidth: 120, tabWidth: 2 }],
48
- },
49
- },
50
- {
51
- files: [".storybook/preview.{js,ts}"],
52
- rules: {
53
- "vue/max-len": ["error", { code: 280 }],
54
- "prettier/prettier": ["warn", { printWidth: 280, tabWidth: 2 }],
55
- },
56
- },
57
- {
58
- files: ["**/*.{stories}.{js,ts,jsx,tsx}"],
59
- extends: ["plugin:storybook/recommended"],
60
- },
61
- ],
62
- parserOptions: {
63
- ecmaVersion: "latest",
64
- module: "esnext",
65
- },
66
- };
@@ -1,20 +0,0 @@
1
- import vuelessDocsTheme from "../themes/vueless.docs.theme";
2
- import colors from "tailwindcss/colors";
3
-
4
- export const docs = {
5
- theme: vuelessDocsTheme,
6
- source: {
7
- language: "html",
8
- },
9
- };
10
-
11
- export const backgrounds = {
12
- default: "white",
13
- values: [
14
- { name: "white", value: colors.white },
15
- { name: "light", value: colors.gray[50] },
16
- { name: "dark", value: colors.gray[900] },
17
- ],
18
- };
19
-
20
- export const layout = "fullscreen";
@@ -1,119 +0,0 @@
1
- import { addons, makeDecorator } from "@storybook/preview-api";
2
- import { h, onMounted, watch } from "vue";
3
- import { setBrandColor } from "../../src/service.ui";
4
-
5
- export const vue3SourceDecorator = makeDecorator({
6
- name: "vue3SourceDecorator",
7
- wrapper: (storyFn, context) => {
8
- const story = storyFn(context);
9
-
10
- // this returns a new component that computes the source code when mounted
11
- // and emits an events that is handled by addons-docs
12
- // watch args and re-emit on change
13
- return {
14
- components: { story },
15
- setup() {
16
- onMounted(() => {
17
- setSourceCode();
18
- });
19
-
20
- watch(context.args, () => {
21
- setSourceCode();
22
- });
23
-
24
- setBrandColor();
25
-
26
- function setSourceCode() {
27
- try {
28
- const src = context.originalStoryFn(context.args).template;
29
- const code = templateSourceCode(src, context.args, context.argTypes);
30
- const channel = addons.getChannel();
31
-
32
- const emitFormattedTemplate = async () => {
33
- const prettier = await import("prettier2");
34
- const prettierHtml = await import("prettier2/parser-html");
35
-
36
- const formattedCode = prettier.format(code, {
37
- parser: "html",
38
- plugins: [prettierHtml],
39
- htmlWhitespaceSensitivity: "ignore",
40
- });
41
-
42
- // emits an event when the transformation is completed
43
- channel.emit("storybook/docs/snippet-rendered", {
44
- id: context.id,
45
- args: context.args,
46
- source: formattedCode,
47
- });
48
- };
49
-
50
- emitFormattedTemplate();
51
- } catch (e) {
52
- // eslint-disable-next-line no-console
53
- console.warn("Failed to render code", e);
54
- }
55
- }
56
-
57
- return () => h("div", { style: `padding: 2rem 1.5rem 3rem 1.5rem;` }, [h(story)]);
58
- },
59
- };
60
- },
61
- });
62
-
63
- function templateSourceCode(templateSource, args, argTypes) {
64
- const componentArgs = {};
65
-
66
- for (const [key, val] of Object.entries(argTypes)) {
67
- const value = args[key];
68
-
69
- if (
70
- typeof val !== "undefined" &&
71
- val.table &&
72
- val.table.category === "props" &&
73
- value !== val.defaultValue
74
- ) {
75
- componentArgs[key] = val;
76
- }
77
- }
78
-
79
- const slotTemplateCode =
80
- // eslint-disable-next-line vue/max-len
81
- '<template v-for="(slot, index) of slots" :key="index" v-slot:[slot]><template v-if="args[slot]">{{ args[slot] }}</template></template>';
82
- const templateDefaultRegEx = /<template #default>([\s\S]*?)<\/template>/g;
83
-
84
- return templateSource
85
- .replace(/>[\s]+</g, "><")
86
- .trim()
87
- .replace(slotTemplateCode, "")
88
- .replace(templateDefaultRegEx, "$1")
89
- .replace(
90
- 'v-bind="args"',
91
- Object.keys(componentArgs)
92
- .map((key) => " " + propToSource(kebabCase(key), args[key]))
93
- .join(""),
94
- );
95
- }
96
-
97
- function propToSource(key, val) {
98
- const type = typeof val;
99
-
100
- switch (type) {
101
- case "boolean":
102
- return val ? key : "";
103
- case "string":
104
- return `${key}="${val}"`;
105
- default:
106
- return `:${key}="${val}"`;
107
- }
108
- }
109
-
110
- function kebabCase(str) {
111
- return str
112
- .split("")
113
- .map((letter, idx) => {
114
- return letter.toUpperCase() === letter
115
- ? `${idx !== 0 ? "-" : ""}${letter.toLowerCase()}`
116
- : letter;
117
- })
118
- .join("");
119
- }
@@ -1,20 +0,0 @@
1
- /** @type { import('@storybook/vue3-vite').StorybookConfig } */
2
- export default {
3
- stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)", "../src/**/*.@(mdx)"],
4
- addons: [
5
- "@storybook/addon-links",
6
- "@storybook/addon-essentials",
7
- "@storybook/addon-interactions",
8
- ],
9
- framework: {
10
- name: "@storybook/vue3-vite",
11
- options: {},
12
- },
13
- docs: {
14
- autodocs: true,
15
- },
16
- env: (config) => ({
17
- ...config,
18
- BASE_URL: "/",
19
- }),
20
- };
@@ -1,10 +0,0 @@
1
- <!--
2
- Overrides content of storybook layout HTML page <head> tag,
3
- -->
4
-
5
- <!-- Styles overriding -->
6
- <style>
7
- div[data-testid="tooltip"] a[id]:hover {
8
- background-color: rgb(17 24 39 / 5%) !important;
9
- }
10
- </style>
@@ -1,6 +0,0 @@
1
- import { addons } from "@storybook/manager-api";
2
- import vuelessTheme from "./themes/vueless.theme";
3
-
4
- addons.setConfig({
5
- theme: vuelessTheme,
6
- });
@@ -1,72 +0,0 @@
1
- <!--
2
- Overrides content of preview IFRAME HTML page's <head> tag,
3
- affecting rendered component(s) below Canvas and Docs tabs.
4
- -->
5
- <!-- Fonts overriding -->
6
- <link rel="dns-prefetch" href="https://fonts.googleapis.com">
7
- <link rel="dns-prefetch" href="https://fonts.gstatic.com">
8
- <link rel="preconnect" crossorigin="anonymous" href="https://fonts.googleapis.com">
9
- <link rel="preconnect" crossorigin="anonymous" href="https://fonts.gstatic.com">
10
- <link rel="stylesheet" crossorigin="anonymous" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap">
11
-
12
- <!-- Styles overriding -->
13
- <style>
14
- body {
15
- font-family: Roboto, sans-serif;
16
- }
17
-
18
- #storybook-docs h2 {
19
- margin-top: 32px !important;
20
- margin-bottom: 24px !important;
21
- padding-bottom: 8px !important;
22
- font-weight: bold !important;
23
- }
24
-
25
- .docblock-argstable-body {
26
- filter: none !important;
27
- border-radius: 0.5rem !important;
28
- }
29
-
30
- .docblock-argstable-body tr:not([title]) > td {
31
- background-color: white !important;
32
- }
33
-
34
- .docblock-argstable-body tr td {
35
- border-radius: 0 !important;
36
- }
37
-
38
- .sbdocs-preview {
39
- box-shadow: none !important;
40
- }
41
-
42
- .docblock-argstable [type='checkbox']:checked,
43
- .docblock-argstable [type='radio']:checked {
44
- background-color: rgb(17 24 39) !important;
45
- }
46
-
47
- .docblock-argstable [type='checkbox']:focus,
48
- .docblock-argstable [type='radio']:focus {
49
- @apply !ring-gray-300;
50
- }
51
-
52
- .markdown {
53
- .docblock-source {
54
- margin: 0px 0 24px !important;
55
- }
56
-
57
- code {
58
- background-color: #f3f4f6 !important;
59
- border-color: #d1d5db !important;
60
- }
61
-
62
- .sbdocs-a {
63
- border-bottom: dashed 1px #4b5563;
64
- color: #4b5563;
65
- }
66
-
67
- .sbdocs-a:hover {
68
- border-bottom: none;
69
- color: #4b5563;
70
- }
71
- }
72
- </style>
@@ -1,50 +0,0 @@
1
- import { setup } from "@storybook/vue3";
2
- import { backgrounds, docs, layout } from "./configs/main.config";
3
- import { vue3SourceDecorator } from "./decorators/vue3SourceDecorator";
4
-
5
- // Vue plugins
6
- import { createStore } from "vuex";
7
- import { createRouter, createWebHistory } from "vue-router";
8
- import NotifyServiceDefault from "../src/ui.notify/services";
9
-
10
- // Tailwind styles
11
- import "../index.pcss";
12
-
13
- // Common stores
14
- import loader from "../src/ui.loader-rendering/store";
15
- import loaderTop from "../src/ui.loader-top/store";
16
- import breakpoint from "../src/ui.viewport/store";
17
-
18
- // Create store instance
19
- const store = createStore({
20
- modules: { loader, loaderTop, breakpoint },
21
- });
22
-
23
- // Create router instance
24
- const router = createRouter({
25
- history: createWebHistory("/"),
26
- routes: [{ path: "/:pathMatch(.*)*", component: () => import("../src/ui.container-page") }],
27
- });
28
-
29
- // Create storybook app instance
30
- const storybookApp = (app) => {
31
- app.use(store);
32
- app.use(router);
33
- app.use(new NotifyServiceDefault().notifyInstance);
34
- };
35
-
36
- // Setup storybook
37
- setup(storybookApp);
38
-
39
- // Set storybook config
40
- export default {
41
- decorators: [vue3SourceDecorator],
42
- parameters: {
43
- layout,
44
- docs,
45
- backgrounds,
46
- options: {
47
- storySort: (a, b) => (a.id === b.id ? 0 : a.name === "Docs" && a.id.localeCompare(b.id, undefined, { numeric: true })),
48
- },
49
- },
50
- };
@@ -1,41 +0,0 @@
1
- import { create } from "@storybook/theming/create";
2
- import colors from "tailwindcss/colors";
3
-
4
- export default create({
5
- base: "light",
6
- // Typography
7
- fontBase: '"Roboto", sans-serif',
8
- fontCode: "monospace",
9
-
10
- // Main colors
11
- colorPrimary: colors.gray["900"],
12
- colorSecondary: colors.gray["500"],
13
-
14
- // UI
15
- appBg: colors.gray["100"],
16
- appPreviewBg: colors.gray["50"],
17
- appBorderColor: colors.gray["200"],
18
- appContentBg: colors.gray["50"],
19
- appBorderRadius: 8,
20
-
21
- // Text colors
22
- textColor: colors.gray["900"],
23
- textInverseColor: colors.gray["50"],
24
-
25
- // Toolbar default and active colors
26
- barTextColor: colors.gray["500"],
27
- barHoverColor: colors.gray["600"],
28
- barSelectedColor: colors.gray["700"],
29
- barBg: colors.white,
30
-
31
- // Form colors
32
- inputBg: colors.white,
33
- inputBorder: colors.gray["300"],
34
- inputTextColor: colors.gray["900"],
35
- inputBorderRadius: 4,
36
-
37
- buttonBg: colors.gray["100"],
38
- buttonBorder: colors.gray["200"],
39
- booleanBg: colors.gray["50"],
40
- booleanSelectedBg: colors.gray["200"],
41
- });
@@ -1,45 +0,0 @@
1
- import { create } from "@storybook/theming/create";
2
- import colors from "tailwindcss/colors";
3
-
4
- export default create({
5
- base: "light",
6
- // Typography
7
- fontBase: '"Roboto", sans-serif',
8
- fontCode: "monospace",
9
-
10
- brandTitle: "Vueless UI",
11
- brandUrl: "https://vueless.com",
12
- brandImage: "/images/logo.png",
13
- brandTarget: "_blank",
14
-
15
- // Main colors
16
- colorPrimary: colors.gray["900"],
17
- colorSecondary: colors.gray["500"],
18
-
19
- // UI
20
- appBg: colors.white,
21
- appPreviewBg: colors.gray["50"],
22
- appBorderColor: colors.gray["300"],
23
- appBorderRadius: 0,
24
-
25
- // Text colors
26
- textColor: colors.gray["900"],
27
- textInverseColor: colors.gray["50"],
28
-
29
- // Toolbar default and active colors
30
- barTextColor: colors.gray["500"],
31
- barHoverColor: colors.gray["600"],
32
- barSelectedColor: colors.gray["700"],
33
- barBg: colors.gray["50"],
34
-
35
- // Form colors
36
- inputBg: colors.white,
37
- inputBorder: colors.gray["300"],
38
- inputTextColor: colors.gray["900"],
39
- inputBorderRadius: 4,
40
-
41
- buttonBg: colors.gray["100"],
42
- buttonBorder: colors.gray["100"],
43
- booleanBg: colors.white,
44
- booleanSelectedBg: colors.gray["100"],
45
- });
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import minimist from "minimist";
3
- import { extractConfig } from "./lib/config.js";
4
- import build from "./lib/build.js";
5
-
6
- const {
7
- _: pathArray,
8
- configFile,
9
- watch,
10
- cwd,
11
- } = minimist(process.argv.slice(2), {
12
- alias: { c: "configFile", w: "watch" },
13
- });
14
-
15
- const conf = await extractConfig(cwd || process.cwd(), watch, configFile, pathArray);
16
-
17
- build(conf);