vlite3 1.5.2 → 1.5.5

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.
Files changed (35) hide show
  1. package/README.md +71 -0
  2. package/components/Calendar/Calendar.vue.js +1 -1
  3. package/components/Calendar/Calendar.vue2.js +29 -29
  4. package/components/CategoryManager/CategoryManager.vue2.js +4 -4
  5. package/components/Chart/GanttChart.vue.d.ts +2 -0
  6. package/components/Chart/GanttChart.vue.js +2 -2
  7. package/components/Chart/GanttChart.vue2.js +591 -656
  8. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  9. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  10. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  11. package/components/Form/{AccordionView.vue2.js → AccordionView.vue.js} +1 -1
  12. package/components/Form/index.vue2.js +1 -1
  13. package/components/QRCode/QRCode.vue.d.ts +1 -1
  14. package/components/RichTextEditor/RichTextEditor.vue.js +4 -4
  15. package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
  16. package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
  17. package/components/ScaleGenerator/ScaleGenerator.vue.d.ts +1 -1
  18. package/components/Screen/ScreenFilter.vue.js +4 -4
  19. package/components/SidePanel.vue.js +2 -2
  20. package/components/SidePanel.vue2.js +18 -18
  21. package/core/CoreScale.d.ts +18 -0
  22. package/core/CoreScale.js +44 -0
  23. package/core/config.d.ts +38 -32
  24. package/core/config.js +23 -13
  25. package/core/index.d.ts +3 -2
  26. package/core/index.js +43 -32
  27. package/index.d.ts +1 -1
  28. package/index.js +270 -260
  29. package/package.json +1 -1
  30. package/style.css +44 -20
  31. package/types/config.type.d.ts +16 -0
  32. /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
  33. /package/components/Dropdown/{DropdownMenu.vue3.js → DropdownMenu.vue2.js} +0 -0
  34. /package/components/RichTextEditor/{RichTextLinkPopover.vue.js → RichTextLinkPopover.vue2.js} +0 -0
  35. /package/components/RichTextEditor/{RichTextToolbar.vue.js → RichTextToolbar.vue2.js} +0 -0
