@vuetify/v0 1.0.0-alpha.1 → 1.0.0-alpha.2
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/{adapter-T7AedXkz.d.mts → adapter-58IvIfAZ.d.mts} +1 -1
- package/dist/{adapter-DtgIrQsG.mjs → adapter-Be9zUc-n.mjs} +1 -1
- package/dist/{adapter-DoziXEzS.d.mts → adapter-BvWEd9w-.d.mts} +2 -2
- package/dist/{adapter-J7ude3gO.d.mts → adapter-DlX3FA3A.d.mts} +1 -1
- package/dist/{adapter-CDpOQ8sn.mjs → adapter-gQ2SNKZq.mjs} +3 -3
- package/dist/{adapters-Da2twiUn.mjs → adapters-BJ5n7rgh.mjs} +1 -1
- package/dist/adapters-BnKW0BF_.mjs +2 -0
- package/dist/adapters-CBrvizWb.mjs +4 -0
- package/dist/adapters-CMJGA1k7.mjs +2 -0
- package/dist/adapters-Dse4bPxk.mjs +5 -0
- package/dist/browser/index.js +166 -159
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/{components-CaPQCjo5.mjs → components-CqDewYTU.mjs} +63 -37
- package/dist/composables/index.d.mts +18 -18
- package/dist/composables/index.mjs +26 -24
- package/dist/{consola-Byg0ybzh.d.mts → consola-BdgyPEfx.d.mts} +1 -1
- package/dist/constants/index.d.mts +2 -2
- package/dist/constants/index.mjs +3 -3
- package/dist/{createDataTable-B4UflKnT.mjs → createDataTable-rXBqGglI.mjs} +15 -12
- package/dist/{createGroup-BC2nfttd.mjs → createGroup-BU4olYtB.mjs} +7 -7
- package/dist/{createTokens-oJAeh262.mjs → createRegistry-Dl-bSSTr.mjs} +6 -299
- package/dist/{createSelection-BA9guLah.mjs → createSelection-Csaa-C8p.mjs} +1 -1
- package/dist/{createSingle-BHxHLZeg.mjs → createSingle-8xbHAIpY.mjs} +1 -1
- package/dist/createTokens-lNg2M_P_.mjs +302 -0
- package/dist/data-table/adapters/client/index.d.mts +1 -1
- package/dist/data-table/adapters/client/index.mjs +1 -1
- package/dist/data-table/adapters/index.d.mts +4 -4
- package/dist/data-table/adapters/index.mjs +5 -5
- package/dist/data-table/adapters/server/index.d.mts +1 -1
- package/dist/data-table/adapters/server/index.mjs +1 -1
- package/dist/data-table/adapters/virtual/index.d.mts +1 -1
- package/dist/data-table/adapters/virtual/index.mjs +1 -1
- package/dist/data-table/index.d.mts +5 -5
- package/dist/data-table/index.mjs +5 -5
- package/dist/date/index.d.mts +2 -2
- package/dist/date/index.mjs +4 -4
- package/dist/features/adapters/flagsmith/index.d.mts +1 -1
- package/dist/features/adapters/flagsmith/index.mjs +1 -1
- package/dist/features/adapters/launchdarkly/index.d.mts +1 -1
- package/dist/features/adapters/launchdarkly/index.mjs +1 -1
- package/dist/features/adapters/posthog/index.d.mts +1 -1
- package/dist/features/adapters/posthog/index.mjs +1 -1
- package/dist/features/index.d.mts +2 -2
- package/dist/features/index.mjs +1 -1
- package/dist/{globals-Berkg6mP.mjs → globals-CKdzjeLe.mjs} +1 -1
- package/dist/htmlElements-D4oMQZPJ.mjs +28 -0
- package/dist/{index-M8EpGjjA.d.mts → index-1XdASTjp.d.mts} +1 -1
- package/dist/{index-Gk3x_7zD.d.mts → index-B7cqgTBL.d.mts} +115 -117
- package/dist/{index-DVPq3_Fz.d.mts → index-BJGcVy7e.d.mts} +4 -4
- package/dist/index-BgCkepP_.d.mts +31 -0
- package/dist/{index-DFvLSoto.d.mts → index-BxKMMWnQ.d.mts} +9 -9
- package/dist/{index-tyzwWFHS.d.mts → index-BzFHTW59.d.mts} +1 -1
- package/dist/{index-CDcl4wPo.d.mts → index-CT5SCLzW.d.mts} +1 -1
- package/dist/{index-TtSSvHY6.d.mts → index-DE3bWw11.d.mts} +2 -2
- package/dist/{index-F2Fmxnzi.d.mts → index-Dp1HjBxJ.d.mts} +1 -1
- package/dist/{index-B_AlCD7t.d.mts → index-DuddF-NR.d.mts} +2 -9
- package/dist/{index-Dxx0eMLi.d.mts → index-GOpjKzaJ.d.mts} +1 -1
- package/dist/index.d.mts +23 -23
- package/dist/index.mjs +30 -28
- package/dist/json/attributes.json +4 -4
- package/dist/json/web-types.json +5 -5
- package/dist/locale/adapters/index.d.mts +2 -2
- package/dist/locale/adapters/index.mjs +2 -2
- package/dist/locale/adapters/v0/index.d.mts +1 -1
- package/dist/locale/adapters/v0/index.mjs +1 -1
- package/dist/locale/adapters/vue-i18n/index.d.mts +1 -1
- package/dist/locale/index.d.mts +3 -3
- package/dist/locale/index.mjs +2 -2
- package/dist/logger/adapters/consola/index.d.mts +1 -1
- package/dist/logger/adapters/index.d.mts +4 -4
- package/dist/logger/adapters/index.mjs +2 -2
- package/dist/logger/adapters/pino/index.d.mts +1 -1
- package/dist/logger/adapters/v0/index.d.mts +1 -1
- package/dist/logger/adapters/v0/index.mjs +1 -1
- package/dist/logger/index.d.mts +5 -5
- package/dist/logger/index.mjs +2 -2
- package/dist/notifications/index.d.mts +2 -2
- package/dist/notifications/index.mjs +3 -54
- package/dist/palettes/ant/generate/index.mjs +1 -0
- package/dist/palettes/ant/index.d.mts +1 -1
- package/dist/palettes/index.d.mts +3 -3
- package/dist/palettes/leonardo/generate/index.mjs +1 -0
- package/dist/palettes/material/generate/index.mjs +1 -0
- package/dist/palettes/material/index.d.mts +1 -1
- package/dist/palettes/md1/index.d.mts +1 -1
- package/dist/palettes/md2/index.d.mts +1 -1
- package/dist/palettes/radix/index.d.mts +1 -1
- package/dist/palettes/tailwind/index.d.mts +1 -1
- package/dist/permissions/adapters/index.d.mts +1 -1
- package/dist/permissions/adapters/index.mjs +2 -2
- package/dist/permissions/adapters/v0/index.d.mts +1 -1
- package/dist/permissions/adapters/v0/index.mjs +1 -1
- package/dist/permissions/index.d.mts +1 -1
- package/dist/permissions/index.mjs +2 -2
- package/dist/{pino-BxddSW2l.d.mts → pino-DNfCEb0p.d.mts} +1 -1
- package/dist/{posthog-CPvNHMUb.mjs → posthog-DZNnPXxS.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/{server-ZiHJ4tfq.d.mts → server-3ilWFwqe.d.mts} +1 -1
- package/dist/{server-B6OtHgBT.mjs → server-y7zLSCSx.mjs} +1 -1
- package/dist/storage/adapters/index.d.mts +2 -2
- package/dist/storage/adapters/index.mjs +1 -1
- package/dist/storage/adapters/memory/index.d.mts +1 -1
- package/dist/storage/adapters/memory/index.mjs +1 -1
- package/dist/storage/index.d.mts +3 -3
- package/dist/storage/index.mjs +2 -2
- package/dist/theme/adapters/index.d.mts +1 -1
- package/dist/theme/adapters/index.mjs +4 -4
- package/dist/theme/adapters/unhead/index.d.mts +1 -1
- package/dist/theme/adapters/unhead/index.mjs +1 -1
- package/dist/theme/adapters/v0/index.d.mts +1 -1
- package/dist/theme/adapters/v0/index.mjs +1 -1
- package/dist/theme/index.d.mts +1 -1
- package/dist/theme/index.mjs +3 -3
- package/dist/{toArray-BA_JxFPv.mjs → toArray-as9BWxBK.mjs} +1 -0
- package/dist/types/index.d.mts +2 -2
- package/dist/{unhead-D2YqAcmF.mjs → unhead-DZiD-4Tx.mjs} +2 -2
- package/dist/{useClickOutside-B9a6Jext.mjs → useClickOutside-CmCUD_Pf.mjs} +46 -905
- package/dist/{useFeatures-wgMwaQ5W.mjs → useFeatures-ZIvzzuEV.mjs} +8 -7
- package/dist/{useLocale-qMmVnAwS.mjs → useLocale-DTJx3aKR.mjs} +10 -7
- package/dist/{useLogger-DFIRqm-N.mjs → useLogger-BBTcMN61.mjs} +3 -3
- package/dist/useNotifications-H4knpvNw.mjs +869 -0
- package/dist/{usePermissions-tZhkBJmq.mjs → usePermissions-B_G12Dwd.mjs} +6 -6
- package/dist/{useRules-D3UXEtu7.mjs → useRules--7Qoo60I.mjs} +7 -5
- package/dist/{useTheme-BeD__R8t.mjs → useTheme-Co05TEeD.mjs} +11 -8
- package/dist/utilities/index.d.mts +1 -1
- package/dist/utilities/index.mjs +10 -5
- package/dist/{v0-6XptGYVx.mjs → v0-BrTEO5sv.mjs} +2 -2
- package/dist/{v0-Dzw5OwNo.d.mts → v0-CdusXjY_.d.mts} +1 -1
- package/dist/{v0-I2mHxD9T.mjs → v0-D0Mh3EVG.mjs} +1 -1
- package/dist/{v0-CWXUkMY0.d.mts → v0-D7Fm2C3Y.d.mts} +1 -1
- package/dist/{v0-CNitYI9N.mjs → v0-DeiZuexg.mjs} +1 -1
- package/dist/{v0-BG7RhKBv.mjs → v0-Dq3zhexO.mjs} +2 -2
- package/dist/{v0-C2UMaHUa.d.mts → v0-DrOub-e1.d.mts} +1 -1
- package/dist/{virtual-To-dSw2_.mjs → virtual-C0yHf1DC.mjs} +2 -2
- package/dist/{virtual-BCOfxnRS.d.mts → virtual-D4fckewC.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/adapters-BhNTUuxE.mjs +0 -2
- package/dist/adapters-CFjrKxA2.mjs +0 -5
- package/dist/adapters-CiCexgsk.mjs +0 -4
- package/dist/adapters-DegUcfkd.mjs +0 -2
- package/dist/htmlElements-CIePKaTX.mjs +0 -75
- package/dist/index-D6mQAEs2.d.mts +0 -79
- /package/dist/{adapter-DNKjooxI.d.mts → adapter-Dhq68tz0.d.mts} +0 -0
- /package/dist/{createPagination-qvJkcTUY.mjs → createPagination-CHF7SmmK.mjs} +0 -0
- /package/dist/{flagsmith-DQnnahG5.mjs → flagsmith-Dbh1h8WF.mjs} +0 -0
- /package/dist/{index-DxruGeVY.d.mts → index-C6rdXZ7j.d.mts} +0 -0
- /package/dist/{index-DvuJXuAN.d.mts → index-CFhUdAHM.d.mts} +0 -0
- /package/dist/{index-PWQavSPf.d.mts → index-CROz1VSV.d.mts} +0 -0
- /package/dist/{index-D4odwkZg.d.mts → index-DTvqw22G.d.mts} +0 -0
- /package/dist/{launchdarkly-2_48EJ1_.mjs → launchdarkly-BKtW-idu.mjs} +0 -0
- /package/dist/{memory-DUyWthic.d.mts → memory-CeSQE-QV.d.mts} +0 -0
- /package/dist/{memory-XCMtkld1.mjs → memory-oYBvtkgx.mjs} +0 -0
- /package/dist/{v0-4OQBCeda.mjs → v0-Bmow1q_x.mjs} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isNullOrUndefined, isNumber, isString } from "./utilities/index.mjs";
|
|
2
2
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
-
import { a as useLocale } from "./useLocale-
|
|
4
|
-
import { t as createGroup } from "./createGroup-
|
|
5
|
-
import { t as ClientAdapter } from "./v0-
|
|
6
|
-
import "./adapters-
|
|
3
|
+
import { a as useLocale } from "./useLocale-DTJx3aKR.mjs";
|
|
4
|
+
import { t as createGroup } from "./createGroup-BU4olYtB.mjs";
|
|
5
|
+
import { t as ClientAdapter } from "./v0-Dq3zhexO.mjs";
|
|
6
|
+
import "./adapters-Dse4bPxk.mjs";
|
|
7
7
|
import { computed, shallowReactive, shallowRef, toRef, watch } from "vue";
|
|
8
8
|
//#region src/composables/createDataTable/columns.ts
|
|
9
9
|
/**
|
|
@@ -12,9 +12,10 @@ import { computed, shallowReactive, shallowRef, toRef, watch } from "vue";
|
|
|
12
12
|
* @param columns Column tree to extract leaves from
|
|
13
13
|
* @returns Flat array of leaf columns
|
|
14
14
|
*/
|
|
15
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
15
16
|
function extractLeaves(columns) {
|
|
16
17
|
const leaves = [];
|
|
17
|
-
for (const col of columns) if (col.children?.length) leaves.push(
|
|
18
|
+
for (const col of columns) if (col.children?.length) leaves.push(.../* @__PURE__ */ extractLeaves(col.children));
|
|
18
19
|
else leaves.push(col);
|
|
19
20
|
return leaves;
|
|
20
21
|
}
|
|
@@ -24,9 +25,10 @@ function extractLeaves(columns) {
|
|
|
24
25
|
* @param columns Column tree to measure
|
|
25
26
|
* @returns Maximum nesting depth
|
|
26
27
|
*/
|
|
28
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
27
29
|
function computeDepth(columns) {
|
|
28
30
|
let max = 0;
|
|
29
|
-
for (const col of columns) if (col.children?.length) max = Math.max(max, 1 + computeDepth(col.children));
|
|
31
|
+
for (const col of columns) if (col.children?.length) max = Math.max(max, 1 + /* @__PURE__ */ computeDepth(col.children));
|
|
30
32
|
return max;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
@@ -38,13 +40,14 @@ function computeDepth(columns) {
|
|
|
38
40
|
* @param columns Column tree to resolve
|
|
39
41
|
* @returns 2D array of header cells with colspan/rowspan
|
|
40
42
|
*/
|
|
43
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
41
44
|
function resolveHeaders(columns) {
|
|
42
45
|
if (columns.length === 0) return [];
|
|
43
|
-
const maxDepth = computeDepth(columns);
|
|
46
|
+
const maxDepth = /* @__PURE__ */ computeDepth(columns);
|
|
44
47
|
const rows = Array.from({ length: maxDepth + 1 }, () => []);
|
|
45
48
|
function walk(cols, depth) {
|
|
46
49
|
for (const col of cols) if (col.children?.length) {
|
|
47
|
-
const leaves = extractLeaves(col.children);
|
|
50
|
+
const leaves = /* @__PURE__ */ extractLeaves(col.children);
|
|
48
51
|
rows[depth].push({
|
|
49
52
|
key: col.key,
|
|
50
53
|
title: col.title ?? "",
|
|
@@ -137,7 +140,7 @@ function resolveHeaders(columns) {
|
|
|
137
140
|
* ```
|
|
138
141
|
*/
|
|
139
142
|
function createDataTable(options) {
|
|
140
|
-
const { items: _items, columns, itemValue = "id", filter: filterOptions = {}, pagination: paginationOptions = {}, sortMultiple = false, mandate = false, firstSortOrder = "asc", selectStrategy = "page", itemSelectable, groupBy,
|
|
143
|
+
const { items: _items, columns, itemValue = "id", filter: filterOptions = {}, pagination: paginationOptions = {}, sortMultiple = false, mandate = false, firstSortOrder = "asc", selectStrategy = "page", itemSelectable, groupBy, openAll = false, expandMultiple = true, locale: initialLocale, adapter = new ClientAdapter() } = options;
|
|
141
144
|
const _query = shallowRef("");
|
|
142
145
|
function search(value) {
|
|
143
146
|
_query.value = value;
|
|
@@ -148,8 +151,8 @@ function createDataTable(options) {
|
|
|
148
151
|
if (!/* @__PURE__ */ isNullOrUndefined(selected)) return String(selected);
|
|
149
152
|
return initialLocale;
|
|
150
153
|
});
|
|
151
|
-
const leaves = extractLeaves(columns);
|
|
152
|
-
const headers = toRef(() => resolveHeaders(columns));
|
|
154
|
+
const leaves = /* @__PURE__ */ extractLeaves(columns);
|
|
155
|
+
const headers = toRef(() => /* @__PURE__ */ resolveHeaders(columns));
|
|
153
156
|
const sortable = leaves.filter((col) => col.sortable === true);
|
|
154
157
|
const group = createGroup({ multiple: sortMultiple });
|
|
155
158
|
group.onboard(sortable.map((col) => ({
|
|
@@ -353,7 +356,7 @@ function createDataTable(options) {
|
|
|
353
356
|
});
|
|
354
357
|
return result;
|
|
355
358
|
});
|
|
356
|
-
if (
|
|
359
|
+
if (openAll) {
|
|
357
360
|
for (const group of groups.value) opened.add(group.key);
|
|
358
361
|
if (groups.value.length === 0) {
|
|
359
362
|
const stop = watch(groups, (newGroups) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveIds, resolveIndexes, useId as useId$1 } from "./utilities/index.mjs";
|
|
2
2
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
-
import { t as createSelection } from "./createSelection-
|
|
4
|
-
import { t as toArray } from "./toArray-
|
|
3
|
+
import { t as createSelection } from "./createSelection-Csaa-C8p.mjs";
|
|
4
|
+
import { t as toArray } from "./toArray-as9BWxBK.mjs";
|
|
5
5
|
import { computed, onScopeDispose, reactive, shallowReactive, toRef, toValue } from "vue";
|
|
6
6
|
//#region src/composables/useProxyRegistry/index.ts
|
|
7
7
|
/**
|
|
@@ -203,26 +203,26 @@ function createGroup(_options = {}) {
|
|
|
203
203
|
return mixedIds.has(id);
|
|
204
204
|
}
|
|
205
205
|
function mix(ids) {
|
|
206
|
-
for (const id of toArray(ids)) {
|
|
206
|
+
for (const id of /* @__PURE__ */ toArray(ids)) {
|
|
207
207
|
if (!selection.has(id)) continue;
|
|
208
208
|
selection.selectedIds.delete(id);
|
|
209
209
|
mixedIds.add(id);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
function unmix(ids) {
|
|
213
|
-
for (const id of toArray(ids)) mixedIds.delete(id);
|
|
213
|
+
for (const id of /* @__PURE__ */ toArray(ids)) mixedIds.delete(id);
|
|
214
214
|
}
|
|
215
215
|
function select(ids) {
|
|
216
|
-
for (const id of toArray(ids)) {
|
|
216
|
+
for (const id of /* @__PURE__ */ toArray(ids)) {
|
|
217
217
|
mixedIds.delete(id);
|
|
218
218
|
selection.select(id);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
function unselect(ids) {
|
|
222
|
-
for (const id of toArray(ids)) selection.unselect(id);
|
|
222
|
+
for (const id of /* @__PURE__ */ toArray(ids)) selection.unselect(id);
|
|
223
223
|
}
|
|
224
224
|
function toggle(ids) {
|
|
225
|
-
for (const id of toArray(ids)) if (mixed(id)) select(id);
|
|
225
|
+
for (const id of /* @__PURE__ */ toArray(ids)) if (mixed(id)) select(id);
|
|
226
226
|
else selection.toggle(id);
|
|
227
227
|
}
|
|
228
228
|
function register(registration = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { clamp,
|
|
1
|
+
import { clamp, isUndefined, useId as useId$1 } from "./utilities/index.mjs";
|
|
2
2
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
-
import { i as useLogger } from "./useLogger-
|
|
3
|
+
import { i as useLogger } from "./useLogger-BBTcMN61.mjs";
|
|
4
4
|
import { shallowReactive } from "vue";
|
|
5
5
|
//#region src/composables/createRegistry/index.ts
|
|
6
6
|
/**
|
|
@@ -171,6 +171,7 @@ function createRegistry(options) {
|
|
|
171
171
|
else catalog.set(value, next);
|
|
172
172
|
}
|
|
173
173
|
function keys() {
|
|
174
|
+
if (reactive) return Array.from(collection.keys());
|
|
174
175
|
const cached = cache.get("keys");
|
|
175
176
|
if (!/* @__PURE__ */ isUndefined(cached)) return cached;
|
|
176
177
|
const keys = Array.from(collection.keys());
|
|
@@ -178,6 +179,7 @@ function createRegistry(options) {
|
|
|
178
179
|
return keys;
|
|
179
180
|
}
|
|
180
181
|
function values() {
|
|
182
|
+
if (reactive) return Array.from(collection.values());
|
|
181
183
|
const cached = cache.get("values");
|
|
182
184
|
if (!/* @__PURE__ */ isUndefined(cached)) return cached;
|
|
183
185
|
const values = Array.from(collection.values());
|
|
@@ -185,6 +187,7 @@ function createRegistry(options) {
|
|
|
185
187
|
return values;
|
|
186
188
|
}
|
|
187
189
|
function entries() {
|
|
190
|
+
if (reactive) return Array.from(collection.entries());
|
|
188
191
|
const cached = cache.get("entries");
|
|
189
192
|
if (!/* @__PURE__ */ isUndefined(cached)) return cached;
|
|
190
193
|
const entries = Array.from(collection.entries());
|
|
@@ -432,300 +435,4 @@ function useRegistry(namespace = "v0:registry") {
|
|
|
432
435
|
return useContext(namespace);
|
|
433
436
|
}
|
|
434
437
|
//#endregion
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @module createTokens
|
|
438
|
-
*
|
|
439
|
-
* @see https://0.vuetifyjs.com/composables/registration/create-tokens
|
|
440
|
-
*
|
|
441
|
-
* @remarks
|
|
442
|
-
* Design token registry with alias resolution and W3C Design Tokens format support.
|
|
443
|
-
*
|
|
444
|
-
* Key features:
|
|
445
|
-
* - Alias resolution with circular reference detection
|
|
446
|
-
* - Nested token flattening with dot notation
|
|
447
|
-
* - W3C Design Tokens format ($value, $type, $description, $extensions)
|
|
448
|
-
* - Path-based resolution (e.g., {colors}.blue.500)
|
|
449
|
-
* - Resolution caching for performance (~28,590 ops/sec)
|
|
450
|
-
*
|
|
451
|
-
* Used by useTheme, useLocale, and useFeatures for token-based configuration.
|
|
452
|
-
*
|
|
453
|
-
* @example
|
|
454
|
-
* ```ts
|
|
455
|
-
* import { createTokens } from '@vuetify/v0'
|
|
456
|
-
*
|
|
457
|
-
* const tokens = createTokens({
|
|
458
|
-
* colors: { primary: '#1976d2' },
|
|
459
|
-
* })
|
|
460
|
-
* console.log(tokens.resolve('{colors.primary}'))
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
|
-
/**
|
|
464
|
-
* Creates a new token instance.
|
|
465
|
-
*
|
|
466
|
-
* @param tokens The tokens to use.
|
|
467
|
-
* @param options The options for the token instance.
|
|
468
|
-
* @template Z The type of the token ticket.
|
|
469
|
-
* @template E The type of the token context.
|
|
470
|
-
* @returns A new token instance.
|
|
471
|
-
*
|
|
472
|
-
* @see https://www.designtokens.org/tr/drafts/format/
|
|
473
|
-
* @see https://0.vuetifyjs.com/composables/registration/create-tokens
|
|
474
|
-
*
|
|
475
|
-
* @example
|
|
476
|
-
* ```ts
|
|
477
|
-
* import { createTokens } from '@vuetify/v0'
|
|
478
|
-
*
|
|
479
|
-
* const tokens = createTokens({
|
|
480
|
-
* colors: {
|
|
481
|
-
* primary: '#3b82f6',
|
|
482
|
-
* secondary: '{colors.primary}', // Alias reference
|
|
483
|
-
* },
|
|
484
|
-
* })
|
|
485
|
-
*
|
|
486
|
-
* console.log(tokens.resolve('{colors.primary}')) // '#3b82f6'
|
|
487
|
-
* console.log(tokens.resolve('{colors.secondary}')) // '#3b82f6'
|
|
488
|
-
* ```
|
|
489
|
-
*/
|
|
490
|
-
function createTokens(tokens = {}, options = {}) {
|
|
491
|
-
const logger = useLogger();
|
|
492
|
-
const registry = createRegistry(options);
|
|
493
|
-
const cache = /* @__PURE__ */ new Map();
|
|
494
|
-
registry.onboard(flatten(tokens, options.prefix, !!options.flat));
|
|
495
|
-
function isAlias(token) {
|
|
496
|
-
return /* @__PURE__ */ isString(token) && token.length > 2 && token[0] === "{" && token.at(-1) === "}";
|
|
497
|
-
}
|
|
498
|
-
function isTokenAlias(value) {
|
|
499
|
-
return /* @__PURE__ */ isObject(value) && "$value" in value;
|
|
500
|
-
}
|
|
501
|
-
function resolve(token, visited = /* @__PURE__ */ new Set()) {
|
|
502
|
-
const cacheKey = /* @__PURE__ */ isString(token) ? token : JSON.stringify(token);
|
|
503
|
-
if (cache.has(cacheKey)) return cache.get(cacheKey);
|
|
504
|
-
const reference = isTokenAlias(token) ? token.$value : token;
|
|
505
|
-
const isAliasReference = /* @__PURE__ */ isString(reference) && isAlias(reference);
|
|
506
|
-
const clean = isAliasReference ? reference.slice(1, -1) : String(reference);
|
|
507
|
-
if (visited.has(clean)) {
|
|
508
|
-
logger.warn(`Circular alias detected for "${clean}"`);
|
|
509
|
-
cache.set(cacheKey, void 0);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
visited.add(clean);
|
|
513
|
-
let found = registry.get(clean);
|
|
514
|
-
let segments = [];
|
|
515
|
-
if (!found && clean.includes(".")) {
|
|
516
|
-
const parts = clean.split(".");
|
|
517
|
-
for (let i = parts.length - 1; i > 0; i--) {
|
|
518
|
-
const prefix = parts.slice(0, i).join(".");
|
|
519
|
-
const suffix = parts.slice(i);
|
|
520
|
-
const candidate = registry.get(prefix);
|
|
521
|
-
if (!/* @__PURE__ */ isUndefined(candidate?.value)) {
|
|
522
|
-
found = candidate;
|
|
523
|
-
segments = suffix;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
if (/* @__PURE__ */ isUndefined(found?.value)) {
|
|
529
|
-
if (isAliasReference) logger.warn(`Alias not found for "${String(reference)}"`);
|
|
530
|
-
cache.set(cacheKey, void 0);
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
let result;
|
|
534
|
-
let current = found.value;
|
|
535
|
-
if (segments.length > 0) {
|
|
536
|
-
if (isTokenAlias(current)) current = current.$value;
|
|
537
|
-
for (const segment of segments) {
|
|
538
|
-
if (!/* @__PURE__ */ isObject(current) || !(segment in current)) {
|
|
539
|
-
current = void 0;
|
|
540
|
-
break;
|
|
541
|
-
}
|
|
542
|
-
current = current[segment];
|
|
543
|
-
if (isTokenAlias(current)) current = current.$value;
|
|
544
|
-
}
|
|
545
|
-
if (/* @__PURE__ */ isUndefined(current)) {
|
|
546
|
-
logger.warn(`Path not found inside "${clean}": ${segments.join(".")}`);
|
|
547
|
-
cache.set(cacheKey, void 0);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
result = current;
|
|
551
|
-
} else if (isTokenAlias(current)) {
|
|
552
|
-
const inner = current.$value;
|
|
553
|
-
if (/* @__PURE__ */ isString(inner) && isAlias(inner)) return resolve(inner, visited);
|
|
554
|
-
result = inner;
|
|
555
|
-
} else if (/* @__PURE__ */ isString(current) && isAlias(current)) return resolve(current, visited);
|
|
556
|
-
else result = current;
|
|
557
|
-
cache.set(cacheKey, result);
|
|
558
|
-
return result;
|
|
559
|
-
}
|
|
560
|
-
const { register: _register, upsert: _upsert, unregister: _unregister, onboard: _onboard, offboard: _offboard, move: _move, clear: _clear } = registry;
|
|
561
|
-
function register(registration) {
|
|
562
|
-
cache.clear();
|
|
563
|
-
return _register(registration);
|
|
564
|
-
}
|
|
565
|
-
function upsert(id, registration) {
|
|
566
|
-
cache.clear();
|
|
567
|
-
return _upsert(id, registration);
|
|
568
|
-
}
|
|
569
|
-
function unregister(id) {
|
|
570
|
-
cache.clear();
|
|
571
|
-
return _unregister(id);
|
|
572
|
-
}
|
|
573
|
-
function onboard(registrations) {
|
|
574
|
-
cache.clear();
|
|
575
|
-
return _onboard(registrations);
|
|
576
|
-
}
|
|
577
|
-
function offboard(ids) {
|
|
578
|
-
cache.clear();
|
|
579
|
-
return _offboard(ids);
|
|
580
|
-
}
|
|
581
|
-
function move(id, index) {
|
|
582
|
-
cache.clear();
|
|
583
|
-
return _move(id, index);
|
|
584
|
-
}
|
|
585
|
-
function clear() {
|
|
586
|
-
cache.clear();
|
|
587
|
-
return _clear();
|
|
588
|
-
}
|
|
589
|
-
return {
|
|
590
|
-
...registry,
|
|
591
|
-
register,
|
|
592
|
-
upsert,
|
|
593
|
-
unregister,
|
|
594
|
-
onboard,
|
|
595
|
-
offboard,
|
|
596
|
-
move,
|
|
597
|
-
clear,
|
|
598
|
-
resolve,
|
|
599
|
-
isAlias,
|
|
600
|
-
get size() {
|
|
601
|
-
return registry.size;
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Creates a new token context.
|
|
607
|
-
*
|
|
608
|
-
* @param namespace The namespace for the token context.
|
|
609
|
-
* @param tokens The tokens to use.
|
|
610
|
-
* @template Z The type of the token ticket.
|
|
611
|
-
* @template E The type of the token context.
|
|
612
|
-
* @returns A new token context.
|
|
613
|
-
*
|
|
614
|
-
* @see https://0.vuetifyjs.com/composables/registration/create-tokens
|
|
615
|
-
*
|
|
616
|
-
* @example
|
|
617
|
-
* ```ts
|
|
618
|
-
* import { createTokensContext } from '@vuetify/v0'
|
|
619
|
-
*
|
|
620
|
-
* export const [useTokens, provideTokens, context] = createTokensContext({
|
|
621
|
-
* namespace: 'v0:tokens',
|
|
622
|
-
* tokens: {
|
|
623
|
-
* colors: {
|
|
624
|
-
* primary: '#3b82f6',
|
|
625
|
-
* secondary: '{colors.primary}', // Alias reference
|
|
626
|
-
* },
|
|
627
|
-
* },
|
|
628
|
-
* })
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
function createTokensContext(_options) {
|
|
632
|
-
const { namespace = "v0:tokens", tokens = {}, ...options } = _options;
|
|
633
|
-
return createTrinity(namespace, createTokens(tokens, options));
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Returns the current tokens instance.
|
|
637
|
-
*
|
|
638
|
-
* @param namespace The namespace for the tokens context. Defaults to `'v0:tokens'`.
|
|
639
|
-
* @returns The current tokens instance.
|
|
640
|
-
*
|
|
641
|
-
* @see https://0.vuetifyjs.com/composables/registration/create-tokens
|
|
642
|
-
*
|
|
643
|
-
* @example
|
|
644
|
-
* ```vue
|
|
645
|
-
* <script setup lang="ts">
|
|
646
|
-
* import { useTokens } from '@vuetify/v0'
|
|
647
|
-
*
|
|
648
|
-
* const tokens = useTokens()
|
|
649
|
-
* <\/script>
|
|
650
|
-
* ```
|
|
651
|
-
*/
|
|
652
|
-
function useTokens(namespace = "v0:tokens") {
|
|
653
|
-
return useContext(namespace);
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Flattens a nested collection of tokens into a flat array of tokens.
|
|
657
|
-
* Each token is represented by an object containing its ID & value.
|
|
658
|
-
* @param tokens The collection of tokens to flatten.
|
|
659
|
-
* @param prefix An optional prefix to prepend to each token ID.
|
|
660
|
-
* @returns An array of flattened tokens, each with an ID and value.
|
|
661
|
-
*/
|
|
662
|
-
function flatten(tokens, prefix = "", flat = false) {
|
|
663
|
-
const flattened = [];
|
|
664
|
-
const stack = [{
|
|
665
|
-
tokens,
|
|
666
|
-
prefix,
|
|
667
|
-
flat
|
|
668
|
-
}];
|
|
669
|
-
while (stack.length > 0) {
|
|
670
|
-
const { tokens: currentTokens, prefix: currentPrefix, flat } = stack.pop();
|
|
671
|
-
const meta = {};
|
|
672
|
-
for (const k in currentTokens) if (k.startsWith("$")) meta[k] = currentTokens[k];
|
|
673
|
-
if (Object.keys(meta).length > 0 && currentPrefix) flattened.push({
|
|
674
|
-
id: currentPrefix,
|
|
675
|
-
value: meta
|
|
676
|
-
});
|
|
677
|
-
for (const key in currentTokens) {
|
|
678
|
-
if (key.startsWith("$")) continue;
|
|
679
|
-
const value = currentTokens[key];
|
|
680
|
-
const id = currentPrefix ? `${currentPrefix}.${key}` : key;
|
|
681
|
-
if (!/* @__PURE__ */ isObject(value)) {
|
|
682
|
-
flattened.push({
|
|
683
|
-
id,
|
|
684
|
-
value
|
|
685
|
-
});
|
|
686
|
-
continue;
|
|
687
|
-
}
|
|
688
|
-
if ("$value" in value) {
|
|
689
|
-
flattened.push({
|
|
690
|
-
id,
|
|
691
|
-
value
|
|
692
|
-
});
|
|
693
|
-
const inner = value.$value;
|
|
694
|
-
if (/* @__PURE__ */ isObject(inner) && !flat) for (const innerKey in inner) {
|
|
695
|
-
if (innerKey.startsWith("$")) continue;
|
|
696
|
-
const child = inner[innerKey];
|
|
697
|
-
const childId = `${id}.${innerKey}`;
|
|
698
|
-
if (!/* @__PURE__ */ isObject(child)) flattened.push({
|
|
699
|
-
id: childId,
|
|
700
|
-
value: child
|
|
701
|
-
});
|
|
702
|
-
else if ("$value" in child) flattened.push({
|
|
703
|
-
id: childId,
|
|
704
|
-
value: child
|
|
705
|
-
});
|
|
706
|
-
else stack.push({
|
|
707
|
-
tokens: child,
|
|
708
|
-
prefix: childId,
|
|
709
|
-
flat
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
continue;
|
|
713
|
-
}
|
|
714
|
-
if (flat) {
|
|
715
|
-
flattened.push({
|
|
716
|
-
id,
|
|
717
|
-
value
|
|
718
|
-
});
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
stack.push({
|
|
722
|
-
tokens: value,
|
|
723
|
-
prefix: id,
|
|
724
|
-
flat
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return flattened;
|
|
729
|
-
}
|
|
730
|
-
//#endregion
|
|
731
|
-
export { createRegistry as a, useTokens as i, createTokensContext as n, createRegistryContext as o, flatten as r, useRegistry as s, createTokens as t };
|
|
438
|
+
export { createRegistryContext as n, useRegistry as r, createRegistry as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isUndefined, resolveIds, useId as useId$1 } from "./utilities/index.mjs";
|
|
2
2
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { t as createRegistry } from "./createRegistry-Dl-bSSTr.mjs";
|
|
4
4
|
import { computed, isRef, shallowReactive, toRaw, toRef, toValue } from "vue";
|
|
5
5
|
//#region src/composables/createModel/index.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
2
|
-
import { t as createSelection } from "./createSelection-
|
|
2
|
+
import { t as createSelection } from "./createSelection-Csaa-C8p.mjs";
|
|
3
3
|
import { toRef } from "vue";
|
|
4
4
|
//#region src/composables/createSingle/index.ts
|
|
5
5
|
/**
|