sibujs 1.0.7 → 1.0.8

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/extras.d.ts CHANGED
@@ -3,7 +3,7 @@ export { battery, clipboard, colorScheme, draggable, dropZone, formatCurrency, f
3
3
  export { GlobalStore, MachineConfig, MachineReturn, Middleware, OptimisticAction, PersistOptions, Selector, TimeTravelReturn, createEffect, createMemo, createSignal, globalStore, machine, optimistic, optimisticList, persisted, timeline } from './patterns.js';
4
4
  export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as composable, d as compose, e as createGuard, f as createSlots, g as defineComponent, h as defineSlottedComponent, i as defineStrictComponent, v as validateProps, j as validators, w as withBoundary, k as withDefaults, l as withProps, m as withWrapper } from './contracts-DOrhwbke.js';
5
5
  export { AnimationPreset, PresetOptions, SlideDirection, SpringOptions, TransitionGroup, TransitionGroupOptions, TransitionOptions, animate, bounceIn, bounceOut, fadeIn, fadeOut, flipIn, pulse, reducedMotion, scaleDown, scaleUp, sequence, shake, slideIn, slideOut, spring, springSignal, stagger, transition, viewTransition } from './motion.js';
6
- export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-yz8uyk-0.js';
6
+ export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-D2DJp_xn.js';
7
7
  export { ChunkConfig, DOMPool, Features, NormalizeResult, NormalizedEntities, NormalizedSchema, NormalizedState, NormalizedStoreActions, Priority, PriorityLevel, block, cloneTemplate, conditional, createChunkRegistry, deferredValue, denormalize, devOnly, domPool, flushScheduler, hoistable, lazyChunk, noSideEffect, normalize, normalizedStore, pendingTasks, precompile, prefetch, preloadImage, preloadModule, preloadModules, preloadResource, processInChunks, pure, resetIdCounter, scheduleUpdate, setIdPrefix, startTransition, staticTemplate, transitionState, uniqueId, yieldToMain } from './performance.js';
8
8
  export { ActionFn, ActionResult, Head, ISROptions, MicroApp, MicroAppConfig, MiddlewareFn, SSGOptions, SSGResult, ScrollRestorationOptions, ServiceWorkerState, SharedScope, UseWorkerFnReturn, UseWorkerReturn, WasmConfig, WasmModuleState, WorkerPool, clearWasmCache, composeMiddleware, createAction, createISR, createMicroApp, createMiddlewareChain, createSharedScope, createWasmBridge, createWorkerPool, defineRemoteComponent, generateStaticSite, isWasmCached, loadRemoteModule, loadWasmModule, preloadWasm, scrollRestoration, serviceWorker, setCanonical, setStructuredData, wasm, worker, workerFn } from './ssr.js';
9
9
  export { T as TrustedHTML, c as collectStream, d as deserializeState, h as hydrate, a as hydrateIslands, b as hydrateProgressively, i as island, r as renderToDocument, e as renderToReadableStream, f as renderToStream, g as renderToString, j as renderToSuspenseStream, k as resetSSRState, s as serializeState, l as ssrSuspense, m as suspenseSwapScript, t as trustHTML } from './ssr-BA6sxxUd.js';
package/dist/extras.js CHANGED
@@ -130,7 +130,7 @@ import {
130
130
  toast,
131
131
  withScopedStyle,
132
132
  zipMask
133
- } from "./chunk-DKOHBI74.js";
133
+ } from "./chunk-6LSNVCS2.js";
134
134
  import {
135
135
  RenderProp,
136
136
  assertType,
package/dist/index.cjs CHANGED
@@ -1422,6 +1422,7 @@ function each(getArray, render, options) {
1422
1422
  const oldKeyIndex = /* @__PURE__ */ new Map();
1423
1423
  let reusedNewBuf = [];
1424
1424
  let reusedOldBuf = [];
1425
+ const keyIndexMap = /* @__PURE__ */ new Map();
1425
1426
  let initialized = false;
1426
1427
  let sentinelInserted = false;
1427
1428
  const keyFn = options.key;
@@ -1445,6 +1446,10 @@ function each(getArray, render, options) {
1445
1446
  newNodes = new Array(newLen);
1446
1447
  }
1447
1448
  workMap.clear();
1449
+ keyIndexMap.clear();
1450
+ for (let i2 = 0; i2 < newLen; i2++) {
1451
+ keyIndexMap.set(newKeys[i2], i2);
1452
+ }
1448
1453
  for (let i2 = 0; i2 < newLen; i2++) {
1449
1454
  const key = newKeys[i2];
1450
1455
  const existing = nodeMap.get(key);
@@ -1452,8 +1457,11 @@ function each(getArray, render, options) {
1452
1457
  if (existing !== void 0) {
1453
1458
  node = existing;
1454
1459
  } else {
1460
+ const itemKey = key;
1461
+ const itemGetter = () => getArray()[keyIndexMap.get(itemKey)];
1462
+ const indexGetter = () => keyIndexMap.get(itemKey);
1455
1463
  try {
1456
- node = resolveNodeChild(render(arr[i2], i2));
1464
+ node = resolveNodeChild(render(itemGetter, indexGetter));
1457
1465
  } catch (err) {
1458
1466
  if (_isDev6) {
1459
1467
  devWarn(
package/dist/index.d.cts CHANGED
@@ -172,12 +172,17 @@ declare function mount(component: (() => Element) | Element | Node, container: E
172
172
  * 4. Walk the new key list in reverse and insert/position each node,
173
173
  * skipping DOM operations for nodes that are part of the LIS.
174
174
  *
175
+ * The render callback receives reactive getters `() => T` and `() => number`
176
+ * instead of plain values. This ensures the callback always reads fresh data
177
+ * when a keyed item's data changes but its key stays the same, since the DOM
178
+ * is reused without re-calling render.
179
+ *
175
180
  * @param getArray A reactive getter returning an array.
176
- * @param render A function that returns a NodeChild for each item.
181
+ * @param render A function that receives reactive item and index getters and returns a NodeChild.
177
182
  * @param options A key function for unique identity of items.
178
183
  * @returns A Comment node serving as the anchor for the list.
179
184
  */
180
- declare function each<T>(getArray: () => T[], render: (item: T, index: number) => NodeChild, options: {
185
+ declare function each<T>(getArray: () => T[], render: (item: () => T, index: () => number) => NodeChild, options: {
181
186
  key: (item: T) => string | number;
182
187
  }): Comment;
183
188
 
package/dist/index.d.ts CHANGED
@@ -172,12 +172,17 @@ declare function mount(component: (() => Element) | Element | Node, container: E
172
172
  * 4. Walk the new key list in reverse and insert/position each node,
173
173
  * skipping DOM operations for nodes that are part of the LIS.
174
174
  *
175
+ * The render callback receives reactive getters `() => T` and `() => number`
176
+ * instead of plain values. This ensures the callback always reads fresh data
177
+ * when a keyed item's data changes but its key stays the same, since the DOM
178
+ * is reused without re-calling render.
179
+ *
175
180
  * @param getArray A reactive getter returning an array.
176
- * @param render A function that returns a NodeChild for each item.
181
+ * @param render A function that receives reactive item and index getters and returns a NodeChild.
177
182
  * @param options A key function for unique identity of items.
178
183
  * @returns A Comment node serving as the anchor for the list.
179
184
  */
180
- declare function each<T>(getArray: () => T[], render: (item: T, index: number) => NodeChild, options: {
185
+ declare function each<T>(getArray: () => T[], render: (item: () => T, index: () => number) => NodeChild, options: {
181
186
  key: (item: T) => string | number;
182
187
  }): Comment;
183
188
 
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  unregisterComponent,
39
39
  when,
40
40
  writable
41
- } from "./chunk-VAU366PN.js";
41
+ } from "./chunk-MQ5GOYPH.js";
42
42
  import {
43
43
  a,
44
44
  abbr,
package/dist/ui.cjs CHANGED
@@ -855,18 +855,31 @@ function FocusTrap(nodes, options = {}) {
855
855
  }
856
856
  return container;
857
857
  }
858
- function hotkey(key, handler, options = {}) {
858
+ function hotkey(combo, handler, options = {}) {
859
+ let key = combo;
860
+ let needCtrl = options.ctrl ?? false;
861
+ let needShift = options.shift ?? false;
862
+ let needAlt = options.alt ?? false;
863
+ let needMeta = options.meta ?? false;
864
+ if (combo.includes("+")) {
865
+ const parts = combo.toLowerCase().split("+");
866
+ key = parts[parts.length - 1];
867
+ for (let i = 0; i < parts.length - 1; i++) {
868
+ const mod = parts[i];
869
+ if (mod === "ctrl" || mod === "control") needCtrl = true;
870
+ else if (mod === "shift") needShift = true;
871
+ else if (mod === "alt") needAlt = true;
872
+ else if (mod === "meta" || mod === "cmd" || mod === "command") needMeta = true;
873
+ }
874
+ }
859
875
  const listener = (e) => {
860
876
  const ke = e;
861
877
  if (ke.key.toLowerCase() !== key.toLowerCase()) return;
862
- if (options.ctrl && !ke.ctrlKey) return;
863
- if (!options.ctrl && ke.ctrlKey) return;
864
- if (options.shift && !ke.shiftKey) return;
865
- if (!options.shift && ke.shiftKey) return;
866
- if (options.alt && !ke.altKey) return;
867
- if (!options.alt && ke.altKey) return;
868
- if (options.meta && !ke.metaKey) return;
869
- if (!options.meta && ke.metaKey) return;
878
+ if (needCtrl !== ke.ctrlKey) return;
879
+ if (needShift !== ke.shiftKey) return;
880
+ if (needAlt !== ke.altKey) return;
881
+ if (needMeta !== ke.metaKey) return;
882
+ if (options.preventDefault) ke.preventDefault();
870
883
  handler(ke);
871
884
  };
872
885
  document.addEventListener("keydown", listener);
package/dist/ui.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-yz8uyk-0.cjs';
1
+ export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-D2DJp_xn.cjs';
2
2
  export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as composable, d as compose, e as createGuard, f as createSlots, g as defineComponent, h as defineSlottedComponent, i as defineStrictComponent, v as validateProps, j as validators, w as withBoundary, k as withDefaults, l as withProps, m as withWrapper } from './contracts-DOrhwbke.cjs';
3
3
 
4
4
  /**
package/dist/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-yz8uyk-0.js';
1
+ export { B as BoundFieldProps, C as CustomElementOptions, F as FieldConfig, a as FocusTrap, b as FormConfig, c as FormField, d as FormReturn, I as IntersectionResult, M as MaskOptions, T as Toast, e as ToastInstance, V as ValidatorFn, f as VirtualList, g as VirtualListProps, h as announce, i as aria, j as bindAttrs, k as bindBoolAttr, l as bindData, m as bindField, n as creditCardMask, o as custom, p as dateMask, q as defineElement, r as dialog, s as email, t as eventBus, u as focus, v as form, w as hotkey, x as infiniteScroll, y as inputMask, z as intersection, A as lazyLoad, D as matchesPattern, E as max, G as maxLength, H as min, J as minLength, K as pagination, L as phoneMask, N as removeScopedStyle, O as required, P as scopedStyle, Q as ssnMask, R as svgElement, S as timeMask, U as toast, W as withScopedStyle, X as zipMask } from './customElement-D2DJp_xn.js';
2
2
  export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as composable, d as compose, e as createGuard, f as createSlots, g as defineComponent, h as defineSlottedComponent, i as defineStrictComponent, v as validateProps, j as validators, w as withBoundary, k as withDefaults, l as withProps, m as withWrapper } from './contracts-DOrhwbke.js';
3
3
 
4
4
  /**
package/dist/ui.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  toast,
38
38
  withScopedStyle,
39
39
  zipMask
40
- } from "./chunk-DKOHBI74.js";
40
+ } from "./chunk-6LSNVCS2.js";
41
41
  import {
42
42
  RenderProp,
43
43
  assertType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sibujs",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A lightweight, function-based frontend framework that combines the best of React, Svelte, and Vue — with zero VDOM and maximum simplicity. Designed for developers who want fine-grained reactivity and full control without compilation or magic.",
5
5
  "keywords": [
6
6
  "frontend",