@windwalker-io/unicorn-next 0.1.4 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import { i as isDebug, u as useHttpClient, _ as __, r as route, a as useUniDirective, b as animateTo, c as renderMessage, d as clearMessages, s as simpleNotify, e as clearNotifies, l as loadAlpine, f as initAlpineComponent, p as prepareAlpine, g as useFormValidation, h as addGlobalValidator, j as useFieldValidationSync, k as useFormValidationInstance, m as useStack, n as useQueue, o as useSystemUri, q as useAssetUri, t as domready, v as selectOne, w as selectAll, x as getBoundedInstance, y as getBoundedInstanceList, z as module, A as h, B as html, C as delegate, D as debounce, E as throttle, F as simpleConfirm, G as simpleAlert, H as sprintfExports, I as base64UrlEncode, J as base64UrlDecode, K as uid, L as tid, M as serial, N as mark, O as useTomSelect, P as slideUp, Q as slideDown, R as slideToggle, S as fadeOut, T as fadeIn, U as highlight, V as useColorPicker, W as useDisableOnSubmit, X as useDisableIfStackNotEmpty, Y as useCheckboxesMultiSelect, Z as useKeepAlive, $ as useBs5KeepTab, a0 as useBs5ButtonRadio, a1 as useBs5Tooltip, a2 as useFormAsync, a3 as useGridAsync, a4 as useForm, a5 as useGrid } from "./unicorn.js";
1
+ import { i as isDebug, u as useHttpClient, _ as __, r as route, a as useUniDirective, b as animateTo, c as renderMessage, d as clearMessages, s as simpleNotify, e as clearNotifies, l as loadAlpine, f as initAlpineComponent, p as prepareAlpine, g as useFormValidation, h as addGlobalValidator, j as useFieldValidationInstance, k as useFormValidationInstance, m as useStack, n as useQueue, o as useSystemUri, q as useAssetUri, t as domready, v as selectOne, w as selectAll, x as getBoundedInstance, y as getBoundedInstanceList, z as module, A as h, B as html, C as delegate, D as debounce, E as throttle, F as simpleConfirm, G as simpleAlert, H as sprintfExports, I as base64UrlEncode, J as base64UrlDecode, K as uid, L as tid, M as serial, N as mark, O as useTomSelect, P as slideUp, Q as slideDown, R as slideToggle, S as fadeOut, T as fadeIn, U as highlight, V as useColorPicker, W as useDisableOnSubmit, X as useDisableIfStackNotEmpty, Y as useCheckboxesMultiSelect, Z as useKeepAlive, $ as useBs5KeepTab, a0 as useBs5ButtonRadio, a1 as useBs5Tooltip, a2 as useFormAsync, a3 as useGridAsync, a4 as useForm, a5 as useGrid } from "./unicorn.js";
2
2
  function numberFormat(number, decimals = 0, decPoint = ".", thousandsSep = ",") {
3
3
  number = Number(number);
4
4
  const str = number.toFixed(decimals ? decimals : 0).toString().split(".");
@@ -133,7 +133,7 @@ async function useLegacyMethods(app) {
133
133
  app.formValidation = useFormValidation;
134
134
  app.$validation = {
135
135
  get: useFormValidationInstance,
136
- getField: useFieldValidationSync,
136
+ getField: useFieldValidationInstance,
137
137
  addGlobalValidator,
138
138
  import: () => useFormValidation()
139
139
  };
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.js","sources":["../../../../../../node_modules/@lyrasoft/ts-toolkit/src/generic/number.ts","../../src/legacy/loader.ts","../../src/legacy/legacy.ts"],"sourcesContent":["export function numberFormat(number: string | number, decimals = 0, decPoint = '.', thousandsSep = ',') {\n number = Number(number);\n\n const str = number.toFixed(decimals ? decimals : 0).toString().split('.');\n const parts = [];\n\n for (var i = str[0].length; i > 0; i -= 3) {\n parts.unshift(str[0].substring(Math.max(0, i - 3), i));\n }\n\n str[0] = parts.join(thousandsSep ? thousandsSep : ',');\n\n return str.join(decPoint ? decPoint : '.');\n}\n","import { isDebug } from '../service';\r\n\r\nconst imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};\r\n\r\nexport class LegacyLoader {\r\n static install(app: any) {\r\n const loader = app.$loader = new this(app);\r\n\r\n app.import = loader.import.bind(loader);\r\n app.importSync = loader.importSync.bind(loader);\r\n app.importCSS = loader.importCSS.bind(loader);\r\n app.minFileName = loader.minFileName.bind(loader);\r\n app.afterImported = loader.afterImported.bind(loader);\r\n }\r\n\r\n constructor(protected app: any) {\r\n //\r\n }\r\n\r\n doImport(src: string): Promise<any> {\r\n return S.import(src);\r\n }\r\n\r\n /**\r\n * Import modules or scripts.\r\n */\r\n import(...src: any[]): Promise<any|any[]> {\r\n if (src.length === 1) {\r\n return this.doImport(src[0]);\r\n }\r\n\r\n const promises: Promise<any>[] = [];\r\n\r\n src.forEach((link) => {\r\n promises.push(\r\n link instanceof Promise ? link : this.doImport(link)\r\n );\r\n });\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n /**\r\n * Import sync.\r\n */\r\n importSync(...src: any): Promise<any|any[]> {\r\n let promise: Promise<any> = Promise.resolve();\r\n let url: string[];\r\n const modules: any[] = [];\r\n\r\n while (url = src.shift()) {\r\n if (!Array.isArray(url)) {\r\n url = [ url ];\r\n }\r\n\r\n const target = url;\r\n promise = promise.then(\r\n () => this.import(...target).then((m) => {\r\n modules.push(m);\r\n return modules;\r\n })\r\n );\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * Import CSS files.\r\n */\r\n async importCSS(...src: any): Promise<any|any[]> {\r\n let modules: any = await this.import(...src);\r\n\r\n if (!Array.isArray(modules)) {\r\n modules = [modules];\r\n }\r\n\r\n const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);\r\n\r\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];\r\n }\r\n\r\n minFileName(fileName: string): string {\r\n const segments = fileName.split('.');\r\n const ext = segments.pop();\r\n\r\n if (isDebug()) {\r\n return segments.join('.') + '.min.' + ext;\r\n }\r\n\r\n return fileName;\r\n }\r\n\r\n asImported(name: string) {\r\n if (!imports[name]) {\r\n imports[name] = {\r\n promise: Promise.resolve(),\r\n resolve: undefined\r\n };\r\n } else {\r\n imports[name]?.resolve?.();\r\n }\r\n }\r\n\r\n /**\r\n * Add after import hook for some url or id.\r\n */\r\n afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {\r\n if (!imports[name]) {\r\n let r;\r\n imports[name] = {\r\n promise: new Promise((resolve) => {\r\n r = resolve;\r\n }),\r\n };\r\n\r\n imports[name].resolve = r;\r\n }\r\n\r\n imports[name].promise.then(callback);\r\n\r\n return imports[name].promise;\r\n }\r\n}\r\n\r\n","import { numberFormat } from '@lyrasoft/ts-toolkit/generic';\r\nimport { sprintf, vsprintf } from 'sprintf-js';\r\nimport {\r\n addGlobalValidator,\r\n useBs5ButtonRadio,\r\n useBs5KeepTab,\r\n useBs5Tooltip,\r\n useCheckboxesMultiSelect,\r\n useFieldValidationSync,\r\n useForm,\r\n useFormAsync,\r\n useFormValidation,\r\n useFormValidationInstance,\r\n useGrid,\r\n useGridAsync,\r\n useHttpClient,\r\n useQueue,\r\n useStack,\r\n useTomSelect,\r\n useUniDirective\r\n} from '../composable';\r\nimport {\r\n __,\r\n animateTo,\r\n base64UrlDecode,\r\n base64UrlEncode,\r\n clearMessages,\r\n clearNotifies,\r\n debounce,\r\n delegate,\r\n domready,\r\n fadeIn,\r\n fadeOut,\r\n getBoundedInstance,\r\n getBoundedInstanceList,\r\n h,\r\n highlight,\r\n html,\r\n initAlpineComponent,\r\n isDebug,\r\n loadAlpine,\r\n mark,\r\n module,\r\n prepareAlpine,\r\n renderMessage,\r\n route,\r\n selectAll,\r\n selectOne,\r\n serial,\r\n simpleAlert,\r\n simpleConfirm,\r\n simpleNotify,\r\n slideDown,\r\n slideToggle,\r\n slideUp,\r\n throttle,\r\n tid,\r\n uid,\r\n useAssetUri,\r\n useColorPicker,\r\n useDisableIfStackNotEmpty,\r\n useDisableOnSubmit,\r\n useKeepAlive,\r\n useSystemUri\r\n} from '../service';\r\nimport { LegacyLoader } from './loader';\r\n\r\nexport async function useLegacyMethods(app: any) {\r\n const http = await useHttpClient();\r\n\r\n app.use(LegacyLoader);\r\n\r\n handleUri(app);\r\n handlerHelper(app);\r\n handleCrypto(app);\r\n\r\n app.__ = __;\r\n app.trans = __;\r\n app.route = route;\r\n app.$http = http;\r\n app.directive = useUniDirective;\r\n\r\n app.animate = animateTo;\r\n app.$animation = { to: animateTo };\r\n\r\n app.addMessage = renderMessage;\r\n app.clearMessages = clearMessages;\r\n app.notify = simpleNotify;\r\n app.clearNotifies = clearNotifies;\r\n\r\n app.loadAlpine = loadAlpine;\r\n app.initAlpine = initAlpineComponent;\r\n app.beforeAlpineInit = prepareAlpine;\r\n app.prepareAlpine = prepareAlpine;\r\n\r\n handleUI(app);\r\n\r\n await handleFormGrid(app);\r\n\r\n app.formValidation = useFormValidation;\r\n app.$validation = {\r\n get: useFormValidationInstance,\r\n getField: useFieldValidationSync,\r\n addGlobalValidator: addGlobalValidator,\r\n import: () => useFormValidation()\r\n };\r\n\r\n app.stack = useStack;\r\n app.queue = useQueue;\r\n}\r\n\r\nfunction handleCrypto(app: any) {\r\n app.base64Encode = base64UrlEncode;\r\n app.base64Decode = base64UrlDecode;\r\n // app.uuid4 = uuid4;\r\n app.uid = uid;\r\n app.tid = tid;\r\n // app.md5 = md5;\r\n app.serial = serial;\r\n}\r\n\r\nfunction handleUri(app: any) {\r\n app.uri = useSystemUri;\r\n app.asset = useAssetUri;\r\n}\r\n\r\nfunction handlerHelper(app: any) {\r\n app.domready = domready;\r\n app.selectOne = selectOne;\r\n app.selectAll = selectAll;\r\n app.each = selectAll;\r\n app.getBoundedInstance = getBoundedInstance;\r\n app.getBoundedInstanceList = getBoundedInstanceList;\r\n app.module = module;\r\n app.h = h;\r\n app.html = html;\r\n // app.$get = get;\r\n // app.$set = set;\r\n app.delegate = delegate;\r\n app.debounce = debounce;\r\n app.throttle = throttle;\r\n app.isDebug = isDebug;\r\n app.confirm = simpleConfirm;\r\n app.alert = simpleAlert;\r\n app.numberFormat = numberFormat;\r\n app.sprintf = sprintf;\r\n app.vsprintf = vsprintf;\r\n // app.genRandomString = genRandomString;\r\n // app.defaultsDeep = defaultsDeep;\r\n}\r\n\r\nfunction handleUI(app: any) {\r\n app.$ui ??= {};\r\n app.$ui.addMessage = renderMessage;\r\n app.$ui.clearMessages = clearMessages;\r\n app.$ui.notify = simpleNotify;\r\n app.$ui.clearNotifies = clearNotifies;\r\n\r\n app.$ui.loadAlpine = loadAlpine;\r\n app.$ui.initAlpine = initAlpineComponent;\r\n app.$ui.beforeAlpineInit = prepareAlpine;\r\n app.$ui.prepareAlpine = prepareAlpine;\r\n\r\n app.$ui.mark = mark;\r\n app.$ui.tomSelect = useTomSelect;\r\n app.$ui.slideUp = slideUp;\r\n app.$ui.slideDown = slideDown;\r\n app.$ui.slideToggle = slideToggle;\r\n app.$ui.fadeOut = fadeOut;\r\n app.$ui.fadeIn = fadeIn;\r\n app.$ui.highlight = highlight;\r\n app.$ui.colorPicker = useColorPicker;\r\n app.$ui.disableOnSubmit = useDisableOnSubmit;\r\n app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;\r\n app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;\r\n app.$ui.keepAlive = useKeepAlive;\r\n app.$ui.bootstrap = {\r\n tooltip: useBs5Tooltip,\r\n buttonRadio: useBs5ButtonRadio,\r\n keepTab: useBs5KeepTab,\r\n };\r\n}\r\n\r\nasync function handleFormGrid(app: any) {\r\n await useFormAsync();\r\n await useGridAsync();\r\n\r\n app.form = useForm;\r\n app.grid = useGrid;\r\n}\r\n"],"names":["module","sprintf","vsprintf"],"mappings":";AAAO,SAAS,aAAa,QAAyB,WAAW,GAAG,WAAW,KAAK,eAAe,KAAK;AACtG,WAAS,OAAO,MAAM;AAEtB,QAAM,MAAM,OAAO,QAAQ,WAAW,WAAW,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG;AACxE,QAAM,QAAQ,CAAA;AAEd,WAAS,IAAI,IAAI,CAAC,EAAE,QAAQ,IAAI,GAAG,KAAK,GAAG;AACzC,UAAM,QAAQ,IAAI,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,EACvD;AAEA,MAAI,CAAC,IAAI,MAAM,KAAK,eAAe,eAAe,GAAG;AAErD,SAAO,IAAI,KAAK,WAAW,WAAW,GAAG;AAC3C;ACXA,MAAM,UAA0E,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B,MAAI,IAAI,mBAAmB;AAC3B,MAAI,IAAI,gBAAgB;AAExB,MAAI,IAAI,OAAO;AACf,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,SAAS;AACjB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,kBAAkB;AAC1B,MAAI,IAAI,yBAAyB;AACjC,MAAI,IAAI,wBAAwB;AAChC,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,YAAY;AAAA,IAClB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,EAAA;AAEb;AAEA,eAAe,eAAe,KAAU;AACtC,QAAM,aAAA;AACN,QAAM,aAAA;AAEN,MAAI,OAAO;AACX,MAAI,OAAO;AACb;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"legacy.js","sources":["../../../../../../node_modules/@lyrasoft/ts-toolkit/src/generic/number.ts","../../src/legacy/loader.ts","../../src/legacy/legacy.ts"],"sourcesContent":["export function numberFormat(number: string | number, decimals = 0, decPoint = '.', thousandsSep = ',') {\n number = Number(number);\n\n const str = number.toFixed(decimals ? decimals : 0).toString().split('.');\n const parts = [];\n\n for (var i = str[0].length; i > 0; i -= 3) {\n parts.unshift(str[0].substring(Math.max(0, i - 3), i));\n }\n\n str[0] = parts.join(thousandsSep ? thousandsSep : ',');\n\n return str.join(decPoint ? decPoint : '.');\n}\n","import { isDebug } from '../service';\r\n\r\nconst imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};\r\n\r\nexport class LegacyLoader {\r\n static install(app: any) {\r\n const loader = app.$loader = new this(app);\r\n\r\n app.import = loader.import.bind(loader);\r\n app.importSync = loader.importSync.bind(loader);\r\n app.importCSS = loader.importCSS.bind(loader);\r\n app.minFileName = loader.minFileName.bind(loader);\r\n app.afterImported = loader.afterImported.bind(loader);\r\n }\r\n\r\n constructor(protected app: any) {\r\n //\r\n }\r\n\r\n doImport(src: string): Promise<any> {\r\n return S.import(src);\r\n }\r\n\r\n /**\r\n * Import modules or scripts.\r\n */\r\n import(...src: any[]): Promise<any|any[]> {\r\n if (src.length === 1) {\r\n return this.doImport(src[0]);\r\n }\r\n\r\n const promises: Promise<any>[] = [];\r\n\r\n src.forEach((link) => {\r\n promises.push(\r\n link instanceof Promise ? link : this.doImport(link)\r\n );\r\n });\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n /**\r\n * Import sync.\r\n */\r\n importSync(...src: any): Promise<any|any[]> {\r\n let promise: Promise<any> = Promise.resolve();\r\n let url: string[];\r\n const modules: any[] = [];\r\n\r\n while (url = src.shift()) {\r\n if (!Array.isArray(url)) {\r\n url = [ url ];\r\n }\r\n\r\n const target = url;\r\n promise = promise.then(\r\n () => this.import(...target).then((m) => {\r\n modules.push(m);\r\n return modules;\r\n })\r\n );\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * Import CSS files.\r\n */\r\n async importCSS(...src: any): Promise<any|any[]> {\r\n let modules: any = await this.import(...src);\r\n\r\n if (!Array.isArray(modules)) {\r\n modules = [modules];\r\n }\r\n\r\n const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);\r\n\r\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];\r\n }\r\n\r\n minFileName(fileName: string): string {\r\n const segments = fileName.split('.');\r\n const ext = segments.pop();\r\n\r\n if (isDebug()) {\r\n return segments.join('.') + '.min.' + ext;\r\n }\r\n\r\n return fileName;\r\n }\r\n\r\n asImported(name: string) {\r\n if (!imports[name]) {\r\n imports[name] = {\r\n promise: Promise.resolve(),\r\n resolve: undefined\r\n };\r\n } else {\r\n imports[name]?.resolve?.();\r\n }\r\n }\r\n\r\n /**\r\n * Add after import hook for some url or id.\r\n */\r\n afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {\r\n if (!imports[name]) {\r\n let r;\r\n imports[name] = {\r\n promise: new Promise((resolve) => {\r\n r = resolve;\r\n }),\r\n };\r\n\r\n imports[name].resolve = r;\r\n }\r\n\r\n imports[name].promise.then(callback);\r\n\r\n return imports[name].promise;\r\n }\r\n}\r\n\r\n","import { numberFormat } from '@lyrasoft/ts-toolkit/generic';\r\nimport { sprintf, vsprintf } from 'sprintf-js';\r\nimport {\r\n addGlobalValidator,\r\n useBs5ButtonRadio,\r\n useBs5KeepTab,\r\n useBs5Tooltip,\r\n useCheckboxesMultiSelect,\r\n useFieldValidationInstance,\r\n useForm,\r\n useFormAsync,\r\n useFormValidation,\r\n useFormValidationInstance,\r\n useGrid,\r\n useGridAsync,\r\n useHttpClient,\r\n useQueue,\r\n useStack,\r\n useTomSelect,\r\n useUniDirective\r\n} from '../composable';\r\nimport {\r\n __,\r\n animateTo,\r\n base64UrlDecode,\r\n base64UrlEncode,\r\n clearMessages,\r\n clearNotifies,\r\n debounce,\r\n delegate,\r\n domready,\r\n fadeIn,\r\n fadeOut,\r\n getBoundedInstance,\r\n getBoundedInstanceList,\r\n h,\r\n highlight,\r\n html,\r\n initAlpineComponent,\r\n isDebug,\r\n loadAlpine,\r\n mark,\r\n module,\r\n prepareAlpine,\r\n renderMessage,\r\n route,\r\n selectAll,\r\n selectOne,\r\n serial,\r\n simpleAlert,\r\n simpleConfirm,\r\n simpleNotify,\r\n slideDown,\r\n slideToggle,\r\n slideUp,\r\n throttle,\r\n tid,\r\n uid,\r\n useAssetUri,\r\n useColorPicker,\r\n useDisableIfStackNotEmpty,\r\n useDisableOnSubmit,\r\n useKeepAlive,\r\n useSystemUri\r\n} from '../service';\r\nimport { LegacyLoader } from './loader';\r\n\r\nexport async function useLegacyMethods(app: any) {\r\n const http = await useHttpClient();\r\n\r\n app.use(LegacyLoader);\r\n\r\n handleUri(app);\r\n handlerHelper(app);\r\n handleCrypto(app);\r\n\r\n app.__ = __;\r\n app.trans = __;\r\n app.route = route;\r\n app.$http = http;\r\n app.directive = useUniDirective;\r\n\r\n app.animate = animateTo;\r\n app.$animation = { to: animateTo };\r\n\r\n app.addMessage = renderMessage;\r\n app.clearMessages = clearMessages;\r\n app.notify = simpleNotify;\r\n app.clearNotifies = clearNotifies;\r\n\r\n app.loadAlpine = loadAlpine;\r\n app.initAlpine = initAlpineComponent;\r\n app.beforeAlpineInit = prepareAlpine;\r\n app.prepareAlpine = prepareAlpine;\r\n\r\n handleUI(app);\r\n\r\n await handleFormGrid(app);\r\n\r\n app.formValidation = useFormValidation;\r\n app.$validation = {\r\n get: useFormValidationInstance,\r\n getField: useFieldValidationInstance,\r\n addGlobalValidator: addGlobalValidator,\r\n import: () => useFormValidation()\r\n };\r\n\r\n app.stack = useStack;\r\n app.queue = useQueue;\r\n}\r\n\r\nfunction handleCrypto(app: any) {\r\n app.base64Encode = base64UrlEncode;\r\n app.base64Decode = base64UrlDecode;\r\n // app.uuid4 = uuid4;\r\n app.uid = uid;\r\n app.tid = tid;\r\n // app.md5 = md5;\r\n app.serial = serial;\r\n}\r\n\r\nfunction handleUri(app: any) {\r\n app.uri = useSystemUri;\r\n app.asset = useAssetUri;\r\n}\r\n\r\nfunction handlerHelper(app: any) {\r\n app.domready = domready;\r\n app.selectOne = selectOne;\r\n app.selectAll = selectAll;\r\n app.each = selectAll;\r\n app.getBoundedInstance = getBoundedInstance;\r\n app.getBoundedInstanceList = getBoundedInstanceList;\r\n app.module = module;\r\n app.h = h;\r\n app.html = html;\r\n // app.$get = get;\r\n // app.$set = set;\r\n app.delegate = delegate;\r\n app.debounce = debounce;\r\n app.throttle = throttle;\r\n app.isDebug = isDebug;\r\n app.confirm = simpleConfirm;\r\n app.alert = simpleAlert;\r\n app.numberFormat = numberFormat;\r\n app.sprintf = sprintf;\r\n app.vsprintf = vsprintf;\r\n // app.genRandomString = genRandomString;\r\n // app.defaultsDeep = defaultsDeep;\r\n}\r\n\r\nfunction handleUI(app: any) {\r\n app.$ui ??= {};\r\n app.$ui.addMessage = renderMessage;\r\n app.$ui.clearMessages = clearMessages;\r\n app.$ui.notify = simpleNotify;\r\n app.$ui.clearNotifies = clearNotifies;\r\n\r\n app.$ui.loadAlpine = loadAlpine;\r\n app.$ui.initAlpine = initAlpineComponent;\r\n app.$ui.beforeAlpineInit = prepareAlpine;\r\n app.$ui.prepareAlpine = prepareAlpine;\r\n\r\n app.$ui.mark = mark;\r\n app.$ui.tomSelect = useTomSelect;\r\n app.$ui.slideUp = slideUp;\r\n app.$ui.slideDown = slideDown;\r\n app.$ui.slideToggle = slideToggle;\r\n app.$ui.fadeOut = fadeOut;\r\n app.$ui.fadeIn = fadeIn;\r\n app.$ui.highlight = highlight;\r\n app.$ui.colorPicker = useColorPicker;\r\n app.$ui.disableOnSubmit = useDisableOnSubmit;\r\n app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;\r\n app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;\r\n app.$ui.keepAlive = useKeepAlive;\r\n app.$ui.bootstrap = {\r\n tooltip: useBs5Tooltip,\r\n buttonRadio: useBs5ButtonRadio,\r\n keepTab: useBs5KeepTab,\r\n };\r\n}\r\n\r\nasync function handleFormGrid(app: any) {\r\n await useFormAsync();\r\n await useGridAsync();\r\n\r\n app.form = useForm;\r\n app.grid = useGrid;\r\n}\r\n"],"names":["module","sprintf","vsprintf"],"mappings":";AAAO,SAAS,aAAa,QAAyB,WAAW,GAAG,WAAW,KAAK,eAAe,KAAK;AACtG,WAAS,OAAO,MAAM;AAEtB,QAAM,MAAM,OAAO,QAAQ,WAAW,WAAW,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG;AACxE,QAAM,QAAQ,CAAA;AAEd,WAAS,IAAI,IAAI,CAAC,EAAE,QAAQ,IAAI,GAAG,KAAK,GAAG;AACzC,UAAM,QAAQ,IAAI,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,EACvD;AAEA,MAAI,CAAC,IAAI,MAAM,KAAK,eAAe,eAAe,GAAG;AAErD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AI,gBAAgB;AAExB,MAAI,IAAI,aAAa;AACrB,MAAI,IAAI,aAAa;AACrB,MAAI,IAAI,mBAAmB;AAC3B,MAAI,IAAI,gBAAgB;AAExB,MAAI,IAAI,OAAO;AACf,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,SAAS;AACjB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,kBAAkB;AAC1B,MAAI,IAAI,yBAAyB;AACjC,MAAI,IAAI,wBAAwB;AAChC,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,YAAY;AAAA,IAClB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,EAAA;AAEb;AAEA,eAAe,eAAe,KAAU;AACtC,QAAM,aAAA;AACN,QAAM,aAAA;AAEN,MAAI,OAAO;AACX,MAAI,OAAO;AACb;","x_google_ignoreList":[0]}
@@ -1341,7 +1341,7 @@ async function useFormValidation(selector) {
1341
1341
  function useFormValidationInstance(selector) {
1342
1342
  return getBoundedInstance(selector, "form.validation");
1343
1343
  }
1344
- function useFieldValidationSync(selector) {
1344
+ function useFieldValidationInstance(selector) {
1345
1345
  return getBoundedInstance(selector, "field.validation");
1346
1346
  }
1347
1347
  async function addGlobalValidator(name, validator, options = {}) {
@@ -2238,7 +2238,7 @@ export {
2238
2238
  useFormValidation as g,
2239
2239
  addGlobalValidator as h,
2240
2240
  isDebug as i,
2241
- useFieldValidationSync as j,
2241
+ useFieldValidationInstance as j,
2242
2242
  useFormValidationInstance as k,
2243
2243
  loadAlpine as l,
2244
2244
  useStack as m,