@signality/core 0.1.2 → 0.2.0
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/browser/device-pixel-ratio/index.d.ts +30 -0
- package/browser/file-dialog/index.d.ts +1 -2
- package/browser/index.d.ts +1 -0
- package/browser/listener/index.d.ts +1 -0
- package/browser/picture-in-picture/index.d.ts +1 -5
- package/browser/text-selection/index.d.ts +9 -2
- package/browser/web-notification/index.d.ts +3 -3
- package/fesm2022/signality-core-browser-clipboard.mjs +13 -30
- package/fesm2022/signality-core-browser-clipboard.mjs.map +1 -1
- package/fesm2022/signality-core-browser-device-pixel-ratio.mjs +45 -0
- package/fesm2022/signality-core-browser-device-pixel-ratio.mjs.map +1 -0
- package/fesm2022/signality-core-browser-eye-dropper.mjs +2 -3
- package/fesm2022/signality-core-browser-eye-dropper.mjs.map +1 -1
- package/fesm2022/signality-core-browser-file-dialog.mjs +2 -1
- package/fesm2022/signality-core-browser-file-dialog.mjs.map +1 -1
- package/fesm2022/signality-core-browser-fullscreen.mjs +8 -19
- package/fesm2022/signality-core-browser-fullscreen.mjs.map +1 -1
- package/fesm2022/signality-core-browser-gamepad.mjs +2 -10
- package/fesm2022/signality-core-browser-gamepad.mjs.map +1 -1
- package/fesm2022/signality-core-browser-listener.mjs +2 -1
- package/fesm2022/signality-core-browser-listener.mjs.map +1 -1
- package/fesm2022/signality-core-browser-media-query.mjs +2 -1
- package/fesm2022/signality-core-browser-media-query.mjs.map +1 -1
- package/fesm2022/signality-core-browser-picture-in-picture.mjs +10 -13
- package/fesm2022/signality-core-browser-picture-in-picture.mjs.map +1 -1
- package/fesm2022/signality-core-browser-speech-recognition.mjs +2 -1
- package/fesm2022/signality-core-browser-speech-recognition.mjs.map +1 -1
- package/fesm2022/signality-core-browser-speech-synthesis.mjs +2 -1
- package/fesm2022/signality-core-browser-speech-synthesis.mjs.map +1 -1
- package/fesm2022/signality-core-browser-storage.mjs +38 -68
- package/fesm2022/signality-core-browser-storage.mjs.map +1 -1
- package/fesm2022/signality-core-browser-text-direction.mjs +2 -1
- package/fesm2022/signality-core-browser-text-direction.mjs.map +1 -1
- package/fesm2022/signality-core-browser-text-selection.mjs +36 -4
- package/fesm2022/signality-core-browser-text-selection.mjs.map +1 -1
- package/fesm2022/signality-core-browser-vibration.mjs +16 -30
- package/fesm2022/signality-core-browser-vibration.mjs.map +1 -1
- package/fesm2022/signality-core-browser-web-notification.mjs +33 -53
- package/fesm2022/signality-core-browser-web-notification.mjs.map +1 -1
- package/fesm2022/signality-core-browser-web-share.mjs +3 -11
- package/fesm2022/signality-core-browser-web-share.mjs.map +1 -1
- package/fesm2022/signality-core-browser-web-worker.mjs +2 -1
- package/fesm2022/signality-core-browser-web-worker.mjs.map +1 -1
- package/fesm2022/signality-core-browser.mjs +1 -0
- package/fesm2022/signality-core-browser.mjs.map +1 -1
- package/fesm2022/signality-core-elements-dropzone.mjs +2 -1
- package/fesm2022/signality-core-elements-dropzone.mjs.map +1 -1
- package/fesm2022/signality-core-elements-element-focus-within.mjs +2 -1
- package/fesm2022/signality-core-elements-element-focus-within.mjs.map +1 -1
- package/fesm2022/signality-core-elements-element-focus.mjs +2 -1
- package/fesm2022/signality-core-elements-element-focus.mjs.map +1 -1
- package/fesm2022/signality-core-elements-element-size.mjs +2 -1
- package/fesm2022/signality-core-elements-element-size.mjs.map +1 -1
- package/fesm2022/signality-core-elements-on-click-outside.mjs +2 -1
- package/fesm2022/signality-core-elements-on-click-outside.mjs.map +1 -1
- package/fesm2022/signality-core-elements-on-disconnect.mjs +2 -1
- package/fesm2022/signality-core-elements-on-disconnect.mjs.map +1 -1
- package/fesm2022/signality-core-elements-on-long-press.mjs +2 -1
- package/fesm2022/signality-core-elements-on-long-press.mjs.map +1 -1
- package/fesm2022/signality-core-elements-scroll-position.mjs +2 -1
- package/fesm2022/signality-core-elements-scroll-position.mjs.map +1 -1
- package/fesm2022/signality-core-forms-cva.mjs +13 -3
- package/fesm2022/signality-core-forms-cva.mjs.map +1 -1
- package/fesm2022/signality-core-internal.mjs +35 -27
- package/fesm2022/signality-core-internal.mjs.map +1 -1
- package/fesm2022/signality-core-observers-intersection-observer.mjs +2 -1
- package/fesm2022/signality-core-observers-intersection-observer.mjs.map +1 -1
- package/fesm2022/signality-core-observers-mutation-observer.mjs +2 -1
- package/fesm2022/signality-core-observers-mutation-observer.mjs.map +1 -1
- package/fesm2022/signality-core-observers-resize-observer.mjs +2 -1
- package/fesm2022/signality-core-observers-resize-observer.mjs.map +1 -1
- package/fesm2022/signality-core-reactivity-debounced.mjs +2 -1
- package/fesm2022/signality-core-reactivity-debounced.mjs.map +1 -1
- package/fesm2022/signality-core-reactivity-throttled.mjs +2 -1
- package/fesm2022/signality-core-reactivity-throttled.mjs.map +1 -1
- package/fesm2022/signality-core-scheduling-debounce-callback.mjs +2 -1
- package/fesm2022/signality-core-scheduling-debounce-callback.mjs.map +1 -1
- package/fesm2022/signality-core-scheduling-interval.mjs +2 -1
- package/fesm2022/signality-core-scheduling-interval.mjs.map +1 -1
- package/fesm2022/signality-core-scheduling-throttle-callback.mjs +2 -1
- package/fesm2022/signality-core-scheduling-throttle-callback.mjs.map +1 -1
- package/fesm2022/signality-core-utilities.mjs +64 -0
- package/fesm2022/signality-core-utilities.mjs.map +1 -0
- package/fesm2022/signality-core.mjs +1 -0
- package/fesm2022/signality-core.mjs.map +1 -1
- package/forms/cva/index.d.ts +10 -5
- package/index.d.ts +1 -0
- package/internal/utils/index.d.ts +1 -2
- package/internal/utils/wait-for-value.d.ts +6 -0
- package/package.json +13 -5
- package/utilities/generate-id.d.ts +29 -0
- package/utilities/index.d.ts +3 -0
- /package/{internal/utils → utilities}/to-element.d.ts +0 -0
- /package/{internal/utils → utilities}/to-value.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-observers-intersection-observer.mjs","sources":["../../../projects/core/observers/intersection-observer/index.ts","../../../projects/core/observers/intersection-observer/signality-core-observers-intersection-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport {
|
|
1
|
+
{"version":3,"file":"signality-core-observers-intersection-observer.mjs","sources":["../../../projects/core/observers/intersection-observer/index.ts","../../../projects/core/observers/intersection-observer/signality-core-observers-intersection-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport { assertElement, NOOP_EFFECT_REF, setupContext } from '@signality/core/internal';\nimport { toElement, toValue } from '@signality/core/utilities';\nimport type { MaybeElementSignal, MaybeSignal } from '@signality/core/types';\n\nexport interface IntersectionObserverInitOptions\n extends Omit<CreateEffectOptions, 'allowSignalWrites'> {\n /**\n * Scrollable ancestor used as the intersection viewport.\n * `null` or `undefined` defaults to the browser viewport.\n *\n * @see [IntersectionObserver: root on MDN](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/root)\n */\n readonly root?: MaybeElementSignal<Element> | Document | null;\n\n /**\n * CSS margin applied around the root before computing intersections.\n * Accepts values in the same format as the CSS `margin` property (e.g. `'10px 0px'`).\n *\n * @see [IntersectionObserver: rootMargin on MDN](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin)\n */\n readonly rootMargin?: MaybeSignal<string>;\n\n /**\n * Fraction(s) of the target element that must be visible to trigger the callback.\n * A single number or an array of thresholds, each between `0` and `1`.\n *\n * @see [IntersectionObserver: thresholds on MDN](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds)\n */\n readonly threshold?: MaybeSignal<number | number[]>;\n}\n\nexport interface IntersectionObserverRef {\n /**\n * Stop observing all targets and disconnect the underlying `IntersectionObserver`.\n */\n readonly destroy: () => void;\n}\n\n/**\n * Low-level utility for observing element intersection with viewport using the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).\n * Provides fine-grained control over the observation lifecycle.\n *\n * @param target - Element(s) to observe\n * @param callback - Callback function called when intersection changes\n * @param options - Optional configuration (see {@link IntersectionObserverInitOptions})\n * @returns An IntersectionObserverRef with a `destroy()` method to stop observing the element(s)\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div #section>Section content</div>\n * @if (isVisible()) {\n * <p>Section is visible!</p>\n * }\n * `\n * })\n * export class IntersectionDemo {\n * readonly section = viewChild<ElementRef>('section');\n * readonly isVisible = signal(false);\n *\n * constructor() {\n * intersectionObserver(this.section, entries => {\n * this.isVisible.set(entries[0].isIntersecting);\n * }, { threshold: 0.5 });\n * }\n * }\n * ```\n */\nexport function intersectionObserver(\n target: MaybeElementSignal<Element> | MaybeElementSignal<Element>[],\n callback: (entries: readonly IntersectionObserverEntry[], observer: IntersectionObserver) => void,\n options?: IntersectionObserverInitOptions\n): IntersectionObserverRef {\n const { runInContext } = setupContext(options?.injector, intersectionObserver);\n\n return runInContext(({ isServer }) => {\n if (isServer) {\n return NOOP_EFFECT_REF;\n }\n\n const targets = Array.isArray(target) ? target : [target];\n\n const setupObserver = (onCleanup: EffectCleanupRegisterFn) => {\n const els = targets.map(toElement).filter(Boolean);\n\n if (!els.length) {\n return;\n }\n\n const root = options?.root\n ? options.root instanceof Document\n ? options.root\n : toElement(options.root)\n : null;\n const rootMargin = toValue(options?.rootMargin);\n const threshold = toValue(options?.threshold);\n\n const observer = new IntersectionObserver(callback, { root, rootMargin, threshold });\n\n for (const el of els) {\n ngDevMode && assertElement(el, 'intersectionObserver');\n observer.observe(el!);\n }\n\n onCleanup(observer.disconnect.bind(observer));\n };\n\n const effectRef = afterRenderEffect({ read: setupObserver }, options);\n\n return { destroy: () => effectRef.destroy() };\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;SACa,oBAAoB,CAClC,MAAmE,EACnE,QAAiG,EACjG,OAAyC,EAAA;AAEzC,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,oBAAoB,CAAC;AAE9E,IAAA,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAI;QACnC,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,eAAe;QACxB;AAEA,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;AAEzD,QAAA,MAAM,aAAa,GAAG,CAAC,SAAkC,KAAI;AAC3D,YAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAElD,YAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;gBACf;YACF;AAEA,YAAA,MAAM,IAAI,GAAG,OAAO,EAAE;AACpB,kBAAE,OAAO,CAAC,IAAI,YAAY;sBACtB,OAAO,CAAC;AACV,sBAAE,SAAS,CAAC,OAAO,CAAC,IAAI;kBACxB,IAAI;YACR,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;YAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;AAE7C,YAAA,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAEpF,YAAA,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;AACpB,gBAAA,SAAS,IAAI,aAAa,CAAC,EAAE,EAAE,sBAAsB,CAAC;AACtD,gBAAA,QAAQ,CAAC,OAAO,CAAC,EAAG,CAAC;YACvB;YAEA,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,QAAA,CAAC;AAED,QAAA,MAAM,SAAS,GAAG,iBAAiB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC;QAErE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC,OAAO,EAAE,EAAE;AAC/C,IAAA,CAAC,CAAC;AACJ;;ACrHA;;AAEG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { afterRenderEffect } from '@angular/core';
|
|
2
|
-
import { setupContext, NOOP_EFFECT_REF,
|
|
2
|
+
import { setupContext, NOOP_EFFECT_REF, assertElement } from '@signality/core/internal';
|
|
3
|
+
import { toElement, toValue } from '@signality/core/utilities';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Low-level utility for observing DOM tree changes using the [MutationObserver API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-observers-mutation-observer.mjs","sources":["../../../projects/core/observers/mutation-observer/index.ts","../../../projects/core/observers/mutation-observer/signality-core-observers-mutation-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport {
|
|
1
|
+
{"version":3,"file":"signality-core-observers-mutation-observer.mjs","sources":["../../../projects/core/observers/mutation-observer/index.ts","../../../projects/core/observers/mutation-observer/signality-core-observers-mutation-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport { assertElement, NOOP_EFFECT_REF, setupContext } from '@signality/core/internal';\nimport { toElement, toValue } from '@signality/core/utilities';\nimport type { MaybeElementSignal, MaybeSignal } from '@signality/core/types';\n\nexport interface MutationObserverInitOptions\n extends Omit<CreateEffectOptions, 'allowSignalWrites'> {\n /**\n * Whether to observe additions and removals of child nodes.\n *\n * @see [MutationObserver.observe(): childList on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#childlist)\n */\n readonly childList?: MaybeSignal<boolean>;\n\n /**\n * Whether to observe attribute changes on the target element.\n * Use `attributeFilter` to limit which attributes are observed.\n *\n * @see [MutationObserver.observe(): attributes on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#attributes)\n */\n readonly attributes?: MaybeSignal<boolean>;\n\n /**\n * Whether to observe changes to the text content (`CharacterData`) of the target.\n *\n * @see [MutationObserver.observe(): characterData on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#characterdata)\n */\n readonly characterData?: MaybeSignal<boolean>;\n\n /**\n * Whether to extend observation to the entire subtree of the target element.\n *\n * @see [MutationObserver.observe(): subtree on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#subtree)\n */\n readonly subtree?: MaybeSignal<boolean>;\n\n /**\n * Whether to record the previous attribute value in each `MutationRecord`.\n * Implicitly sets `attributes` to `true` if not already set.\n *\n * @see [MutationObserver.observe(): attributeOldValue on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#attributeoldvalue)\n */\n readonly attributeOldValue?: MaybeSignal<boolean>;\n\n /**\n * Whether to record the previous character data value in each `MutationRecord`.\n * Implicitly sets `characterData` to `true` if not already set.\n *\n * @see [MutationObserver.observe(): characterDataOldValue on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#characterdataoldvalue)\n */\n readonly characterDataOldValue?: MaybeSignal<boolean>;\n\n /**\n * Array of attribute local names to observe. Only mutations to listed attributes are reported.\n * Implicitly sets `attributes` to `true` if not already set.\n *\n * @see [MutationObserver.observe(): attributeFilter on MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#attributefilter)\n */\n readonly attributeFilter?: MaybeSignal<string[]>;\n}\n\nexport interface MutationObserverRef {\n /**\n * Stop observing all targets and disconnect the underlying `MutationObserver`.\n */\n readonly destroy: () => void;\n}\n\n/**\n * Low-level utility for observing DOM tree changes using the [MutationObserver API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver).\n * Provides fine-grained control over the observation lifecycle.\n *\n * @param target - Element(s) to observe\n * @param callback - Callback function called when DOM mutations occur\n * @param options - Optional configuration (see {@link MutationObserverInitOptions})\n * @returns MutationObserverRef with a `destroy()` method to stop observing the element(s)\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div #container>\n * <p>Children: {{ childCount() }}</p>\n * </div>\n * `\n * })\n * export class MutationComponent {\n * readonly container = viewChild<ElementRef>('container');\n * readonly childCount = signal(0);\n *\n * constructor() {\n * mutationObserver(this.container, mutations => {\n * this.childCount.set(mutations[0].target.childNodes.length);\n * }, { childList: true });\n * }\n * }\n * ```\n */\nexport function mutationObserver(\n target: MaybeElementSignal<Element> | MaybeElementSignal<Element>[],\n callback: (mutations: readonly MutationRecord[], observer: MutationObserver) => void,\n options: MutationObserverInitOptions\n): MutationObserverRef {\n const { runInContext } = setupContext(options.injector, mutationObserver);\n\n return runInContext(({ isServer }) => {\n if (isServer) {\n return NOOP_EFFECT_REF;\n }\n\n const targets = Array.isArray(target) ? target : [target];\n\n const setupObserver = (onCleanup: EffectCleanupRegisterFn) => {\n const els = targets.map(toElement).filter(Boolean);\n\n if (!els.length) {\n return;\n }\n\n const childList = toValue(options.childList);\n const attributes = toValue(options.attributes);\n const characterData = toValue(options.characterData);\n const subtree = toValue(options.subtree);\n const attributeOldValue = toValue(options.attributeOldValue);\n const characterDataOldValue = toValue(options.characterDataOldValue);\n const attributeFilter = toValue(options.attributeFilter);\n\n const observer = new MutationObserver(callback);\n\n for (const el of els) {\n ngDevMode && assertElement(el, 'mutationObserver');\n\n observer.observe(el!, {\n childList,\n attributes,\n characterData,\n subtree,\n attributeOldValue,\n characterDataOldValue,\n attributeFilter,\n });\n }\n\n onCleanup(observer.disconnect.bind(observer));\n };\n\n const effectRef = afterRenderEffect({ read: setupObserver }, options);\n\n return { destroy: () => effectRef.destroy() };\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAwEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;SACa,gBAAgB,CAC9B,MAAmE,EACnE,QAAoF,EACpF,OAAoC,EAAA;AAEpC,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC;AAEzE,IAAA,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAI;QACnC,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,eAAe;QACxB;AAEA,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;AAEzD,QAAA,MAAM,aAAa,GAAG,CAAC,SAAkC,KAAI;AAC3D,YAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAElD,YAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;gBACf;YACF;YAEA,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;YAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;YAC9C,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;YACpD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;YACxC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAC5D,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC;YACpE,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;AAExD,YAAA,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC;AAE/C,YAAA,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;AACpB,gBAAA,SAAS,IAAI,aAAa,CAAC,EAAE,EAAE,kBAAkB,CAAC;AAElD,gBAAA,QAAQ,CAAC,OAAO,CAAC,EAAG,EAAE;oBACpB,SAAS;oBACT,UAAU;oBACV,aAAa;oBACb,OAAO;oBACP,iBAAiB;oBACjB,qBAAqB;oBACrB,eAAe;AAChB,iBAAA,CAAC;YACJ;YAEA,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,QAAA,CAAC;AAED,QAAA,MAAM,SAAS,GAAG,iBAAiB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC;QAErE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC,OAAO,EAAE,EAAE;AAC/C,IAAA,CAAC,CAAC;AACJ;;AC1JA;;AAEG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { afterRenderEffect } from '@angular/core';
|
|
2
|
-
import { setupContext, NOOP_EFFECT_REF,
|
|
2
|
+
import { setupContext, NOOP_EFFECT_REF, assertElement } from '@signality/core/internal';
|
|
3
|
+
import { toElement, toValue } from '@signality/core/utilities';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Low-level utility for observing element size changes using the [ResizeObserver API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-observers-resize-observer.mjs","sources":["../../../projects/core/observers/resize-observer/index.ts","../../../projects/core/observers/resize-observer/signality-core-observers-resize-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport {
|
|
1
|
+
{"version":3,"file":"signality-core-observers-resize-observer.mjs","sources":["../../../projects/core/observers/resize-observer/index.ts","../../../projects/core/observers/resize-observer/signality-core-observers-resize-observer.ts"],"sourcesContent":["import {\n afterRenderEffect,\n type CreateEffectOptions,\n type EffectCleanupRegisterFn,\n} from '@angular/core';\nimport { assertElement, NOOP_EFFECT_REF, setupContext } from '@signality/core/internal';\nimport { toElement, toValue } from '@signality/core/utilities';\nimport type { MaybeElementSignal, MaybeSignal } from '@signality/core/types';\n\nexport interface ResizeObserverInitOptions extends Omit<CreateEffectOptions, 'allowSignalWrites'> {\n /**\n * Box model to measure when reporting size changes.\n *\n * - `'content-box'` — size of the content area, excluding padding and border (default).\n * - `'border-box'` — size including padding and border.\n * - `'device-pixel-content-box'` — content-box size in physical device pixels.\n *\n * @see [ResizeObserver.observe(): box on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe#box)\n */\n readonly box?: MaybeSignal<ResizeObserverBoxOptions>;\n}\n\nexport interface ResizeObserverRef {\n /**\n * Stop observing all targets and disconnect the underlying `ResizeObserver`.\n */\n readonly destroy: () => void;\n}\n\n/**\n * Low-level utility for observing element size changes using the [ResizeObserver API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\n * Provides fine-grained control over the observation lifecycle.\n *\n * @param target - Element(s) to observe\n * @param callback - Callback function called when element size changes\n * @param options - Optional configuration (see {@link ResizeObserverInitOptions})\n * @returns ResizeObserverRef with a `destroy()` method to stop observing the element(s)\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div #resizable>\n * Size: {{ size().width }} × {{ size().height }}px\n * </div>\n * `\n * })\n * export class ResizeComponent {\n * readonly resizable = viewChild<ElementRef>('resizable');\n * readonly size = signal({ width: 0, height: 0 });\n *\n * constructor() {\n * resizeObserver(this.resizable, entries => {\n * const { width, height } = entries[0].contentRect;\n * this.size.set({ width, height });\n * });\n * }\n * }\n * ```\n */\nexport function resizeObserver(\n target: MaybeElementSignal<Element> | MaybeElementSignal<Element>[],\n callback: (entries: readonly ResizeObserverEntry[]) => void,\n options?: ResizeObserverInitOptions\n): ResizeObserverRef {\n const { runInContext } = setupContext(options?.injector, resizeObserver);\n\n return runInContext(({ isServer, onCleanup }) => {\n if (isServer) {\n return NOOP_EFFECT_REF;\n }\n\n const targets = Array.isArray(target) ? target : [target];\n\n let observer: ResizeObserver | null = null;\n\n const setupObserver = (onCleanup: EffectCleanupRegisterFn) => {\n const els = targets.map(toElement).filter(Boolean);\n\n if (!els.length) {\n return;\n }\n\n const box = toValue(options?.box);\n\n observer ??= new ResizeObserver(callback);\n\n for (const el of els) {\n ngDevMode && assertElement(el, 'resizeObserver');\n observer.observe(el!, { box });\n }\n\n onCleanup(() => {\n els.forEach(el => observer?.unobserve(el!));\n });\n };\n\n const destroy = () => observer?.disconnect();\n\n onCleanup(destroy);\n\n afterRenderEffect({ read: setupObserver }, options);\n\n return { destroy };\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;SACa,cAAc,CAC5B,MAAmE,EACnE,QAA2D,EAC3D,OAAmC,EAAA;AAEnC,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,cAAc,CAAC;IAExE,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAI;QAC9C,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,eAAe;QACxB;AAEA,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;QAEzD,IAAI,QAAQ,GAA0B,IAAI;AAE1C,QAAA,MAAM,aAAa,GAAG,CAAC,SAAkC,KAAI;AAC3D,YAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAElD,YAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;gBACf;YACF;YAEA,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;AAEjC,YAAA,QAAQ,KAAK,IAAI,cAAc,CAAC,QAAQ,CAAC;AAEzC,YAAA,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;AACpB,gBAAA,SAAS,IAAI,aAAa,CAAC,EAAE,EAAE,gBAAgB,CAAC;gBAChD,QAAQ,CAAC,OAAO,CAAC,EAAG,EAAE,EAAE,GAAG,EAAE,CAAC;YAChC;YAEA,SAAS,CAAC,MAAK;AACb,gBAAA,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,QAAQ,EAAE,SAAS,CAAC,EAAG,CAAC,CAAC;AAC7C,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,EAAE,UAAU,EAAE;QAE5C,SAAS,CAAC,OAAO,CAAC;QAElB,iBAAiB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC;QAEnD,OAAO,EAAE,OAAO,EAAE;AACpB,IAAA,CAAC,CAAC;AACJ;;ACzGA;;AAEG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { signal, isSignal } from '@angular/core';
|
|
2
|
-
import { setupContext,
|
|
2
|
+
import { setupContext, proxySignal } from '@signality/core/internal';
|
|
3
|
+
import { toValue } from '@signality/core/utilities';
|
|
3
4
|
import { debounceCallback } from '@signality/core/scheduling/debounce-callback';
|
|
4
5
|
import { watcher } from '@signality/core/reactivity/watcher';
|
|
5
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-reactivity-debounced.mjs","sources":["../../../projects/core/reactivity/debounced/index.ts","../../../projects/core/reactivity/debounced/signality-core-reactivity-debounced.ts"],"sourcesContent":["import {\n type CreateSignalOptions,\n isSignal,\n signal,\n type Signal,\n type WritableSignal,\n} from '@angular/core';\nimport { proxySignal, setupContext
|
|
1
|
+
{"version":3,"file":"signality-core-reactivity-debounced.mjs","sources":["../../../projects/core/reactivity/debounced/index.ts","../../../projects/core/reactivity/debounced/signality-core-reactivity-debounced.ts"],"sourcesContent":["import {\n type CreateSignalOptions,\n isSignal,\n signal,\n type Signal,\n type WritableSignal,\n} from '@angular/core';\nimport { proxySignal, setupContext } from '@signality/core/internal';\nimport { toValue } from '@signality/core/utilities';\nimport type { MaybeSignal, SignalValue, WithInjector } from '@signality/core/types';\nimport { debounceCallback } from '@signality/core/scheduling/debounce-callback';\nimport { watcher } from '@signality/core/reactivity/watcher';\n\nexport type DebouncedOptions<T> = CreateSignalOptions<T> & WithInjector;\n\n/**\n * Creates a debounced readonly signal from a source signal.\n * Updates to the source signal are debounced before propagating to the returned signal.\n *\n * @param source - Source signal to debounce\n * @param timeMs - Debounce delay in milliseconds\n * @param options - Optional configuration including signal options and injector\n * @returns A readonly signal that updates after the debounce delay\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <input [(ngModel)]=\"query\" />\n * <p>Debounced value: {{ debouncedQuery() }}</p>\n * `\n * })\n * export class SearchInput {\n * readonly query = signal('');\n * readonly debouncedQuery = debounced(this.query, 300);\n * }\n * ```\n */\nexport function debounced<S extends Signal<any>>(\n source: S,\n timeMs: MaybeSignal<number>,\n options?: DebouncedOptions<SignalValue<S>>\n): Signal<SignalValue<S>>;\n\n/**\n * Creates a debounced writable signal from an initial value.\n * Both `set()` and `update()` calls are debounced.\n *\n * @param value - Initial value\n * @param timeMs - Debounce delay in milliseconds\n * @param options - Optional configuration including signal options and injector\n * @returns A writable signal where updates are debounced\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <input [(ngModel)]=\"query\" />\n * <p>Search results for: {{ query() }}</p>\n * `\n * })\n * export class SearchInput {\n * readonly query = debounced('', 300);\n * }\n * ```\n */\nexport function debounced<V>(\n value: V,\n timeMs: MaybeSignal<number>,\n options?: DebouncedOptions<V>\n): WritableSignal<V>;\n\nexport function debounced(\n valueOrSignal: any,\n timeMs: MaybeSignal<number>,\n options?: DebouncedOptions<any>\n) {\n const { runInContext } = setupContext(options?.injector, debounced);\n\n return runInContext(() => {\n const initialValue = toValue(valueOrSignal);\n const output = signal(initialValue, options);\n const set = debounceCallback(output.set, timeMs);\n\n if (isSignal(valueOrSignal)) {\n watcher(valueOrSignal, set);\n return output.asReadonly();\n } else {\n return proxySignal(output, { set });\n }\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;SAwEgB,SAAS,CACvB,aAAkB,EAClB,MAA2B,EAC3B,OAA+B,EAAA;AAE/B,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;IAEnE,OAAO,YAAY,CAAC,MAAK;AACvB,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC;QAC5C,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;AAEhD,QAAA,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE;AAC3B,YAAA,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;AAC3B,YAAA,OAAO,MAAM,CAAC,UAAU,EAAE;QAC5B;aAAO;YACL,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC;QACrC;AACF,IAAA,CAAC,CAAC;AACJ;;AC3FA;;AAEG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { signal, isSignal } from '@angular/core';
|
|
2
|
-
import { setupContext,
|
|
2
|
+
import { setupContext, proxySignal } from '@signality/core/internal';
|
|
3
|
+
import { toValue } from '@signality/core/utilities';
|
|
3
4
|
import { throttleCallback } from '@signality/core/scheduling/throttle-callback';
|
|
4
5
|
import { watcher } from '@signality/core/reactivity/watcher';
|
|
5
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-reactivity-throttled.mjs","sources":["../../../projects/core/reactivity/throttled/index.ts","../../../projects/core/reactivity/throttled/signality-core-reactivity-throttled.ts"],"sourcesContent":["import {\n type CreateSignalOptions,\n isSignal,\n signal,\n type Signal,\n type WritableSignal,\n} from '@angular/core';\nimport { proxySignal, setupContext
|
|
1
|
+
{"version":3,"file":"signality-core-reactivity-throttled.mjs","sources":["../../../projects/core/reactivity/throttled/index.ts","../../../projects/core/reactivity/throttled/signality-core-reactivity-throttled.ts"],"sourcesContent":["import {\n type CreateSignalOptions,\n isSignal,\n signal,\n type Signal,\n type WritableSignal,\n} from '@angular/core';\nimport { proxySignal, setupContext } from '@signality/core/internal';\nimport { toValue } from '@signality/core/utilities';\nimport type { MaybeSignal, SignalValue, WithInjector } from '@signality/core/types';\nimport { throttleCallback } from '@signality/core/scheduling/throttle-callback';\nimport { watcher } from '@signality/core/reactivity/watcher';\n\nexport type ThrottledOptions<T> = CreateSignalOptions<T> & WithInjector;\n\n/**\n * Creates a throttled readonly signal from a source signal.\n * Updates to the source signal are throttled to occur at most once per time interval.\n *\n * @param source - Source signal to throttle\n * @param timeMs - Throttle interval in milliseconds\n * @param options - Optional configuration including signal options and injector\n * @returns A readonly signal that updates at most once per throttle interval\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div (scroll)=\"scrollY.set($event.target.scrollTop)\">\n * <p>Scroll position: {{ scrollY() }}</p>\n * <p>Throttled position: {{ throttledScrollY() }}</p>\n * </div>\n * `\n * })\n * export class ScrollTracker {\n * readonly scrollY = signal(0);\n * readonly throttledScrollY = throttled(this.scrollY, 100);\n * }\n * ```\n */\nexport function throttled<S extends Signal<any>>(\n source: S,\n timeMs: MaybeSignal<number>,\n options?: ThrottledOptions<SignalValue<S>>\n): Signal<SignalValue<S>>;\n\n/**\n * Creates a throttled writable signal from an initial value.\n * Both `set()` and `update()` calls are throttled.\n *\n * @param value - Initial value\n * @param timeMs - Throttle interval in milliseconds\n * @param options - Optional configuration including signal options and injector\n * @returns A writable signal where updates are throttled\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div (mousemove)=\"mousePosition.set({ x: $event.clientX, y: $event.clientY })\">\n * <p>Mouse position: X={{ mousePosition().x }}, Y={{ mousePosition().y }}</p>\n * </div>\n * `\n * })\n * export class MouseTracker {\n * readonly mousePosition = throttled({ x: 0, y: 0 }, 16);\n * }\n * ```\n */\nexport function throttled<V>(\n value: V,\n timeMs: MaybeSignal<number>,\n options?: ThrottledOptions<V>\n): WritableSignal<V>;\n\nexport function throttled(\n valueOrSignal: any,\n timeMs: MaybeSignal<number>,\n options?: ThrottledOptions<any>\n) {\n const { runInContext } = setupContext(options?.injector, throttled);\n\n return runInContext(() => {\n const initialValue = toValue(valueOrSignal);\n const output = signal(initialValue, options);\n const set = throttleCallback(output.set, timeMs);\n\n if (isSignal(valueOrSignal)) {\n watcher(valueOrSignal, set);\n return output.asReadonly();\n } else {\n return proxySignal(output, { set });\n }\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;SA2EgB,SAAS,CACvB,aAAkB,EAClB,MAA2B,EAC3B,OAA+B,EAAA;AAE/B,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;IAEnE,OAAO,YAAY,CAAC,MAAK;AACvB,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC;QAC5C,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;AAEhD,QAAA,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE;AAC3B,YAAA,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;AAC3B,YAAA,OAAO,MAAM,CAAC,UAAU,EAAE;QAC5B;aAAO;YACL,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC;QACrC;AACF,IAAA,CAAC,CAAC;AACJ;;AC9FA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-scheduling-debounce-callback.mjs","sources":["../../../projects/core/scheduling/debounce-callback/index.ts","../../../projects/core/scheduling/debounce-callback/signality-core-scheduling-debounce-callback.ts"],"sourcesContent":["import type { MaybeSignal, WithInjector } from '@signality/core/types';\nimport { setupContext, type Timer
|
|
1
|
+
{"version":3,"file":"signality-core-scheduling-debounce-callback.mjs","sources":["../../../projects/core/scheduling/debounce-callback/index.ts","../../../projects/core/scheduling/debounce-callback/signality-core-scheduling-debounce-callback.ts"],"sourcesContent":["import type { MaybeSignal, WithInjector } from '@signality/core/types';\nimport { setupContext, type Timer } from '@signality/core/internal';\nimport { toValue } from '@signality/core/utilities';\n\n/**\n * Creates a debounced version of a callback function.\n * The callback will only be executed after the specified wait time has elapsed since the last invocation.\n *\n * @param callback - The function to debounce\n * @param wait - Debounce delay in milliseconds (can be a reactive signal)\n * @param options - Optional configuration including injector\n * @returns A debounced version of the callback function\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <input (input)=\"handleInput($event.target.value)\" />\n * `,\n * })\n * export class SearchInput {\n * readonly debounceTime = input(300);\n * readonly searchChange = output<string>();\n *\n * readonly handleInput = debounceCallback(value => {\n * this.searchChange.emit(value);\n * }, this.debounceTime);\n * }\n * ```\n */\nexport function debounceCallback<T extends (...args: any[]) => any>(\n callback: T,\n wait: MaybeSignal<number>,\n options?: WithInjector\n): T {\n const { runInContext } = setupContext(options?.injector, debounceCallback);\n\n return runInContext(({ isServer, onCleanup }) => {\n if (isServer) {\n return callback;\n }\n\n let timer: Timer;\n\n onCleanup(() => {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n });\n\n return new Proxy(callback, {\n apply(target, thisArg, args) {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n timer = setTimeout(() => {\n target.apply(thisArg, args);\n }, toValue.untracked(wait));\n },\n });\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;SACa,gBAAgB,CAC9B,QAAW,EACX,IAAyB,EACzB,OAAsB,EAAA;AAEtB,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC;IAE1E,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAI;QAC9C,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,QAAQ;QACjB;AAEA,QAAA,IAAI,KAAY;QAEhB,SAAS,CAAC,MAAK;AACb,YAAA,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,YAAY,CAAC,KAAK,CAAC;YACrB;AACF,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;AACzB,YAAA,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAA;AACzB,gBAAA,IAAI,KAAK,KAAK,SAAS,EAAE;oBACvB,YAAY,CAAC,KAAK,CAAC;gBACrB;AACA,gBAAA,KAAK,GAAG,UAAU,CAAC,MAAK;AACtB,oBAAA,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;gBAC7B,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;AACF,SAAA,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;AC7DA;;AAEG;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isSignal } from '@angular/core';
|
|
2
|
-
import { setupContext, NOOP_EFFECT_REF
|
|
2
|
+
import { setupContext, NOOP_EFFECT_REF } from '@signality/core/internal';
|
|
3
|
+
import { toValue } from '@signality/core/utilities';
|
|
3
4
|
import { watcher } from '@signality/core/reactivity/watcher';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-scheduling-interval.mjs","sources":["../../../projects/core/scheduling/interval/index.ts","../../../projects/core/scheduling/interval/signality-core-scheduling-interval.ts"],"sourcesContent":["import { isSignal } from '@angular/core';\nimport { NOOP_EFFECT_REF, setupContext, type Timer
|
|
1
|
+
{"version":3,"file":"signality-core-scheduling-interval.mjs","sources":["../../../projects/core/scheduling/interval/index.ts","../../../projects/core/scheduling/interval/signality-core-scheduling-interval.ts"],"sourcesContent":["import { isSignal } from '@angular/core';\nimport { NOOP_EFFECT_REF, setupContext, type Timer } from '@signality/core/internal';\nimport { toValue } from '@signality/core/utilities';\nimport type { MaybeSignal, WithInjector } from '@signality/core/types';\nimport { watcher, type WatcherRef } from '@signality/core/reactivity/watcher';\n\nexport interface IntervalOptions extends WithInjector {\n /**\n * Call the callback immediately, without waiting for the first tick.\n *\n * @default false\n */\n readonly immediate?: boolean;\n}\n\nexport interface IntervalRef {\n /**\n * Stop the interval permanently.\n */\n readonly destroy: () => void;\n}\n\n/**\n * Signal-based wrapper around [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/Window/setInterval).\n * Creates a reactive interval that executes a callback at specified intervals.\n * The interval starts immediately upon creation and can be stopped with `destroy()`.\n *\n * @param callback - Function to execute on each interval tick\n * @param intervalMs - Interval duration in milliseconds (can be a reactive signal)\n * @param options - Optional configuration\n * @returns An IntervalRef with a `destroy` method to stop the interval\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <p>Ticks: {{ ticks() }}</p>\n * <button (click)=\"polling.destroy()\">Stop</button>\n * `,\n * })\n * export class PeriodicTask {\n * readonly ticks = signal(0);\n *\n * readonly polling = interval(() => {\n * this.ticks.update(n => n + 1);\n * }, 5000);\n * }\n * ```\n */\nexport function interval(\n callback: () => void,\n intervalMs: MaybeSignal<number>,\n options?: IntervalOptions\n): IntervalRef {\n const { runInContext } = setupContext(options?.injector, interval);\n\n return runInContext(({ isServer, onCleanup }) => {\n if (isServer) {\n return NOOP_EFFECT_REF;\n }\n\n let intervalId: Timer;\n let watcherRef: WatcherRef | null = null;\n\n const start = () => {\n clearInterval(intervalId);\n\n const ms = toValue.untracked(intervalMs);\n intervalId = ms > 0 ? setInterval(callback, ms) : undefined;\n };\n\n if (isSignal(intervalMs)) {\n watcherRef = watcher(intervalMs, start);\n }\n\n const destroy = () => {\n clearInterval(intervalId);\n intervalId = undefined;\n watcherRef?.destroy();\n };\n\n onCleanup(destroy);\n\n if (options?.immediate) {\n callback();\n }\n\n start();\n\n return { destroy };\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,QAAQ,CACtB,QAAoB,EACpB,UAA+B,EAC/B,OAAyB,EAAA;AAEzB,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;IAElE,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAI;QAC9C,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,eAAe;QACxB;AAEA,QAAA,IAAI,UAAiB;QACrB,IAAI,UAAU,GAAsB,IAAI;QAExC,MAAM,KAAK,GAAG,MAAK;YACjB,aAAa,CAAC,UAAU,CAAC;YAEzB,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC;AACxC,YAAA,UAAU,GAAG,EAAE,GAAG,CAAC,GAAG,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,SAAS;AAC7D,QAAA,CAAC;AAED,QAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;AACxB,YAAA,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;QACzC;QAEA,MAAM,OAAO,GAAG,MAAK;YACnB,aAAa,CAAC,UAAU,CAAC;YACzB,UAAU,GAAG,SAAS;YACtB,UAAU,EAAE,OAAO,EAAE;AACvB,QAAA,CAAC;QAED,SAAS,CAAC,OAAO,CAAC;AAElB,QAAA,IAAI,OAAO,EAAE,SAAS,EAAE;AACtB,YAAA,QAAQ,EAAE;QACZ;AAEA,QAAA,KAAK,EAAE;QAEP,OAAO,EAAE,OAAO,EAAE;AACpB,IAAA,CAAC,CAAC;AACJ;;AC3FA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core-scheduling-throttle-callback.mjs","sources":["../../../projects/core/scheduling/throttle-callback/index.ts","../../../projects/core/scheduling/throttle-callback/signality-core-scheduling-throttle-callback.ts"],"sourcesContent":["import type { MaybeSignal, WithInjector } from '@signality/core/types';\nimport { setupContext, type Timer
|
|
1
|
+
{"version":3,"file":"signality-core-scheduling-throttle-callback.mjs","sources":["../../../projects/core/scheduling/throttle-callback/index.ts","../../../projects/core/scheduling/throttle-callback/signality-core-scheduling-throttle-callback.ts"],"sourcesContent":["import type { MaybeSignal, WithInjector } from '@signality/core/types';\nimport { setupContext, type Timer } from '@signality/core/internal';\nimport { toValue } from '@signality/core/utilities';\n\n/**\n * Creates a throttled version of a callback function.\n * The callback will be executed at most once per specified wait interval.\n *\n * @param callback - The function to throttle\n * @param wait - Throttle interval in milliseconds (can be a reactive signal)\n * @param options - Optional configuration including injector\n * @returns A throttled version of the callback function\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <div (scroll)=\"handleScroll($event)\">\n * Scrollable content\n * </div>\n * `,\n * })\n * export class ScrollComponent {\n * readonly throttleTime = input(300);\n * readonly scrollChange = output<Event>();\n *\n * readonly handleScroll = throttleCallback(e => {\n * this.scrollChange.emit(e);\n * }, this.throttleTime);\n * }\n * ```\n */\nexport function throttleCallback<T extends (...args: any[]) => any>(\n callback: T,\n wait: MaybeSignal<number>,\n options?: WithInjector\n): T {\n const { runInContext } = setupContext(options?.injector, throttleCallback);\n\n return runInContext(({ isServer, onCleanup }) => {\n if (isServer) {\n return callback;\n }\n\n let timer: Timer;\n let isThrottled: boolean;\n let lastArgs: Parameters<T>;\n\n onCleanup(() => {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n });\n\n return new Proxy(callback, {\n apply(target, thisArg, args) {\n lastArgs = args as Parameters<T>;\n\n if (isThrottled) {\n return;\n }\n\n target.apply(thisArg, lastArgs);\n isThrottled = true;\n\n timer = setTimeout(() => {\n isThrottled = false;\n }, toValue.untracked(wait));\n },\n });\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;SACa,gBAAgB,CAC9B,QAAW,EACX,IAAyB,EACzB,OAAsB,EAAA;AAEtB,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC;IAE1E,OAAO,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAI;QAC9C,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,QAAQ;QACjB;AAEA,QAAA,IAAI,KAAY;AAChB,QAAA,IAAI,WAAoB;AACxB,QAAA,IAAI,QAAuB;QAE3B,SAAS,CAAC,MAAK;AACb,YAAA,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,YAAY,CAAC,KAAK,CAAC;YACrB;AACF,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;AACzB,YAAA,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAA;gBACzB,QAAQ,GAAG,IAAqB;gBAEhC,IAAI,WAAW,EAAE;oBACf;gBACF;AAEA,gBAAA,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;gBAC/B,WAAW,GAAG,IAAI;AAElB,gBAAA,KAAK,GAAG,UAAU,CAAC,MAAK;oBACtB,WAAW,GAAG,KAAK;gBACrB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;AACF,SAAA,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;ACvEA;;AAEG;;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { inject, InjectionToken, isSignal, untracked } from '@angular/core';
|
|
2
|
+
import { setupContext, unrefElement } from '@signality/core/internal';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a unique ID string with optional prefix.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Optional configuration with prefix and injector
|
|
8
|
+
* @returns A unique ID string
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* @Component({
|
|
13
|
+
* template: `
|
|
14
|
+
* <input [id]="inputId" />
|
|
15
|
+
* `
|
|
16
|
+
* })
|
|
17
|
+
* export class MyInput {
|
|
18
|
+
* readonly inputId = generateId();
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function generateId(options) {
|
|
23
|
+
const { runInContext } = setupContext(options?.injector, generateId);
|
|
24
|
+
return runInContext(() => {
|
|
25
|
+
const factoryFn = inject(GENERATE_ID_FACTORY);
|
|
26
|
+
return factoryFn(options?.prefix);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const GENERATE_ID_FACTORY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'GENERATE_ID_FACTORY' : '', {
|
|
30
|
+
providedIn: 'platform',
|
|
31
|
+
factory: () => {
|
|
32
|
+
let i = 0;
|
|
33
|
+
return (prefix = 'app') => `${prefix}-${Date.now()}${i++}`;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const toValue = (() => {
|
|
38
|
+
const fn = toValueFn;
|
|
39
|
+
fn.untracked = v => toValueFn(v, true);
|
|
40
|
+
return fn;
|
|
41
|
+
})();
|
|
42
|
+
function toValueFn(maybeSignal, untracked$1 = false) {
|
|
43
|
+
if (isSignal(maybeSignal)) {
|
|
44
|
+
return untracked$1 ? untracked(maybeSignal) : maybeSignal();
|
|
45
|
+
}
|
|
46
|
+
return maybeSignal;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const toElement = (() => {
|
|
50
|
+
const fn = toElementFn;
|
|
51
|
+
fn.untracked = v => toElementFn(v, true);
|
|
52
|
+
return fn;
|
|
53
|
+
})();
|
|
54
|
+
function toElementFn(maybeSignal, untracked = false) {
|
|
55
|
+
const raw = untracked ? toValue.untracked(maybeSignal) : toValue(maybeSignal);
|
|
56
|
+
return unrefElement(raw);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Generated bundle index. Do not edit.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
export { GENERATE_ID_FACTORY, generateId, toElement, toValue };
|
|
64
|
+
//# sourceMappingURL=signality-core-utilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signality-core-utilities.mjs","sources":["../../../projects/core/utilities/generate-id.ts","../../../projects/core/utilities/to-value.ts","../../../projects/core/utilities/to-element.ts","../../../projects/core/utilities/signality-core-utilities.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport { setupContext } from '@signality/core/internal';\nimport type { WithInjector } from '@signality/core/types';\n\nexport interface GenerateIdOptions extends WithInjector {\n /**\n * Optional prefix for the generated ID.\n * @default 'app'\n */\n readonly prefix?: string;\n}\n\n/**\n * Creates a unique ID string with optional prefix.\n *\n * @param options - Optional configuration with prefix and injector\n * @returns A unique ID string\n *\n * @example\n * ```typescript\n * @Component({\n * template: `\n * <input [id]=\"inputId\" />\n * `\n * })\n * export class MyInput {\n * readonly inputId = generateId();\n * }\n * ```\n */\nexport function generateId(options?: GenerateIdOptions): string {\n const { runInContext } = setupContext(options?.injector, generateId);\n\n return runInContext(() => {\n const factoryFn = inject(GENERATE_ID_FACTORY);\n return factoryFn(options?.prefix);\n });\n}\n\nexport const GENERATE_ID_FACTORY = new InjectionToken<(prefix?: string) => string>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'GENERATE_ID_FACTORY' : '',\n {\n providedIn: 'platform',\n factory: () => {\n let i = 0;\n return (prefix = 'app') => `${prefix}-${Date.now()}${i++}`;\n },\n }\n);\n","import { isSignal, untracked as _untracked } from '@angular/core';\nimport type { MaybeSignal } from '@signality/core/types';\n\nexport interface ToValueFn {\n <T>(maybeSignal: MaybeSignal<T>): T;\n untracked: <T>(maybeSignal: MaybeSignal<T>) => T;\n}\n\nexport const toValue: ToValueFn = (() => {\n const fn = toValueFn as ToValueFn;\n fn.untracked = v => toValueFn(v, true);\n return fn;\n})();\n\nfunction toValueFn<T>(maybeSignal: MaybeSignal<T>, untracked = false): T {\n if (isSignal(maybeSignal)) {\n return untracked ? _untracked(maybeSignal) : maybeSignal();\n }\n return maybeSignal;\n}\n","import { type ElementRef, type Signal } from '@angular/core';\nimport { unrefElement } from '@signality/core/internal';\nimport type { MaybeElementSignal } from '@signality/core/types';\nimport { toValue } from './to-value';\n\nexport interface ToElementFn extends ToElementBase {\n untracked: ToElementBase;\n}\n\nexport interface ToElementBase {\n <T extends Element>(element: T | ElementRef<T>): T;\n <T extends Element>(element: Signal<T | ElementRef<T> | null>): T | null;\n <T extends Element>(element: Signal<T | ElementRef<T> | undefined>): T | undefined;\n <T extends Element>(element: Signal<T | ElementRef<T> | null | undefined>): T | null | undefined;\n <T extends Element>(element: T | ElementRef<T> | Signal<T | ElementRef<T> | null | undefined>):\n | T\n | null\n | undefined;\n}\n\nexport const toElement: ToElementFn = (() => {\n const fn = toElementFn as ToElementFn;\n fn.untracked = v => toElementFn(v, true);\n return fn;\n})();\n\nfunction toElementFn<T extends Element>(\n maybeSignal: MaybeElementSignal<T>,\n untracked = false\n): T | null | undefined {\n const raw = untracked ? toValue.untracked(maybeSignal) : toValue(maybeSignal);\n return unrefElement(raw);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["untracked","_untracked"],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,UAAU,CAAC,OAA2B,EAAA;AACpD,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC;IAEpE,OAAO,YAAY,CAAC,MAAK;AACvB,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAC7C,QAAA,OAAO,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;AACnC,IAAA,CAAC,CAAC;AACJ;MAEa,mBAAmB,GAAG,IAAI,cAAc,CACnD,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,qBAAqB,GAAG,EAAE,EAC1E;AACE,IAAA,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,MAAK;QACZ,IAAI,CAAC,GAAG,CAAC;AACT,QAAA,OAAO,CAAC,MAAM,GAAG,KAAK,KAAK,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;IAC5D,CAAC;AACF,CAAA;;ACvCI,MAAM,OAAO,GAAc,CAAC,MAAK;IACtC,MAAM,EAAE,GAAG,SAAsB;AACjC,IAAA,EAAE,CAAC,SAAS,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC;AACtC,IAAA,OAAO,EAAE;AACX,CAAC;AAED,SAAS,SAAS,CAAI,WAA2B,EAAEA,WAAS,GAAG,KAAK,EAAA;AAClE,IAAA,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;AACzB,QAAA,OAAOA,WAAS,GAAGC,SAAU,CAAC,WAAW,CAAC,GAAG,WAAW,EAAE;IAC5D;AACA,IAAA,OAAO,WAAW;AACpB;;ACCO,MAAM,SAAS,GAAgB,CAAC,MAAK;IAC1C,MAAM,EAAE,GAAG,WAA0B;AACrC,IAAA,EAAE,CAAC,SAAS,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;AACxC,IAAA,OAAO,EAAE;AACX,CAAC;AAED,SAAS,WAAW,CAClB,WAAkC,EAClC,SAAS,GAAG,KAAK,EAAA;AAEjB,IAAA,MAAM,GAAG,GAAG,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;AAC7E,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC;AAC1B;;AChCA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signality-core.mjs","sources":["../../../projects/core/signality-core.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signality-core.mjs","sources":["../../../projects/core/signality-core.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;AAEG"}
|
package/forms/cva/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { type Signal, type WritableSignal } from '@angular/core';
|
|
2
2
|
import { type ValidationErrors } from '@angular/forms';
|
|
3
3
|
import type { WithInjector } from '@signality/core/types';
|
|
4
|
-
export
|
|
4
|
+
export interface CvaOptions<T> extends WithInjector {
|
|
5
|
+
readonly value: WritableSignal<T>;
|
|
6
|
+
readonly touched?: WritableSignal<boolean>;
|
|
7
|
+
readonly disabled?: WritableSignal<boolean>;
|
|
8
|
+
readonly required?: WritableSignal<boolean>;
|
|
9
|
+
readonly invalid?: WritableSignal<boolean>;
|
|
10
|
+
readonly pending?: WritableSignal<boolean>;
|
|
11
|
+
readonly dirty?: WritableSignal<boolean>;
|
|
12
|
+
readonly errors?: WritableSignal<ValidationErrors | null>;
|
|
13
|
+
}
|
|
5
14
|
export interface CvaRef<T> {
|
|
6
15
|
readonly value: WritableSignal<T>;
|
|
7
16
|
readonly touched: WritableSignal<boolean>;
|
|
@@ -54,7 +63,3 @@ export interface CvaRef<T> {
|
|
|
54
63
|
* ```
|
|
55
64
|
*/
|
|
56
65
|
export declare function cva<T>(options: CvaOptions<T>): CvaRef<T>;
|
|
57
|
-
type MakeWritable<T extends object> = {
|
|
58
|
-
[K in keyof T]: T[K] extends Signal<infer U> ? WritableSignal<U> : never;
|
|
59
|
-
};
|
|
60
|
-
export {};
|
package/index.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ export * from './dom';
|
|
|
3
3
|
export * from './assert';
|
|
4
4
|
export * from './context';
|
|
5
5
|
export * from './create-token';
|
|
6
|
+
export * from './wait-for-value';
|
|
6
7
|
export * from './is-query-signal';
|
|
7
8
|
export * from './is-plain-object';
|
|
8
9
|
export * from './const-signal';
|
|
9
10
|
export * from './proxy-signal';
|
|
10
|
-
export * from './to-element';
|
|
11
|
-
export * from './to-value';
|
|
12
11
|
export * from './unref-element';
|
|
13
12
|
export * from './files/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signality/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vyacheslav Borodin <https://github.com/vs-borodin>",
|
|
6
6
|
"description": "A foundational toolkit for Angular Signals",
|
|
@@ -76,6 +76,10 @@
|
|
|
76
76
|
"types": "./types/index.d.ts",
|
|
77
77
|
"default": "./fesm2022/signality-core-types.mjs"
|
|
78
78
|
},
|
|
79
|
+
"./utilities": {
|
|
80
|
+
"types": "./utilities/index.d.ts",
|
|
81
|
+
"default": "./fesm2022/signality-core-utilities.mjs"
|
|
82
|
+
},
|
|
79
83
|
"./browser/battery": {
|
|
80
84
|
"types": "./browser/battery/index.d.ts",
|
|
81
85
|
"default": "./fesm2022/signality-core-browser-battery.mjs"
|
|
@@ -100,6 +104,10 @@
|
|
|
100
104
|
"types": "./browser/clipboard/index.d.ts",
|
|
101
105
|
"default": "./fesm2022/signality-core-browser-clipboard.mjs"
|
|
102
106
|
},
|
|
107
|
+
"./browser/device-pixel-ratio": {
|
|
108
|
+
"types": "./browser/device-pixel-ratio/index.d.ts",
|
|
109
|
+
"default": "./fesm2022/signality-core-browser-device-pixel-ratio.mjs"
|
|
110
|
+
},
|
|
103
111
|
"./browser/device-posture": {
|
|
104
112
|
"types": "./browser/device-posture/index.d.ts",
|
|
105
113
|
"default": "./fesm2022/signality-core-browser-device-posture.mjs"
|
|
@@ -288,14 +296,14 @@
|
|
|
288
296
|
"types": "./observers/resize-observer/index.d.ts",
|
|
289
297
|
"default": "./fesm2022/signality-core-observers-resize-observer.mjs"
|
|
290
298
|
},
|
|
291
|
-
"./reactivity/throttled": {
|
|
292
|
-
"types": "./reactivity/throttled/index.d.ts",
|
|
293
|
-
"default": "./fesm2022/signality-core-reactivity-throttled.mjs"
|
|
294
|
-
},
|
|
295
299
|
"./reactivity/debounced": {
|
|
296
300
|
"types": "./reactivity/debounced/index.d.ts",
|
|
297
301
|
"default": "./fesm2022/signality-core-reactivity-debounced.mjs"
|
|
298
302
|
},
|
|
303
|
+
"./reactivity/throttled": {
|
|
304
|
+
"types": "./reactivity/throttled/index.d.ts",
|
|
305
|
+
"default": "./fesm2022/signality-core-reactivity-throttled.mjs"
|
|
306
|
+
},
|
|
299
307
|
"./reactivity/watcher": {
|
|
300
308
|
"types": "./reactivity/watcher/index.d.ts",
|
|
301
309
|
"default": "./fesm2022/signality-core-reactivity-watcher.mjs"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface GenerateIdOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Optional prefix for the generated ID.
|
|
6
|
+
* @default 'app'
|
|
7
|
+
*/
|
|
8
|
+
readonly prefix?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates a unique ID string with optional prefix.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Optional configuration with prefix and injector
|
|
14
|
+
* @returns A unique ID string
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* @Component({
|
|
19
|
+
* template: `
|
|
20
|
+
* <input [id]="inputId" />
|
|
21
|
+
* `
|
|
22
|
+
* })
|
|
23
|
+
* export class MyInput {
|
|
24
|
+
* readonly inputId = generateId();
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateId(options?: GenerateIdOptions): string;
|
|
29
|
+
export declare const GENERATE_ID_FACTORY: InjectionToken<(prefix?: string) => string>;
|
|
File without changes
|
|
File without changes
|