@iris-ui-kit/vue 0.2.23 → 0.2.24

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/index.js CHANGED
@@ -25,8 +25,8 @@ export { useAsyncResource, usePaginatedResource } from './chunk-SJB5DIIY.js';
25
25
  import { useDrag } from './chunk-3IH7IJ5S.js';
26
26
  export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable, useDrag } from './chunk-3IH7IJ5S.js';
27
27
  export { IrisSortable, SORTABLE_ITEM_ATTR } from './chunk-W3B6E5GN.js';
28
- export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-7IOJADZC.js';
29
- export { IrisErrorBoundary } from './chunk-PPYNXNGZ.js';
28
+ export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-DNRQVM3Q.js';
29
+ export { IrisErrorBoundary } from './chunk-FSDQHBI2.js';
30
30
  export { FormInjectionKey, IrisForm, useField, useFieldArray, useForm, useFormContext } from './chunk-IAG64CHL.js';
31
31
  import { useStore } from './chunk-75GSYEJS.js';
32
32
  export { useStore, useStoreSelector } from './chunk-75GSYEJS.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iris-ui-kit/vue",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "description": "Vue 3.5 adapter for Iris UI — full component set",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/data/useDataSource.ts","../src/data/useGroupedView.ts"],"names":[],"mappings":";;;;;AA8BO,SAAS,cAAiB,MAAA,EAA+C;AAC9E,EAAA,MAAM,aAAa,gBAAA,CAAiB,EAAE,GAAG,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AACnE,EAAA,MAAM,SAAA,GAAY,OAAO,SAAA,KAAc,KAAA;AAEvC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAK;AAAA,EACtC,CAAC,CAAA;AAGD,EAAA,cAAA,CAAe,MAAM,UAAA,CAAW,OAAA,EAAS,CAAA;AAEzC,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,UAAA,CAAW,KAAK,CAAA;AACvC,EAAA,OAAO,EAAE,GAAG,UAAA,EAAY,KAAA,EAAM;AAChC;ACfO,SAAS,eACd,MAAA,EACwB;AACxB,EAAA,MAAM,UAAA,GAAa,kBAA0B,MAAM,CAAA;AACnD,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,UAAA,CAAW,KAAK,CAAA;AAC1C,EAAA,MAAM,KAAA,GAAQ,SAAS,MAAM;AAC3B,IAAA,MAAM,IAAI,QAAA,CAAS,KAAA;AACnB,IAAA,OAAO,CAAA,CAAE,KAAA;AAAA,EACX,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,OAAO,UAAA,CAAW,KAAA;AAAA,IAClB,SAAS,CAAC,IAAA,EAAM,YAAY,UAAA,CAAW,OAAA,CAAQ,MAAM,OAAO,CAAA;AAAA,IAC5D,WAAA,EAAa,CAAC,GAAA,KAAQ,UAAA,CAAW,YAAY,GAAG,CAAA;AAAA,IAChD,WAAA,EAAa,CAAC,GAAA,KAAQ,UAAA,CAAW,YAAY,GAAG,CAAA;AAAA,IAChD,aAAA,EAAe,CAAC,GAAA,KAAQ,UAAA,CAAW,cAAc,GAAG,CAAA;AAAA,IACpD,SAAA,EAAW,MAAM,UAAA,CAAW,SAAA,EAAU;AAAA,IACtC,WAAA,EAAa,MAAM,UAAA,CAAW,WAAA,EAAY;AAAA,IAC1C,KAAA;AAAA,IACA,SAAA,EAAW,CAAC,OAAA,KAAY,UAAA,CAAW,UAAU,OAAO;AAAA,GACtD;AACF","file":"chunk-7IOJADZC.js","sourcesContent":["import { onMounted, onScopeDispose, type ShallowRef } from 'vue'\nimport {\n createDataSource,\n type DataSourceController,\n type DataSourceConfig,\n type DataSourceState,\n} from '@iris-ui-kit/core'\nimport { useStore } from '../useStore'\n\nexport interface UseDataSource<T> extends DataSourceController<T> {\n /**\n * The live data-source state as a reactive ref: rows, total, page/pageSize,\n * sort/multiSort, filters/filterRules, loading/loadingMore, hasMore,\n * selectedKeys, and the per-row pendingRows/rowErrors.\n */\n state: ShallowRef<DataSourceState<T>>\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createDataSource} — the unified\n * data engine (paged/infinite + multi-sort + typed filters + selection +\n * per-row + optimistic mutate). Creates the controller once in `setup()`,\n * mirrors its store into a reactive ref, and returns the controller plus its\n * live `state`. A thin bridge — all logic lives in `@iris-ui-kit/core`.\n *\n * Constructed with `immediate: false` so no fetch fires during `setup()`; the\n * initial load is kicked from `onMounted` and the controller is torn down on\n * scope dispose (aborting any in-flight request) so a late response never\n * writes back to a torn-down instance.\n */\nexport function useDataSource<T>(config: DataSourceConfig<T>): UseDataSource<T> {\n const controller = createDataSource({ ...config, immediate: false })\n const immediate = config.immediate !== false\n\n onMounted(() => {\n if (immediate) void controller.load()\n })\n // Abort any in-flight fetch + detach the controller's internal subscriptions\n // on unmount (a late response must not write back to a torn-down instance).\n onScopeDispose(() => controller.destroy())\n\n const state = useStore(controller.store)\n return { ...controller, state }\n}\n","import { computed, type ComputedRef } from 'vue'\nimport {\n createGroupedView,\n type GroupedViewConfig,\n type GroupedViewState,\n type GroupedViewStore,\n} from '@iris-ui-kit/core'\nimport type { DataViewColumn } from '@iris-ui-kit/core'\nimport { useStore } from '../useStore'\n\nexport interface UseGroupedView<Row, K = string> {\n store: ReturnType<typeof createGroupedView<Row, K>>['store']\n setRows: (rows: readonly Row[], columns?: readonly DataViewColumn<Row>[]) => void\n toggleGroup: (key: K) => void\n expandGroup: (key: K) => void\n collapseGroup: (key: K) => void\n expandAll: () => void\n collapseAll: () => void\n /** Reactive live grouped-view state. */\n state: ComputedRef<GroupedViewState<Row, K>>\n setConfig: (partial: Partial<GroupedViewConfig<Row, K>>) => void\n}\n\n/**\n * Vue bridge over the framework-agnostic {@link createGroupedView}.\n * Creates the controller once, subscribes its store to a reactive ref,\n * and returns the controller plus a computed `state`.\n */\nexport function useGroupedView<Row, K = string>(\n config: GroupedViewConfig<Row, K>,\n): UseGroupedView<Row, K> {\n const controller = createGroupedView<Row, K>(config)\n const storeRef = useStore(controller.store)\n const state = computed(() => {\n const s = storeRef.value as GroupedViewStore<Row, K>\n return s.state\n })\n\n return {\n store: controller.store,\n setRows: (rows, columns) => controller.setRows(rows, columns),\n toggleGroup: (key) => controller.toggleGroup(key),\n expandGroup: (key) => controller.expandGroup(key),\n collapseGroup: (key) => controller.collapseGroup(key),\n expandAll: () => controller.expandAll(),\n collapseAll: () => controller.collapseAll(),\n state,\n setConfig: (partial) => controller.setConfig(partial),\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/error-boundary/IrisErrorBoundary.ts"],"names":[],"mappings":";;;AAkCO,IAAM,oBAAoB,eAAA,CAAgB;AAAA,EAC/C,IAAA,EAAM,mBAAA;AAAA,EACN,YAAA,EAAc,KAAA;AAAA,EACd,KAAA,EAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS;AAAA,KACX;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS;AAAA;AACX,GACF;AAAA,EACA,KAAA,CAAM,KAAA,EAAO,EAAE,KAAA,EAAO,OAAM,EAAG;AAC7B,IAAA,MAAM,EAAE,CAAA,EAAE,GAAI,OAAA,EAAQ;AACtB,IAAA,MAAM,KAAA,GAAQ,IAAa,IAAI,CAAA;AAE/B,IAAA,MAAM,QAAQ,MAAM;AAClB,MAAA,KAAA,CAAM,KAAA,GAAQ,IAAA;AAAA,IAChB,CAAA;AAEA,IAAA,eAAA,CAAgB,CAAC,GAAA,EAAK,SAAA,EAAW,IAAA,KAAS;AACxC,MAAA,KAAA,CAAM,KAAA,GAA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sB;AAAA,MAC/B;AACA,MAAA,OAAO,MAAM,OAAA,IAAU;AAAA,IACzB,CAAA;AAAA,EACF;AACF,CAAC","file":"chunk-PPYNXNGZ.js","sourcesContent":["import { defineComponent, h, onErrorCaptured, ref, type PropType, type VNode } from 'vue'\nimport { useI18n } from '../i18n'\n\n/** Render-customization payload handed to the `#fallback` slot / `fallback` prop. */\nexport interface IrisErrorBoundaryFallbackProps {\n /** The error caught while rendering the guarded subtree. */\n error: unknown\n /** Clears the error and re-attempts rendering the children. */\n reset: () => void\n}\n\n/** Public prop surface of {@link IrisErrorBoundary}. */\nexport interface IrisErrorBoundaryProps {\n /**\n * Custom fallback renderer. Receives `{ error, reset }` and returns the\n * fallback UI. A `#fallback` scoped slot takes precedence when both are given.\n * When neither is supplied the themed DEFAULT fallback renders.\n */\n fallback?: (props: IrisErrorBoundaryFallbackProps) => VNode | VNode[] | string\n /** Invoked with the caught error (and Vue's error-info string) for logging. */\n onError?: (error: unknown, info?: string) => void\n}\n\n/**\n * IrisErrorBoundary: catches errors thrown while rendering its guarded subtree\n * (default slot), switches to a fallback, and exposes `reset()` to clear the\n * error and re-attempt rendering. Catching does NOT rethrow — a single broken\n * subtree no longer crashes the whole tree.\n *\n * Customize via a `#fallback` scoped slot or the `fallback` prop, each receiving\n * `{ error, reset }`. Without either, a themed, accessible (`role=\"alert\"`)\n * default fallback shows the error message + a retry button, i18n'd through\n * `useI18n()` (English defaults without a provider).\n */\nexport const IrisErrorBoundary = defineComponent({\n name: 'IrisErrorBoundary',\n inheritAttrs: false,\n props: {\n fallback: {\n type: Function as PropType<IrisErrorBoundaryProps['fallback']>,\n default: undefined,\n },\n onError: {\n type: Function as PropType<IrisErrorBoundaryProps['onError']>,\n default: undefined,\n },\n },\n setup(props, { attrs, slots }) {\n const { t } = useI18n()\n const error = ref<unknown>(null)\n\n const reset = () => {\n error.value = null\n }\n\n onErrorCaptured((err, _instance, info) => {\n error.value = err\n props.onError?.(err, info)\n // Stop further propagation so the error does not crash the parent tree.\n return false\n })\n\n const renderDefaultFallback = (): VNode => {\n const message =\n error.value instanceof Error && error.value.message\n ? error.value.message\n : t('errorBoundary.message')\n\n return h(\n 'div',\n {\n ...attrs,\n 'data-iris-error-boundary': '',\n role: 'alert',\n style: {\n padding: '16px',\n border: '1px solid var(--iris-danger)',\n borderRadius: 'var(--iris-radius-md, 6px)',\n color: 'var(--iris-danger)',\n ...((attrs.style as Record<string, string> | undefined) ?? {}),\n },\n },\n [\n h('div', { 'data-iris-error-boundary-message': '' }, message),\n h(\n 'button',\n {\n type: 'button',\n 'data-iris-error-boundary-retry': '',\n onClick: reset,\n },\n t('errorBoundary.retry'),\n ),\n ],\n )\n }\n\n return () => {\n if (error.value !== null) {\n const custom = slots.fallback ?? props.fallback\n if (custom) {\n return custom({ error: error.value, reset })\n }\n return renderDefaultFallback()\n }\n return slots.default?.()\n }\n },\n})\n"]}