@windwalker-io/unicorn-next 0.1.0 → 0.1.1
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/.editorconfig +18 -18
- package/.gulp.json +7 -7
- package/bin/release.mjs +47 -47
- package/dist/chunks/button-radio.js.map +1 -1
- package/dist/chunks/checkboxes-multi-select.js.map +1 -1
- package/dist/chunks/field-cascade-select.js.map +1 -1
- package/dist/chunks/field-file-drag.js.map +1 -1
- package/dist/chunks/field-flatpickr.js.map +1 -1
- package/dist/chunks/field-modal-select.js.map +1 -1
- package/dist/chunks/field-modal-tree.js +2 -2
- package/dist/chunks/field-modal-tree.js.map +1 -1
- package/dist/chunks/field-multi-uploader.js.map +1 -1
- package/dist/chunks/field-repeatable.js.map +1 -1
- package/dist/chunks/field-single-image-drag.js.map +1 -1
- package/dist/chunks/form.js +1 -1
- package/dist/chunks/form.js.map +1 -1
- package/dist/chunks/grid.js.map +1 -1
- package/dist/chunks/http-client.js.map +1 -1
- package/dist/chunks/iframe-modal.js.map +1 -1
- package/dist/chunks/keep-tab.js +1 -1
- package/dist/chunks/keep-tab.js.map +1 -1
- package/dist/chunks/legacy.js +3 -3
- package/dist/chunks/legacy.js.map +1 -1
- package/dist/chunks/list-dependent.js.map +1 -1
- package/dist/chunks/s3-multipart-uploader.js.map +1 -1
- package/dist/chunks/s3-uploader.js.map +1 -1
- package/dist/chunks/show-on.js.map +1 -1
- package/dist/chunks/tinymce.js +14 -4
- package/dist/chunks/tinymce.js.map +1 -1
- package/dist/chunks/ui-bootstrap5.js +9 -2
- package/dist/chunks/ui-bootstrap5.js.map +1 -1
- package/dist/chunks/unicorn.js +94 -46
- package/dist/chunks/unicorn.js.map +1 -1
- package/dist/chunks/validation.js.map +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +55 -36
- package/dist/multi-level-menu.css +1 -1
- package/dist/switcher.css +1 -1
- package/dist/unicorn.js +22 -22
- package/fusionfile.mjs +155 -155
- package/package.json +102 -102
- package/scss/bootstrap/multi-level-menu.scss +121 -121
- package/scss/editor.scss +116 -116
- package/scss/field/file-drag.scss +102 -102
- package/scss/field/single-image-drag.scss +88 -88
- package/scss/field/vue-drag-uploader.scss +160 -160
- package/scss/switcher.scss +156 -156
- package/src/app.ts +128 -128
- package/src/bootstrap/button-radio.ts +208 -208
- package/src/bootstrap/keep-tab.ts +155 -155
- package/src/composable/index.ts +21 -21
- package/src/composable/useCheckboxesMultiSelect.ts +22 -22
- package/src/composable/useFieldCascadeSelect.ts +9 -9
- package/src/composable/useFieldFileDrag.ts +9 -9
- package/src/composable/useFieldFlatpickr.ts +3 -3
- package/src/composable/useFieldModalSelect.ts +6 -6
- package/src/composable/useFieldModalTree.ts +3 -3
- package/src/composable/useFieldMultiUploader.ts +3 -3
- package/src/composable/useFieldRepeatable.ts +9 -9
- package/src/composable/useFieldSingleImageDrag.ts +5 -5
- package/src/composable/useForm.ts +43 -43
- package/src/composable/useGrid.ts +57 -57
- package/src/composable/useHttp.ts +9 -8
- package/src/composable/useIframeModal.ts +9 -9
- package/src/composable/useListDependent.ts +26 -26
- package/src/composable/useQueue.ts +13 -13
- package/src/composable/useS3Uploader.ts +32 -32
- package/src/composable/useShowOn.ts +9 -9
- package/src/composable/useStack.ts +13 -13
- package/src/composable/useTinymce.ts +29 -29
- package/src/composable/useTomSelect.ts +72 -72
- package/src/composable/useUIBootstrap5.ts +48 -48
- package/src/composable/useUniDirective.ts +32 -32
- package/src/composable/useValidation.ts +39 -39
- package/src/data.ts +34 -36
- package/src/events.ts +82 -73
- package/src/legacy/legacy.ts +186 -186
- package/src/legacy/loader.ts +125 -125
- package/src/module/checkboxes-multi-select.ts +54 -54
- package/src/module/field-cascade-select.ts +292 -292
- package/src/module/field-file-drag.ts +292 -292
- package/src/module/field-flatpickr.ts +127 -127
- package/src/module/field-modal-select.ts +174 -174
- package/src/module/field-modal-tree.ts +27 -27
- package/src/module/field-multi-uploader.ts +361 -361
- package/src/module/field-repeatable.ts +202 -202
- package/src/module/field-single-image-drag.ts +468 -468
- package/src/module/form.ts +223 -223
- package/src/module/grid.ts +465 -465
- package/src/module/http-client.ts +248 -243
- package/src/module/iframe-modal.ts +167 -167
- package/src/module/list-dependent.ts +321 -321
- package/src/module/s3-multipart-uploader.ts +300 -300
- package/src/module/s3-uploader.ts +234 -234
- package/src/module/show-on.ts +173 -173
- package/src/module/tinymce.ts +279 -263
- package/src/module/ui-bootstrap5.ts +116 -107
- package/src/module/validation.ts +1019 -1019
- package/src/plugin/index.ts +1 -1
- package/src/plugin/php-adapter.ts +65 -65
- package/src/polyfill/form-request-submit.ts +31 -31
- package/src/polyfill/index.ts +9 -9
- package/src/service/animate.ts +58 -58
- package/src/service/crypto.ts +27 -27
- package/src/service/dom-watcher.ts +62 -62
- package/src/service/dom.ts +265 -265
- package/src/service/helper.ts +48 -48
- package/src/service/index.ts +10 -10
- package/src/service/lang.ts +122 -122
- package/src/service/loader.ts +152 -152
- package/src/service/router.ts +118 -118
- package/src/service/ui.ts +525 -497
- package/src/service/uri.ts +106 -106
- package/src/types/base.ts +9 -9
- package/src/types/index.ts +4 -4
- package/src/types/modal-tree.ts +12 -12
- package/src/types/plugin.ts +6 -6
- package/src/types/shims.d.ts +18 -18
- package/src/types/ui.ts +6 -6
- package/src/unicorn.ts +79 -63
- package/src/utilities/arr.ts +25 -25
- package/src/utilities/base.ts +9 -9
- package/src/utilities/data.ts +48 -48
- package/src/utilities/index.ts +5 -5
- package/src/utilities/tree.ts +20 -20
- package/src/vue/components/ModalTree/ModalTreeApp.vue +175 -175
- package/src/vue/components/ModalTree/TreeItem.vue +262 -262
- package/src/vue/components/ModalTree/TreeModal.vue +225 -225
- package/tests/test.js +4 -4
- package/tsconfig.js.json +25 -25
- package/tsconfig.json +17 -17
- package/vite.assets.config.ts +61 -61
- package/vite.config.test.ts +36 -36
- package/vite.config.ts +112 -112
- package/dist/unicorn-next.css +0 -12
package/dist/chunks/unicorn.js
CHANGED
|
@@ -157,7 +157,7 @@ function mergeDeep(target, ...sources) {
|
|
|
157
157
|
}
|
|
158
158
|
return out;
|
|
159
159
|
}
|
|
160
|
-
function getData(element, name
|
|
160
|
+
function getData(element, name) {
|
|
161
161
|
prepareData(element);
|
|
162
162
|
if (name === void 0) {
|
|
163
163
|
return element.__unicorn;
|
|
@@ -368,17 +368,41 @@ function animateTo(element, styles, options = {}) {
|
|
|
368
368
|
}
|
|
369
369
|
const _AlertAdapter = class _AlertAdapter {
|
|
370
370
|
};
|
|
371
|
-
_AlertAdapter.alert = async (title) =>
|
|
372
|
-
|
|
371
|
+
_AlertAdapter.alert = async (title, text) => {
|
|
372
|
+
if (text) {
|
|
373
|
+
title += " | " + text;
|
|
374
|
+
}
|
|
375
|
+
return window.alert(title);
|
|
376
|
+
};
|
|
377
|
+
_AlertAdapter.confirm = async (title, text) => {
|
|
373
378
|
return new Promise((resolve) => {
|
|
379
|
+
if (text) {
|
|
380
|
+
title += " | " + text;
|
|
381
|
+
}
|
|
374
382
|
const v = confirm(title);
|
|
375
383
|
resolve(v);
|
|
376
384
|
});
|
|
377
385
|
};
|
|
378
|
-
_AlertAdapter.deleteConfirm = async (title) => _AlertAdapter.confirm(title);
|
|
379
|
-
_AlertAdapter.
|
|
380
|
-
|
|
381
|
-
|
|
386
|
+
_AlertAdapter.deleteConfirm = async (title, text) => _AlertAdapter.confirm(title, text);
|
|
387
|
+
_AlertAdapter.notify = async (title, text, type = "log") => {
|
|
388
|
+
if (text) {
|
|
389
|
+
title += " | " + text;
|
|
390
|
+
}
|
|
391
|
+
if (type === "error") {
|
|
392
|
+
console.error(title);
|
|
393
|
+
} else if (type === "warn") {
|
|
394
|
+
console.warn(title);
|
|
395
|
+
} else {
|
|
396
|
+
console.log(title);
|
|
397
|
+
}
|
|
398
|
+
return async () => {
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
_AlertAdapter.clearNotifies = async () => {
|
|
402
|
+
};
|
|
403
|
+
_AlertAdapter.confirmText = () => "OK";
|
|
404
|
+
_AlertAdapter.cancelText = () => "Cancel";
|
|
405
|
+
_AlertAdapter.deleteText = () => "Delete";
|
|
382
406
|
let AlertAdapter = _AlertAdapter;
|
|
383
407
|
async function simpleAlert(title, text = "", icon = "info", extra) {
|
|
384
408
|
return AlertAdapter.alert(title, text, icon, extra);
|
|
@@ -389,6 +413,12 @@ async function simpleConfirm(title, text = "", icon = "info", extra) {
|
|
|
389
413
|
async function deleteConfirm(title, text = "", icon = "info", extra) {
|
|
390
414
|
return AlertAdapter.deleteConfirm(title, text, icon, extra);
|
|
391
415
|
}
|
|
416
|
+
async function simpleNotify(title, text = "", type = "info", extra) {
|
|
417
|
+
return AlertAdapter.notify(title, text, type, extra);
|
|
418
|
+
}
|
|
419
|
+
async function clearNotifies() {
|
|
420
|
+
return AlertAdapter.clearNotifies();
|
|
421
|
+
}
|
|
392
422
|
function isNode() {
|
|
393
423
|
return typeof window === "undefined";
|
|
394
424
|
}
|
|
@@ -960,7 +990,7 @@ class UnicornLang {
|
|
|
960
990
|
}
|
|
961
991
|
function useScriptImport(src, attrs = {}) {
|
|
962
992
|
const script = document.createElement("script");
|
|
963
|
-
script.src = src;
|
|
993
|
+
script.src = resolveUrl(src);
|
|
964
994
|
for (const key in attrs) {
|
|
965
995
|
script.setAttribute(key, attrs[key]);
|
|
966
996
|
}
|
|
@@ -1324,15 +1354,33 @@ AlertAdapter.alert = (title, text = "", type = "info") => {
|
|
|
1324
1354
|
window.alert(title);
|
|
1325
1355
|
return Promise.resolve();
|
|
1326
1356
|
};
|
|
1327
|
-
AlertAdapter.confirm = (message) => {
|
|
1357
|
+
AlertAdapter.confirm = (message, text = "", type = "info") => {
|
|
1328
1358
|
message = message || "Are you sure?";
|
|
1359
|
+
if (text) {
|
|
1360
|
+
message += " | " + text;
|
|
1361
|
+
}
|
|
1329
1362
|
return new Promise((resolve) => {
|
|
1330
1363
|
resolve(window.confirm(message));
|
|
1331
1364
|
});
|
|
1332
1365
|
};
|
|
1366
|
+
AlertAdapter.notify = async (title, text, type = "log") => {
|
|
1367
|
+
if (text) {
|
|
1368
|
+
title += " | " + text;
|
|
1369
|
+
}
|
|
1370
|
+
return ui.theme?.renderMessage(title, type) ?? (() => null);
|
|
1371
|
+
};
|
|
1372
|
+
AlertAdapter.clearNotifies = async () => {
|
|
1373
|
+
ui.theme?.clearMessages();
|
|
1374
|
+
};
|
|
1333
1375
|
AlertAdapter.confirmText = () => "OK";
|
|
1334
1376
|
AlertAdapter.cancelText = () => "Cancel";
|
|
1335
1377
|
AlertAdapter.deleteText = () => "Delete";
|
|
1378
|
+
function useAlertAdapter(config) {
|
|
1379
|
+
if (config) {
|
|
1380
|
+
Object.assign(AlertAdapter, config);
|
|
1381
|
+
}
|
|
1382
|
+
return AlertAdapter;
|
|
1383
|
+
}
|
|
1336
1384
|
function useUI(instance) {
|
|
1337
1385
|
if (instance) {
|
|
1338
1386
|
ui = instance;
|
|
@@ -1352,7 +1400,6 @@ function useUITheme(theme) {
|
|
|
1352
1400
|
}
|
|
1353
1401
|
class UnicornUI {
|
|
1354
1402
|
theme;
|
|
1355
|
-
aliveHandle;
|
|
1356
1403
|
static get defaultOptions() {
|
|
1357
1404
|
return {
|
|
1358
1405
|
messageSelector: ".message-wrap"
|
|
@@ -1420,16 +1467,10 @@ async function prepareAlpineDefer(callback) {
|
|
|
1420
1467
|
await callback(window.Alpine);
|
|
1421
1468
|
}
|
|
1422
1469
|
function renderMessage(messages, type = "info") {
|
|
1423
|
-
ui.theme
|
|
1470
|
+
return ui.theme?.renderMessage(messages, type);
|
|
1424
1471
|
}
|
|
1425
1472
|
function clearMessages() {
|
|
1426
|
-
ui.theme
|
|
1427
|
-
}
|
|
1428
|
-
function notify(messages, type = "info") {
|
|
1429
|
-
ui.theme.renderMessage(messages, type);
|
|
1430
|
-
}
|
|
1431
|
-
function clearNotifies() {
|
|
1432
|
-
ui.theme.clearMessages();
|
|
1473
|
+
ui.theme?.clearMessages();
|
|
1433
1474
|
}
|
|
1434
1475
|
async function mark(selector, keyword = "", options = {}) {
|
|
1435
1476
|
const modules = await useImport("@vendor/mark.js/dist/mark.min.js");
|
|
@@ -1824,7 +1865,7 @@ function removeCloak() {
|
|
|
1824
1865
|
}
|
|
1825
1866
|
selectAll("[uni-cloak]", (el) => el.removeAttribute("uni-cloak"));
|
|
1826
1867
|
}
|
|
1827
|
-
function data(ele, name
|
|
1868
|
+
function data(ele, name, value) {
|
|
1828
1869
|
if (!(ele instanceof HTMLElement)) {
|
|
1829
1870
|
value = name;
|
|
1830
1871
|
name = ele;
|
|
@@ -1834,8 +1875,7 @@ function data(ele, name = void 0, value = void 0) {
|
|
|
1834
1875
|
return getData(ele);
|
|
1835
1876
|
}
|
|
1836
1877
|
if (value === void 0) {
|
|
1837
|
-
|
|
1838
|
-
return res;
|
|
1878
|
+
return getData(ele, name);
|
|
1839
1879
|
}
|
|
1840
1880
|
setData(ele, name, value);
|
|
1841
1881
|
}
|
|
@@ -1961,11 +2001,11 @@ class UnicornApp extends (/* @__PURE__ */ Mixin(EventMixin)) {
|
|
|
1961
2001
|
this.waits = [];
|
|
1962
2002
|
return promise;
|
|
1963
2003
|
}
|
|
1964
|
-
macro(name,
|
|
2004
|
+
macro(name, prop) {
|
|
1965
2005
|
if (this[name]) {
|
|
1966
2006
|
throw new Error(`Macro: ${name} already exists.`);
|
|
1967
2007
|
}
|
|
1968
|
-
this[name] =
|
|
2008
|
+
this[name] = prop;
|
|
1969
2009
|
return this;
|
|
1970
2010
|
}
|
|
1971
2011
|
}
|
|
@@ -2063,8 +2103,16 @@ const useInject = (id, def) => {
|
|
|
2063
2103
|
function pushUnicornToGlobal(app2) {
|
|
2064
2104
|
window.u = app2 ?? useUnicorn();
|
|
2065
2105
|
}
|
|
2066
|
-
function useMacro(name,
|
|
2067
|
-
useUnicorn()
|
|
2106
|
+
function useMacro(name, prop) {
|
|
2107
|
+
const app2 = useUnicorn();
|
|
2108
|
+
if (typeof name === "string") {
|
|
2109
|
+
app2.macro(name, prop);
|
|
2110
|
+
} else {
|
|
2111
|
+
for (const k in name) {
|
|
2112
|
+
app2.macro(k, name[k]);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
return app2;
|
|
2068
2116
|
}
|
|
2069
2117
|
async function useLegacy(app2) {
|
|
2070
2118
|
app2 ??= useUnicorn();
|
|
@@ -2115,7 +2163,7 @@ export {
|
|
|
2115
2163
|
useImport as a8,
|
|
2116
2164
|
useCssImport as a9,
|
|
2117
2165
|
useCssIncludes as aA,
|
|
2118
|
-
|
|
2166
|
+
useAlertAdapter as aB,
|
|
2119
2167
|
useUI as aC,
|
|
2120
2168
|
UnicornUI as aD,
|
|
2121
2169
|
useVueComponentField as aE,
|
|
@@ -2149,22 +2197,22 @@ export {
|
|
|
2149
2197
|
createQueue as af,
|
|
2150
2198
|
trans as ag,
|
|
2151
2199
|
useUITheme as ah,
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2200
|
+
useScriptImport as ai,
|
|
2201
|
+
sleep as aj,
|
|
2202
|
+
createUnicorn as ak,
|
|
2203
|
+
createUnicornWithPlugins as al,
|
|
2204
|
+
useUnicorn as am,
|
|
2205
|
+
useInject as an,
|
|
2206
|
+
pushUnicornToGlobal as ao,
|
|
2207
|
+
useMacro as ap,
|
|
2208
|
+
useLegacy as aq,
|
|
2209
|
+
removeData as ar,
|
|
2210
|
+
randomBytes as as,
|
|
2211
|
+
randomBytesString as at,
|
|
2212
|
+
AttributeMutationObserver as au,
|
|
2213
|
+
nextTick as av,
|
|
2214
|
+
wait as aw,
|
|
2215
|
+
useLang as ax,
|
|
2168
2216
|
doImport as ay,
|
|
2169
2217
|
useSeriesImport as az,
|
|
2170
2218
|
animateTo as b,
|
|
@@ -2185,12 +2233,12 @@ export {
|
|
|
2185
2233
|
useFormValidationSync as k,
|
|
2186
2234
|
loadAlpine as l,
|
|
2187
2235
|
useStack as m,
|
|
2188
|
-
|
|
2189
|
-
|
|
2236
|
+
useQueue as n,
|
|
2237
|
+
useSystemUri as o,
|
|
2190
2238
|
prepareAlpine as p,
|
|
2191
|
-
|
|
2239
|
+
useAssetUri as q,
|
|
2192
2240
|
route as r,
|
|
2193
|
-
|
|
2241
|
+
simpleNotify as s,
|
|
2194
2242
|
domready as t,
|
|
2195
2243
|
useHttpClient as u,
|
|
2196
2244
|
selectOne as v,
|