package/README.md CHANGED
@@ -90,6 +90,9 @@ app.use(GoogleSignInPlugin, {
90
90
 
91
91
  // Initialize VLite with custom configuration
92
92
  const vlite = createVLite({
93
+ // Existing applications keep their current appearance when this is omitted
94
+ scale: 'large',
95
+
93
96
  // Global Service Registry
94
97
  services: {
95
98
  /**
@@ -143,6 +146,74 @@ app.use(vlite)
143
146
  app.mount('#app')
144
147
  ```
145
148
 
149
+ ### Global Application Scale
150
+
151
+ Use the root-level `scale` option to control the visual density of the complete application:
152
+
153
+ ```ts
154
+ const vlite = createVLite({
155
+ scale: 'medium',
156
+ })
157
+ ```
158
+
159
+ The official presets are:
160
+
161
+ - `large`: the current vlite3 sizing and the default
162
+ - `medium`: a moderately compact 15px baseline
163
+ - `small`: a compact 14px baseline
164
+
165
+ Both `createVLite()` and `createVLite({})` resolve to `large`, so existing applications require no
166
+ migration. Global scale changes the inherited design-system baseline; component-level props such as
167
+ `<Button size="sm">` and `<Form size="md">` keep their existing meaning and relative ordering.
168
+
169
+ User-selected scale changes are saved under the `vlite-scale` local-storage key. Use
170
+ `setVLiteScale()` for a runtime preference control; it updates the injected configuration, the root
171
+ attribute, and storage together:
172
+
173
+ ```ts
174
+ import { setVLiteScale } from 'vlite3'
175
+
176
+ setVLiteScale('small')
177
+ ```
178
+
179
+ On the next load, a valid saved preference takes precedence over the configured default and is
180
+ restored synchronously during `app.use(vlite)`, before `app.mount()`.
181
+
182
+ For a strict no-flash first paint—including SSR pages or applications whose JavaScript bundle may
183
+ start after the browser paints—set the configured fallback on `html` and restore storage in a
184
+ blocking head script before styles or application scripts. The fallback attribute must match the
185
+ value passed to `createVLite`:
186
+
187
+ ```html
188
+ <html data-vlite-scale="large">
189
+ <head>
190
+ <script>
191
+ try {
192
+ const scale = localStorage.getItem('vlite-scale')
193
+ if (scale === 'small' || scale === 'medium' || scale === 'large') {
194
+ document.documentElement.setAttribute('data-vlite-scale', scale)
195
+ }
196
+ } catch {
197
+ // Keep the configured HTML fallback when storage is unavailable.
198
+ }
199
+ </script>
200
+ </head>
201
+ </html>
202
+ ```
203
+
204
+ Applications with a Content Security Policy should authorize this script with a nonce or serve an
205
+ equivalent blocking bootstrap script. Because the attribute is resolved before CSS renders, refresh
206
+ does not briefly display one density and then jump to another.
207
+
208
+ The scale uses inherited CSS variables—no browser zoom or CSS transforms are involved. For an
209
+ advanced project-specific adjustment, override the preset after importing `vlite3/style.css`:
210
+
211
+ ```css
212
+ html[data-vlite-scale='medium'] {
213
+ --vlite-root-font-size: 15.25px;
214
+ }
215
+ ```
216
+
146
217
  ### How it works
147
218
 
148
219
  #### Global Services (e.g., Uploads)
@@ -1,7 +1,7 @@
1
1
  import o from "./Calendar.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-63e46f6b"]]);
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-8c4d2fe9"]]);
5
5
  export {
6
6
  f as default
7
7
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, ref as k, onMounted as W, onUnmounted as j, computed as p, openBlock as b, createElementBlock as E, createVNode as n, unref as A, withCtx as i, createElementVNode as w, createTextVNode as f, toDisplayString as r } from "vue";
1
+ import { defineComponent as M, ref as p, onMounted as W, onUnmounted as j, computed as w, openBlock as b, createElementBlock as E, createVNode as n, unref as A, withCtx as a, createElementVNode as C, createTextVNode as f, toDisplayString as r } from "vue";
2
2
  import L from "v-event-calendar";
3
3
  import l from "../Button.vue.js";
4
4
  import h from "../ButtonGroup.vue.js";
5
5
  import { $t as B } from "../../utils/i18n.js";
6
6
  import "v-event-calendar/style.css";
7
7
  import P from "./CalendarEventItem.vue.js";
8
- const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border-border rounded-xl shadow-sm overflow-hidden flex flex-col" }, _ = {
8
+ const R = { class: "v-calendar flex h-[min(52rem,calc(100dvh-10rem))] min-h-[24rem] flex-col overflow-hidden rounded-xl border border-border bg-body shadow-sm lg:mt-2" }, _ = {
9
9
  key: 0,
10
10
  class: "flex items-center justify-between p-4 border-b border-border bg-body"
11
11
  }, G = { class: "flex items-center gap-2" }, I = { class: "text-lg font-bold text-foreground truncate mx-2" }, q = { class: "flex items-center gap-2" }, F = {
@@ -30,21 +30,21 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
30
30
  "dayClick"
31
31
  ],
32
32
  setup(c, { emit: N }) {
33
- const d = N, s = k(), v = k("month"), x = k(!1), C = () => {
33
+ const d = N, s = p(), v = p("month"), x = p(!1), g = () => {
34
34
  const o = window.innerWidth < 1200;
35
35
  o !== x.value && (x.value = o, o && (v.value = "date", s.value?.setView("date")));
36
36
  };
37
37
  W(() => {
38
- C(), window.addEventListener("resize", C);
38
+ g(), window.addEventListener("resize", g);
39
39
  }), j(() => {
40
- window.removeEventListener("resize", C);
40
+ window.removeEventListener("resize", g);
41
41
  });
42
- const g = (o) => {
42
+ const k = (o) => {
43
43
  x.value || (v.value = o, s.value?.setView(o));
44
44
  }, z = () => s.value?.goToToday(), T = () => s.value?.goToPrevious(), D = () => s.value?.goToNext(), y = (o, e, t) => {
45
- const a = t ? B(o, t) : B(o);
46
- return a !== o ? a : e;
47
- }, S = p(() => y("vlite.calendar.month", "Month")), $ = p(() => y("vlite.calendar.week", "Week")), U = p(() => y("vlite.calendar.day", "Day")), V = p(() => y("vlite.calendar.today", "Today"));
45
+ const i = t ? B(o, t) : B(o);
46
+ return i !== o ? i : e;
47
+ }, S = w(() => y("vlite.calendar.month", "Month")), $ = w(() => y("vlite.calendar.week", "Week")), U = w(() => y("vlite.calendar.day", "Day")), V = w(() => y("vlite.calendar.today", "Today"));
48
48
  return (o, e) => (b(), E("div", R, [
49
49
  n(A(L), {
50
50
  ref_key: "calendarRef",
@@ -54,17 +54,17 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
54
54
  "allow-event-creation": c.canAdd,
55
55
  "allow-event-editing": c.canEdit,
56
56
  onEventClick: e[6] || (e[6] = (t) => d("eventClick", t)),
57
- onEventCreate: e[7] || (e[7] = (t, a, u) => d("eventCreate", { date: t, start: a, end: u })),
58
- onEventUpdate: e[8] || (e[8] = (t, a, u) => d("eventUpdate", { eventId: t, start: a, end: u })),
57
+ onEventCreate: e[7] || (e[7] = (t, i, u) => d("eventCreate", { date: t, start: i, end: u })),
58
+ onEventUpdate: e[8] || (e[8] = (t, i, u) => d("eventUpdate", { eventId: t, start: i, end: u })),
59
59
  onDateChange: e[9] || (e[9] = (t) => d("dateChange", t)),
60
60
  onDayClick: e[10] || (e[10] = (t) => d("dayClick", t)),
61
61
  class: "flex-1 min-h-0"
62
62
  }, {
63
- header: i(({ currentTitle: t }) => [
63
+ header: a(({ currentTitle: t }) => [
64
64
  x.value ? (b(), E("div", F, [
65
- w("h2", H, r(t), 1),
65
+ C("h2", H, r(t), 1),
66
66
  n(h, { class: "max-sm:w-full" }, {
67
- default: i(() => [
67
+ default: a(() => [
68
68
  n(l, {
69
69
  variant: "outline",
70
70
  size: "sm",
@@ -77,7 +77,7 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
77
77
  class: "flex-1",
78
78
  onClick: z
79
79
  }, {
80
- default: i(() => [
80
+ default: a(() => [
81
81
  f(r(V.value), 1)
82
82
  ]),
83
83
  _: 1
@@ -92,16 +92,16 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
92
92
  _: 1
93
93
  })
94
94
  ])) : (b(), E("div", _, [
95
- w("div", G, [
95
+ C("div", G, [
96
96
  n(h, null, {
97
- default: i(() => [
97
+ default: a(() => [
98
98
  n(l, {
99
99
  variant: v.value === "month" ? "primary" : "outline",
100
100
  size: "sm",
101
101
  icon: "lucide:calendar-days",
102
- onClick: e[0] || (e[0] = (a) => g("month"))
102
+ onClick: e[0] || (e[0] = (i) => k("month"))
103
103
  }, {
104
- default: i(() => [
104
+ default: a(() => [
105
105
  f(r(S.value), 1)
106
106
  ]),
107
107
  _: 1
@@ -110,9 +110,9 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
110
110
  variant: v.value === "week" ? "primary" : "outline",
111
111
  size: "sm",
112
112
  icon: "lucide:calendar-range",
113
- onClick: e[1] || (e[1] = (a) => g("week"))
113
+ onClick: e[1] || (e[1] = (i) => k("week"))
114
114
  }, {
115
- default: i(() => [
115
+ default: a(() => [
116
116
  f(r($.value), 1)
117
117
  ]),
118
118
  _: 1
@@ -121,9 +121,9 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
121
121
  variant: v.value === "date" ? "primary" : "outline",
122
122
  size: "sm",
123
123
  icon: "lucide:calendar",
124
- onClick: e[2] || (e[2] = (a) => g("date"))
124
+ onClick: e[2] || (e[2] = (i) => k("date"))
125
125
  }, {
126
- default: i(() => [
126
+ default: a(() => [
127
127
  f(r(U.value), 1)
128
128
  ]),
129
129
  _: 1
@@ -132,10 +132,10 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
132
132
  _: 1
133
133
  })
134
134
  ]),
135
- w("h2", I, r(t), 1),
136
- w("div", q, [
135
+ C("h2", I, r(t), 1),
136
+ C("div", q, [
137
137
  n(h, null, {
138
- default: i(() => [
138
+ default: a(() => [
139
139
  n(l, {
140
140
  variant: "outline",
141
141
  size: "sm",
@@ -147,7 +147,7 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
147
147
  size: "sm",
148
148
  onClick: z
149
149
  }, {
150
- default: i(() => [
150
+ default: a(() => [
151
151
  f(r(V.value), 1)
152
152
  ]),
153
153
  _: 1
@@ -164,10 +164,10 @@ const R = { class: "h-[calc(100vh-1px)] v-calendar lg:mt-2 bg-body border border
164
164
  ])
165
165
  ]))
166
166
  ]),
167
- event: i(({ event: t, view: a, displayTime: u }) => [
167
+ event: a(({ event: t, view: i, displayTime: u }) => [
168
168
  n(P, {
169
169
  event: t,
170
- view: a,
170
+ view: i,
171
171
  displayTime: u,
172
172
  "can-edit": c.canEdit,
173
173
  "can-delete": c.canDelete,
@@ -19,14 +19,14 @@ import "v-datepicker-lite/style.css";
19
19
  /* empty css */
20
20
  import "@jaames/iro";
21
21
  import "@vueuse/core";
22
- /* empty css */
22
+ /* empty css */
23
23
  import qe from "../IconPicker.vue.js";
24
24
  /* empty css */
25
- /* empty css */
25
+ /* empty css */
26
26
  /* empty css */
27
27
  /* empty css */
28
- /* empty css */
29
- /* empty css */
28
+ /* empty css */
29
+ /* empty css */
30
30
  import "../../core/config.js";
31
31
  /* empty css */
32
32
  /* empty css */
@@ -105,6 +105,8 @@ declare const _default: import('vue').DefineComponent<GanttChartProps, {
105
105
  setZoom: typeof setZoom;
106
106
  resetZoom: typeof resetZoom;
107
107
  scrollToToday: typeof scrollToToday;
108
+ /** Whether "today" falls inside the rendered date range (read-only). */
109
+ isTodayVisible: () => boolean;
108
110
  /** Current zoom level (read-only). */
109
111
  getZoom: () => number;
110
112
  /** Collapse / expand the task sidebar. */
@@ -1,7 +1,7 @@
1
1
  import t from "./GanttChart.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ o(t, [["__scopeId", "data-v-b7dc343d"]]);
4
+ const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-7aff7e2f"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };