Primeiro commit do projeto Angular
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
const Attribute = {
|
||||
JSACTION: 'jsaction'
|
||||
};
|
||||
|
||||
export { Attribute };
|
||||
//# sourceMappingURL=_attribute-chunk.mjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_attribute-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/attribute.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport const Attribute = {\n /**\n * The jsaction attribute defines a mapping of a DOM event to a\n * generic event (aka jsaction), to which the actual event handlers\n * that implement the behavior of the application are bound. The\n * value is a semicolon separated list of colon separated pairs of\n * an optional DOM event name and a jsaction name. If the optional\n * DOM event name is omitted, 'click' is assumed. The jsaction names\n * are dot separated pairs of a namespace and a simple jsaction\n * name.\n *\n * See grammar in README.md for expected syntax in the attribute value.\n */\n JSACTION: 'jsaction' as const,\n};\n"],"names":["Attribute","JSACTION"],"mappings":";;;;;;AAQO,MAAMA,SAAS,GAAG;AAavBC,EAAAA,QAAQ,EAAE;;;;;"}
|
||||
+18610
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+423
@@ -0,0 +1,423 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
let activeConsumer = null;
|
||||
let inNotificationPhase = false;
|
||||
let epoch = 1;
|
||||
let postProducerCreatedFn = null;
|
||||
const SIGNAL = /* @__PURE__ */Symbol('SIGNAL');
|
||||
function setActiveConsumer(consumer) {
|
||||
const prev = activeConsumer;
|
||||
activeConsumer = consumer;
|
||||
return prev;
|
||||
}
|
||||
function getActiveConsumer() {
|
||||
return activeConsumer;
|
||||
}
|
||||
function isInNotificationPhase() {
|
||||
return inNotificationPhase;
|
||||
}
|
||||
function isReactive(value) {
|
||||
return value[SIGNAL] !== undefined;
|
||||
}
|
||||
const REACTIVE_NODE = {
|
||||
version: 0,
|
||||
lastCleanEpoch: 0,
|
||||
dirty: false,
|
||||
producers: undefined,
|
||||
producersTail: undefined,
|
||||
consumers: undefined,
|
||||
consumersTail: undefined,
|
||||
recomputing: false,
|
||||
consumerAllowSignalWrites: false,
|
||||
consumerIsAlwaysLive: false,
|
||||
kind: 'unknown',
|
||||
producerMustRecompute: () => false,
|
||||
producerRecomputeValue: () => {},
|
||||
consumerMarkedDirty: () => {},
|
||||
consumerOnSignalRead: () => {}
|
||||
};
|
||||
function producerAccessed(node) {
|
||||
if (inNotificationPhase) {
|
||||
throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? `Assertion error: signal read during notification phase` : '');
|
||||
}
|
||||
if (activeConsumer === null) {
|
||||
return;
|
||||
}
|
||||
activeConsumer.consumerOnSignalRead(node);
|
||||
const prevProducerLink = activeConsumer.producersTail;
|
||||
if (prevProducerLink !== undefined && prevProducerLink.producer === node) {
|
||||
return;
|
||||
}
|
||||
let nextProducerLink = undefined;
|
||||
const isRecomputing = activeConsumer.recomputing;
|
||||
if (isRecomputing) {
|
||||
nextProducerLink = prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;
|
||||
if (nextProducerLink !== undefined && nextProducerLink.producer === node) {
|
||||
activeConsumer.producersTail = nextProducerLink;
|
||||
nextProducerLink.lastReadVersion = node.version;
|
||||
return;
|
||||
}
|
||||
}
|
||||
const prevConsumerLink = node.consumersTail;
|
||||
if (prevConsumerLink !== undefined && prevConsumerLink.consumer === activeConsumer && (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))) {
|
||||
return;
|
||||
}
|
||||
const isLive = consumerIsLive(activeConsumer);
|
||||
const newLink = {
|
||||
producer: node,
|
||||
consumer: activeConsumer,
|
||||
nextProducer: nextProducerLink,
|
||||
prevConsumer: prevConsumerLink,
|
||||
lastReadVersion: node.version,
|
||||
nextConsumer: undefined
|
||||
};
|
||||
activeConsumer.producersTail = newLink;
|
||||
if (prevProducerLink !== undefined) {
|
||||
prevProducerLink.nextProducer = newLink;
|
||||
} else {
|
||||
activeConsumer.producers = newLink;
|
||||
}
|
||||
if (isLive) {
|
||||
producerAddLiveConsumer(node, newLink);
|
||||
}
|
||||
}
|
||||
function producerIncrementEpoch() {
|
||||
epoch++;
|
||||
}
|
||||
function producerUpdateValueVersion(node) {
|
||||
if (consumerIsLive(node) && !node.dirty) {
|
||||
return;
|
||||
}
|
||||
if (!node.dirty && node.lastCleanEpoch === epoch) {
|
||||
return;
|
||||
}
|
||||
if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
|
||||
producerMarkClean(node);
|
||||
return;
|
||||
}
|
||||
node.producerRecomputeValue(node);
|
||||
producerMarkClean(node);
|
||||
}
|
||||
function producerNotifyConsumers(node) {
|
||||
if (node.consumers === undefined) {
|
||||
return;
|
||||
}
|
||||
const prev = inNotificationPhase;
|
||||
inNotificationPhase = true;
|
||||
try {
|
||||
for (let link = node.consumers; link !== undefined; link = link.nextConsumer) {
|
||||
const consumer = link.consumer;
|
||||
if (!consumer.dirty) {
|
||||
consumerMarkDirty(consumer);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
inNotificationPhase = prev;
|
||||
}
|
||||
}
|
||||
function producerUpdatesAllowed() {
|
||||
return activeConsumer?.consumerAllowSignalWrites !== false;
|
||||
}
|
||||
function consumerMarkDirty(node) {
|
||||
node.dirty = true;
|
||||
producerNotifyConsumers(node);
|
||||
node.consumerMarkedDirty?.(node);
|
||||
}
|
||||
function producerMarkClean(node) {
|
||||
node.dirty = false;
|
||||
node.lastCleanEpoch = epoch;
|
||||
}
|
||||
function consumerBeforeComputation(node) {
|
||||
if (node) resetConsumerBeforeComputation(node);
|
||||
return setActiveConsumer(node);
|
||||
}
|
||||
function resetConsumerBeforeComputation(node) {
|
||||
node.producersTail = undefined;
|
||||
node.recomputing = true;
|
||||
}
|
||||
function consumerAfterComputation(node, prevConsumer) {
|
||||
setActiveConsumer(prevConsumer);
|
||||
if (node) finalizeConsumerAfterComputation(node);
|
||||
}
|
||||
function finalizeConsumerAfterComputation(node) {
|
||||
node.recomputing = false;
|
||||
const producersTail = node.producersTail;
|
||||
let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;
|
||||
if (toRemove !== undefined) {
|
||||
if (consumerIsLive(node)) {
|
||||
do {
|
||||
toRemove = producerRemoveLiveConsumerLink(toRemove);
|
||||
} while (toRemove !== undefined);
|
||||
}
|
||||
if (producersTail !== undefined) {
|
||||
producersTail.nextProducer = undefined;
|
||||
} else {
|
||||
node.producers = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
function consumerPollProducersForChange(node) {
|
||||
for (let link = node.producers; link !== undefined; link = link.nextProducer) {
|
||||
const producer = link.producer;
|
||||
const seenVersion = link.lastReadVersion;
|
||||
if (seenVersion !== producer.version) {
|
||||
return true;
|
||||
}
|
||||
producerUpdateValueVersion(producer);
|
||||
if (seenVersion !== producer.version) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function consumerDestroy(node) {
|
||||
if (consumerIsLive(node)) {
|
||||
let link = node.producers;
|
||||
while (link !== undefined) {
|
||||
link = producerRemoveLiveConsumerLink(link);
|
||||
}
|
||||
}
|
||||
node.producers = undefined;
|
||||
node.producersTail = undefined;
|
||||
node.consumers = undefined;
|
||||
node.consumersTail = undefined;
|
||||
}
|
||||
function producerAddLiveConsumer(node, link) {
|
||||
const consumersTail = node.consumersTail;
|
||||
const wasLive = consumerIsLive(node);
|
||||
if (consumersTail !== undefined) {
|
||||
link.nextConsumer = consumersTail.nextConsumer;
|
||||
consumersTail.nextConsumer = link;
|
||||
} else {
|
||||
link.nextConsumer = undefined;
|
||||
node.consumers = link;
|
||||
}
|
||||
link.prevConsumer = consumersTail;
|
||||
node.consumersTail = link;
|
||||
if (!wasLive) {
|
||||
for (let link = node.producers; link !== undefined; link = link.nextProducer) {
|
||||
producerAddLiveConsumer(link.producer, link);
|
||||
}
|
||||
}
|
||||
}
|
||||
function producerRemoveLiveConsumerLink(link) {
|
||||
const producer = link.producer;
|
||||
const nextProducer = link.nextProducer;
|
||||
const nextConsumer = link.nextConsumer;
|
||||
const prevConsumer = link.prevConsumer;
|
||||
link.nextConsumer = undefined;
|
||||
link.prevConsumer = undefined;
|
||||
if (nextConsumer !== undefined) {
|
||||
nextConsumer.prevConsumer = prevConsumer;
|
||||
} else {
|
||||
producer.consumersTail = prevConsumer;
|
||||
}
|
||||
if (prevConsumer !== undefined) {
|
||||
prevConsumer.nextConsumer = nextConsumer;
|
||||
} else {
|
||||
producer.consumers = nextConsumer;
|
||||
if (!consumerIsLive(producer)) {
|
||||
let producerLink = producer.producers;
|
||||
while (producerLink !== undefined) {
|
||||
producerLink = producerRemoveLiveConsumerLink(producerLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nextProducer;
|
||||
}
|
||||
function consumerIsLive(node) {
|
||||
return node.consumerIsAlwaysLive || node.consumers !== undefined;
|
||||
}
|
||||
function runPostProducerCreatedFn(node) {
|
||||
postProducerCreatedFn?.(node);
|
||||
}
|
||||
function setPostProducerCreatedFn(fn) {
|
||||
const prev = postProducerCreatedFn;
|
||||
postProducerCreatedFn = fn;
|
||||
return prev;
|
||||
}
|
||||
function isValidLink(checkLink, consumer) {
|
||||
const producersTail = consumer.producersTail;
|
||||
if (producersTail !== undefined) {
|
||||
let link = consumer.producers;
|
||||
do {
|
||||
if (link === checkLink) {
|
||||
return true;
|
||||
}
|
||||
if (link === producersTail) {
|
||||
break;
|
||||
}
|
||||
link = link.nextProducer;
|
||||
} while (link !== undefined);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function defaultEquals(a, b) {
|
||||
return Object.is(a, b);
|
||||
}
|
||||
|
||||
function createComputed(computation, equal) {
|
||||
const node = Object.create(COMPUTED_NODE);
|
||||
node.computation = computation;
|
||||
if (equal !== undefined) {
|
||||
node.equal = equal;
|
||||
}
|
||||
const computed = () => {
|
||||
producerUpdateValueVersion(node);
|
||||
producerAccessed(node);
|
||||
if (node.value === ERRORED) {
|
||||
throw node.error;
|
||||
}
|
||||
return node.value;
|
||||
};
|
||||
computed[SIGNAL] = node;
|
||||
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
||||
const debugName = node.debugName ? ' (' + node.debugName + ')' : '';
|
||||
computed.toString = () => `[Computed${debugName}: ${String(node.value)}]`;
|
||||
}
|
||||
runPostProducerCreatedFn(node);
|
||||
return computed;
|
||||
}
|
||||
const UNSET = /* @__PURE__ */Symbol('UNSET');
|
||||
const COMPUTING = /* @__PURE__ */Symbol('COMPUTING');
|
||||
const ERRORED = /* @__PURE__ */Symbol('ERRORED');
|
||||
const COMPUTED_NODE = /* @__PURE__ */(() => {
|
||||
return {
|
||||
...REACTIVE_NODE,
|
||||
value: UNSET,
|
||||
dirty: true,
|
||||
error: null,
|
||||
equal: defaultEquals,
|
||||
kind: 'computed',
|
||||
producerMustRecompute(node) {
|
||||
return node.value === UNSET || node.value === COMPUTING;
|
||||
},
|
||||
producerRecomputeValue(node) {
|
||||
if (node.value === COMPUTING) {
|
||||
throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '');
|
||||
}
|
||||
const oldValue = node.value;
|
||||
node.value = COMPUTING;
|
||||
const prevConsumer = consumerBeforeComputation(node);
|
||||
let newValue;
|
||||
let wasEqual = false;
|
||||
try {
|
||||
newValue = node.computation();
|
||||
setActiveConsumer(null);
|
||||
wasEqual = oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue);
|
||||
} catch (err) {
|
||||
newValue = ERRORED;
|
||||
node.error = err;
|
||||
} finally {
|
||||
consumerAfterComputation(node, prevConsumer);
|
||||
}
|
||||
if (wasEqual) {
|
||||
node.value = oldValue;
|
||||
return;
|
||||
}
|
||||
node.value = newValue;
|
||||
node.version++;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
function defaultThrowError() {
|
||||
throw new Error();
|
||||
}
|
||||
let throwInvalidWriteToSignalErrorFn = defaultThrowError;
|
||||
function throwInvalidWriteToSignalError(node) {
|
||||
throwInvalidWriteToSignalErrorFn(node);
|
||||
}
|
||||
function setThrowInvalidWriteToSignalError(fn) {
|
||||
throwInvalidWriteToSignalErrorFn = fn;
|
||||
}
|
||||
|
||||
let postSignalSetFn = null;
|
||||
function createSignal(initialValue, equal) {
|
||||
const node = Object.create(SIGNAL_NODE);
|
||||
node.value = initialValue;
|
||||
if (equal !== undefined) {
|
||||
node.equal = equal;
|
||||
}
|
||||
const getter = () => signalGetFn(node);
|
||||
getter[SIGNAL] = node;
|
||||
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
||||
const debugName = node.debugName ? ' (' + node.debugName + ')' : '';
|
||||
getter.toString = () => `[Signal${debugName}: ${String(node.value)}]`;
|
||||
}
|
||||
runPostProducerCreatedFn(node);
|
||||
const set = newValue => signalSetFn(node, newValue);
|
||||
const update = updateFn => signalUpdateFn(node, updateFn);
|
||||
return [getter, set, update];
|
||||
}
|
||||
function setPostSignalSetFn(fn) {
|
||||
const prev = postSignalSetFn;
|
||||
postSignalSetFn = fn;
|
||||
return prev;
|
||||
}
|
||||
function signalGetFn(node) {
|
||||
producerAccessed(node);
|
||||
return node.value;
|
||||
}
|
||||
function signalSetFn(node, newValue) {
|
||||
if (!producerUpdatesAllowed()) {
|
||||
throwInvalidWriteToSignalError(node);
|
||||
}
|
||||
if (!node.equal(node.value, newValue)) {
|
||||
node.value = newValue;
|
||||
signalValueChanged(node);
|
||||
}
|
||||
}
|
||||
function signalUpdateFn(node, updater) {
|
||||
if (!producerUpdatesAllowed()) {
|
||||
throwInvalidWriteToSignalError(node);
|
||||
}
|
||||
signalSetFn(node, updater(node.value));
|
||||
}
|
||||
function runPostSignalSetFn(node) {
|
||||
postSignalSetFn?.(node);
|
||||
}
|
||||
const SIGNAL_NODE = /* @__PURE__ */(() => {
|
||||
return {
|
||||
...REACTIVE_NODE,
|
||||
equal: defaultEquals,
|
||||
value: undefined,
|
||||
kind: 'signal'
|
||||
};
|
||||
})();
|
||||
function signalValueChanged(node) {
|
||||
node.version++;
|
||||
producerIncrementEpoch();
|
||||
producerNotifyConsumers(node);
|
||||
postSignalSetFn?.(node);
|
||||
}
|
||||
|
||||
const BASE_EFFECT_NODE = /* @__PURE__ */(() => ({
|
||||
...REACTIVE_NODE,
|
||||
consumerIsAlwaysLive: true,
|
||||
consumerAllowSignalWrites: true,
|
||||
dirty: true,
|
||||
kind: 'effect'
|
||||
}))();
|
||||
function runEffect(node) {
|
||||
node.dirty = false;
|
||||
if (node.version > 0 && !consumerPollProducersForChange(node)) {
|
||||
return;
|
||||
}
|
||||
node.version++;
|
||||
const prevNode = consumerBeforeComputation(node);
|
||||
try {
|
||||
node.cleanup();
|
||||
node.fn();
|
||||
} finally {
|
||||
consumerAfterComputation(node, prevNode);
|
||||
}
|
||||
}
|
||||
|
||||
export { BASE_EFFECT_NODE, COMPUTING, ERRORED, REACTIVE_NODE, SIGNAL, SIGNAL_NODE, UNSET, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createComputed, createSignal, defaultEquals, finalizeConsumerAfterComputation, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerIncrementEpoch, producerMarkClean, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, resetConsumerBeforeComputation, runEffect, runPostProducerCreatedFn, runPostSignalSetFn, setActiveConsumer, setPostProducerCreatedFn, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalGetFn, signalSetFn, signalUpdateFn };
|
||||
//# sourceMappingURL=_effect-chunk.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+2977
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
let _currentInjector = undefined;
|
||||
function getCurrentInjector() {
|
||||
return _currentInjector;
|
||||
}
|
||||
function setCurrentInjector(injector) {
|
||||
const former = _currentInjector;
|
||||
_currentInjector = injector;
|
||||
return former;
|
||||
}
|
||||
function inject(token, options) {
|
||||
const currentInjector = getCurrentInjector();
|
||||
if (!currentInjector) {
|
||||
throw new Error('Current injector is not set.');
|
||||
}
|
||||
if (!token.ɵprov) {
|
||||
throw new Error('Token is not an injectable');
|
||||
}
|
||||
return currentInjector.retrieve(token, options);
|
||||
}
|
||||
|
||||
const NOT_FOUND = Symbol('NotFound');
|
||||
class NotFoundError extends Error {
|
||||
name = 'ɵNotFound';
|
||||
constructor(message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
function isNotFound(e) {
|
||||
return e === NOT_FOUND || e?.name === 'ɵNotFound';
|
||||
}
|
||||
|
||||
export { NOT_FOUND, NotFoundError, getCurrentInjector, inject, isNotFound, setCurrentInjector };
|
||||
//# sourceMappingURL=_not_found-chunk.mjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_not_found-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injector.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/not_found.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Constructor, InjectionToken} from './injection_token';\nimport {NotFound} from './not_found';\n\nexport interface Injector {\n retrieve<T>(token: InjectionToken<T>, options?: unknown): T | NotFound;\n}\n\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector: Injector | undefined | null = undefined;\n\nexport function getCurrentInjector(): Injector | undefined | null {\n return _currentInjector;\n}\n\nexport function setCurrentInjector(\n injector: Injector | null | undefined,\n): Injector | undefined | null {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\n\nexport function inject<T>(token: InjectionToken<T> | Constructor<T>): T;\nexport function inject<T>(\n token: InjectionToken<T> | Constructor<T>,\n options?: unknown,\n): T | NotFound {\n const currentInjector = getCurrentInjector();\n if (!currentInjector) {\n throw new Error('Current injector is not set.');\n }\n if (!(token as InjectionToken<T>).ɵprov) {\n throw new Error('Token is not an injectable');\n }\n return currentInjector.retrieve(token as InjectionToken<T>, options);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Value returned if the key-value pair couldn't be found in the context\n * hierarchy.\n */\nexport const NOT_FOUND: unique symbol = Symbol('NotFound');\n\n/**\n * Error thrown when the key-value pair couldn't be found in the context\n * hierarchy. Context can be attached below.\n */\nexport class NotFoundError extends Error {\n override readonly name: string = 'ɵNotFound';\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * Type guard for checking if an unknown value is a NotFound.\n */\nexport function isNotFound(e: unknown): e is NotFound {\n return e === NOT_FOUND || (e as NotFoundError)?.name === 'ɵNotFound';\n}\n\n/**\n * Type union of NotFound and NotFoundError.\n */\nexport type NotFound = typeof NOT_FOUND | NotFoundError;\n"],"names":["_currentInjector","undefined","getCurrentInjector","setCurrentInjector","injector","former","inject","token","options","currentInjector","Error","ɵprov","retrieve","NOT_FOUND","Symbol","NotFoundError","name","constructor","message","isNotFound","e"],"mappings":";;;;;;AAqBA,IAAIA,gBAAgB,GAAgCC,SAAS;SAE7CC,kBAAkBA,GAAA;AAChC,EAAA,OAAOF,gBAAgB;AACzB;AAEM,SAAUG,kBAAkBA,CAChCC,QAAqC,EAAA;EAErC,MAAMC,MAAM,GAAGL,gBAAgB;AAC/BA,EAAAA,gBAAgB,GAAGI,QAAQ;AAC3B,EAAA,OAAOC,MAAM;AACf;AAGgB,SAAAC,MAAMA,CACpBC,KAAyC,EACzCC,OAAiB,EAAA;AAEjB,EAAA,MAAMC,eAAe,GAAGP,kBAAkB,EAAE;EAC5C,IAAI,CAACO,eAAe,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;AACjD;AACA,EAAA,IAAI,CAAEH,KAA2B,CAACI,KAAK,EAAE;AACvC,IAAA,MAAM,IAAID,KAAK,CAAC,4BAA4B,CAAC;AAC/C;AACA,EAAA,OAAOD,eAAe,CAACG,QAAQ,CAACL,KAA0B,EAAEC,OAAO,CAAC;AACtE;;MCpCaK,SAAS,GAAkBC,MAAM,CAAC,UAAU;AAMnD,MAAOC,aAAc,SAAQL,KAAK,CAAA;AACpBM,EAAAA,IAAI,GAAW,WAAW;EAC5CC,WAAAA,CAAYC,OAAe,EAAA;IACzB,KAAK,CAACA,OAAO,CAAC;AAChB;AACD;AAKK,SAAUC,UAAUA,CAACC,CAAU,EAAA;EACnC,OAAOA,CAAC,KAAKP,SAAS,IAAKO,CAAmB,EAAEJ,IAAI,KAAK,WAAW;AACtE;;;;"}
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { inject, ErrorHandler, DestroyRef, RuntimeError, formatRuntimeError, signalAsReadonlyFn, assertInInjectionContext, Injector, effect, PendingTasks, signal } from './_effect-chunk2.mjs';
|
||||
import { setActiveConsumer, createComputed, SIGNAL } from './_effect-chunk.mjs';
|
||||
import { untracked as untracked$1, createLinkedSignal, linkedSignalSetFn, linkedSignalUpdateFn } from './_untracked-chunk.mjs';
|
||||
|
||||
class OutputEmitterRef {
|
||||
destroyed = false;
|
||||
listeners = null;
|
||||
errorHandler = inject(ErrorHandler, {
|
||||
optional: true
|
||||
});
|
||||
destroyRef = inject(DestroyRef);
|
||||
constructor() {
|
||||
this.destroyRef.onDestroy(() => {
|
||||
this.destroyed = true;
|
||||
this.listeners = null;
|
||||
});
|
||||
}
|
||||
subscribe(callback) {
|
||||
if (this.destroyed) {
|
||||
throw new RuntimeError(953, ngDevMode && 'Unexpected subscription to destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');
|
||||
}
|
||||
(this.listeners ??= []).push(callback);
|
||||
return {
|
||||
unsubscribe: () => {
|
||||
const idx = this.listeners?.indexOf(callback);
|
||||
if (idx !== undefined && idx !== -1) {
|
||||
this.listeners?.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
emit(value) {
|
||||
if (this.destroyed) {
|
||||
console.warn(formatRuntimeError(953, ngDevMode && 'Unexpected emit for destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.'));
|
||||
return;
|
||||
}
|
||||
if (this.listeners === null) {
|
||||
return;
|
||||
}
|
||||
const previousConsumer = setActiveConsumer(null);
|
||||
try {
|
||||
for (const listenerFn of this.listeners) {
|
||||
try {
|
||||
listenerFn(value);
|
||||
} catch (err) {
|
||||
this.errorHandler?.handleError(err);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
setActiveConsumer(previousConsumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getOutputDestroyRef(ref) {
|
||||
return ref.destroyRef;
|
||||
}
|
||||
|
||||
function untracked(nonReactiveReadsFn) {
|
||||
return untracked$1(nonReactiveReadsFn);
|
||||
}
|
||||
|
||||
function computed(computation, options) {
|
||||
const getter = createComputed(computation, options?.equal);
|
||||
if (ngDevMode) {
|
||||
getter.toString = () => `[Computed: ${getter()}]`;
|
||||
getter[SIGNAL].debugName = options?.debugName;
|
||||
}
|
||||
return getter;
|
||||
}
|
||||
|
||||
const identityFn = v => v;
|
||||
function linkedSignal(optionsOrComputation, options) {
|
||||
if (typeof optionsOrComputation === 'function') {
|
||||
const getter = createLinkedSignal(optionsOrComputation, identityFn, options?.equal);
|
||||
return upgradeLinkedSignalGetter(getter, options?.debugName);
|
||||
} else {
|
||||
const getter = createLinkedSignal(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
|
||||
return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);
|
||||
}
|
||||
}
|
||||
function upgradeLinkedSignalGetter(getter, debugName) {
|
||||
if (ngDevMode) {
|
||||
getter.toString = () => `[LinkedSignal: ${getter()}]`;
|
||||
getter[SIGNAL].debugName = debugName;
|
||||
}
|
||||
const node = getter[SIGNAL];
|
||||
const upgradedGetter = getter;
|
||||
upgradedGetter.set = newValue => linkedSignalSetFn(node, newValue);
|
||||
upgradedGetter.update = updateFn => linkedSignalUpdateFn(node, updateFn);
|
||||
upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
|
||||
return upgradedGetter;
|
||||
}
|
||||
|
||||
function resource(options) {
|
||||
if (ngDevMode && !options?.injector) {
|
||||
assertInInjectionContext(resource);
|
||||
}
|
||||
const oldNameForParams = options.request;
|
||||
const params = options.params ?? oldNameForParams ?? (() => null);
|
||||
return new ResourceImpl(params, getLoader(options), options.defaultValue, options.equal ? wrapEqualityFn(options.equal) : undefined, options.debugName, options.injector ?? inject(Injector));
|
||||
}
|
||||
class BaseWritableResource {
|
||||
value;
|
||||
isLoading;
|
||||
constructor(value, debugName) {
|
||||
this.value = value;
|
||||
this.value.set = this.set.bind(this);
|
||||
this.value.update = this.update.bind(this);
|
||||
this.value.asReadonly = signalAsReadonlyFn;
|
||||
this.isLoading = computed(() => this.status() === 'loading' || this.status() === 'reloading', ngDevMode ? createDebugNameObject(debugName, 'isLoading') : undefined);
|
||||
}
|
||||
isError = computed(() => this.status() === 'error');
|
||||
update(updateFn) {
|
||||
this.set(updateFn(untracked(this.value)));
|
||||
}
|
||||
isValueDefined = computed(() => {
|
||||
if (this.isError()) {
|
||||
return false;
|
||||
}
|
||||
return this.value() !== undefined;
|
||||
});
|
||||
_snapshot;
|
||||
get snapshot() {
|
||||
return this._snapshot ??= computed(() => {
|
||||
const status = this.status();
|
||||
if (status === 'error') {
|
||||
return {
|
||||
status: 'error',
|
||||
error: this.error()
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
status,
|
||||
value: this.value()
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
hasValue() {
|
||||
return this.isValueDefined();
|
||||
}
|
||||
asReadonly() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ResourceImpl extends BaseWritableResource {
|
||||
loaderFn;
|
||||
equal;
|
||||
debugName;
|
||||
pendingTasks;
|
||||
state;
|
||||
extRequest;
|
||||
effectRef;
|
||||
pendingController;
|
||||
resolvePendingTask = undefined;
|
||||
destroyed = false;
|
||||
unregisterOnDestroy;
|
||||
status;
|
||||
error;
|
||||
constructor(request, loaderFn, defaultValue, equal, debugName, injector, getInitialStream) {
|
||||
super(computed(() => {
|
||||
const streamValue = this.state().stream?.();
|
||||
if (!streamValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (this.state().status === 'loading' && this.error()) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (!isResolved(streamValue)) {
|
||||
throw new ResourceValueError(this.error());
|
||||
}
|
||||
return streamValue.value;
|
||||
}, {
|
||||
equal,
|
||||
...(ngDevMode ? createDebugNameObject(debugName, 'value') : undefined)
|
||||
}), debugName);
|
||||
this.loaderFn = loaderFn;
|
||||
this.equal = equal;
|
||||
this.debugName = debugName;
|
||||
this.extRequest = linkedSignal({
|
||||
source: request,
|
||||
computation: request => ({
|
||||
request,
|
||||
reload: 0
|
||||
}),
|
||||
...(ngDevMode ? createDebugNameObject(debugName, 'extRequest') : undefined)
|
||||
});
|
||||
this.state = linkedSignal({
|
||||
source: this.extRequest,
|
||||
computation: (extRequest, previous) => {
|
||||
if (!previous) {
|
||||
const initialStream = getInitialStream?.(extRequest.request);
|
||||
getInitialStream = undefined;
|
||||
const status = extRequest.request === undefined ? 'idle' : initialStream ? 'resolved' : 'loading';
|
||||
return {
|
||||
extRequest,
|
||||
status,
|
||||
previousStatus: 'idle',
|
||||
stream: initialStream
|
||||
};
|
||||
} else {
|
||||
const status = extRequest.request === undefined ? 'idle' : 'loading';
|
||||
return {
|
||||
extRequest,
|
||||
status,
|
||||
previousStatus: projectStatusOfState(previous.value),
|
||||
stream: previous.value.extRequest.request === extRequest.request ? previous.value.stream : undefined
|
||||
};
|
||||
}
|
||||
},
|
||||
...(ngDevMode ? createDebugNameObject(debugName, 'state') : undefined)
|
||||
});
|
||||
this.effectRef = effect(this.loadEffect.bind(this), {
|
||||
injector,
|
||||
manualCleanup: true,
|
||||
...(ngDevMode ? createDebugNameObject(debugName, 'loadEffect') : undefined)
|
||||
});
|
||||
this.pendingTasks = injector.get(PendingTasks);
|
||||
this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());
|
||||
this.status = computed(() => projectStatusOfState(this.state()), ngDevMode ? createDebugNameObject(debugName, 'status') : undefined);
|
||||
this.error = computed(() => {
|
||||
const stream = this.state().stream?.();
|
||||
return stream && !isResolved(stream) ? stream.error : undefined;
|
||||
}, ngDevMode ? createDebugNameObject(debugName, 'error') : undefined);
|
||||
}
|
||||
set(value) {
|
||||
if (this.destroyed) {
|
||||
return;
|
||||
}
|
||||
const error = untracked(this.error);
|
||||
const state = untracked(this.state);
|
||||
if (!error) {
|
||||
const current = untracked(this.value);
|
||||
if (state.status === 'local' && (this.equal ? this.equal(current, value) : current === value)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.state.set({
|
||||
extRequest: state.extRequest,
|
||||
status: 'local',
|
||||
previousStatus: 'local',
|
||||
stream: signal({
|
||||
value
|
||||
}, ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined)
|
||||
});
|
||||
this.abortInProgressLoad();
|
||||
}
|
||||
reload() {
|
||||
const {
|
||||
status
|
||||
} = untracked(this.state);
|
||||
if (status === 'idle' || status === 'loading') {
|
||||
return false;
|
||||
}
|
||||
this.extRequest.update(({
|
||||
request,
|
||||
reload
|
||||
}) => ({
|
||||
request,
|
||||
reload: reload + 1
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
this.unregisterOnDestroy();
|
||||
this.effectRef.destroy();
|
||||
this.abortInProgressLoad();
|
||||
this.state.set({
|
||||
extRequest: {
|
||||
request: undefined,
|
||||
reload: 0
|
||||
},
|
||||
status: 'idle',
|
||||
previousStatus: 'idle',
|
||||
stream: undefined
|
||||
});
|
||||
}
|
||||
async loadEffect() {
|
||||
const extRequest = this.extRequest();
|
||||
const {
|
||||
status: currentStatus,
|
||||
previousStatus
|
||||
} = untracked(this.state);
|
||||
if (extRequest.request === undefined) {
|
||||
return;
|
||||
} else if (currentStatus !== 'loading') {
|
||||
return;
|
||||
}
|
||||
this.abortInProgressLoad();
|
||||
let resolvePendingTask = this.resolvePendingTask = this.pendingTasks.add();
|
||||
const {
|
||||
signal: abortSignal
|
||||
} = this.pendingController = new AbortController();
|
||||
try {
|
||||
const stream = await untracked(() => {
|
||||
return this.loaderFn({
|
||||
params: extRequest.request,
|
||||
request: extRequest.request,
|
||||
abortSignal,
|
||||
previous: {
|
||||
status: previousStatus
|
||||
}
|
||||
});
|
||||
});
|
||||
if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {
|
||||
return;
|
||||
}
|
||||
this.state.set({
|
||||
extRequest,
|
||||
status: 'resolved',
|
||||
previousStatus: 'resolved',
|
||||
stream
|
||||
});
|
||||
} catch (err) {
|
||||
if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {
|
||||
return;
|
||||
}
|
||||
this.state.set({
|
||||
extRequest,
|
||||
status: 'resolved',
|
||||
previousStatus: 'error',
|
||||
stream: signal({
|
||||
error: encapsulateResourceError(err)
|
||||
}, ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined)
|
||||
});
|
||||
} finally {
|
||||
resolvePendingTask?.();
|
||||
resolvePendingTask = undefined;
|
||||
}
|
||||
}
|
||||
abortInProgressLoad() {
|
||||
untracked(() => this.pendingController?.abort());
|
||||
this.pendingController = undefined;
|
||||
this.resolvePendingTask?.();
|
||||
this.resolvePendingTask = undefined;
|
||||
}
|
||||
}
|
||||
function wrapEqualityFn(equal) {
|
||||
return (a, b) => a === undefined || b === undefined ? a === b : equal(a, b);
|
||||
}
|
||||
function getLoader(options) {
|
||||
if (isStreamingResourceOptions(options)) {
|
||||
return options.stream;
|
||||
}
|
||||
return async params => {
|
||||
try {
|
||||
return signal({
|
||||
value: await options.loader(params)
|
||||
}, ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined);
|
||||
} catch (err) {
|
||||
return signal({
|
||||
error: encapsulateResourceError(err)
|
||||
}, ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined);
|
||||
}
|
||||
};
|
||||
}
|
||||
function isStreamingResourceOptions(options) {
|
||||
return !!options.stream;
|
||||
}
|
||||
function projectStatusOfState(state) {
|
||||
switch (state.status) {
|
||||
case 'loading':
|
||||
return state.extRequest.reload === 0 ? 'loading' : 'reloading';
|
||||
case 'resolved':
|
||||
return isResolved(state.stream()) ? 'resolved' : 'error';
|
||||
default:
|
||||
return state.status;
|
||||
}
|
||||
}
|
||||
function isResolved(state) {
|
||||
return state.error === undefined;
|
||||
}
|
||||
function createDebugNameObject(resourceDebugName, internalSignalDebugName) {
|
||||
return {
|
||||
debugName: `Resource${resourceDebugName ? '#' + resourceDebugName : ''}.${internalSignalDebugName}`
|
||||
};
|
||||
}
|
||||
function encapsulateResourceError(error) {
|
||||
if (isErrorLike(error)) {
|
||||
return error;
|
||||
}
|
||||
return new ResourceWrappedError(error);
|
||||
}
|
||||
function isErrorLike(error) {
|
||||
return error instanceof Error || typeof error === 'object' && typeof error.name === 'string' && typeof error.message === 'string';
|
||||
}
|
||||
class ResourceValueError extends Error {
|
||||
constructor(error) {
|
||||
super(ngDevMode ? `Resource is currently in an error state (see Error.cause for details): ${error.message}` : error.message, {
|
||||
cause: error
|
||||
});
|
||||
}
|
||||
}
|
||||
class ResourceWrappedError extends Error {
|
||||
constructor(error) {
|
||||
super(ngDevMode ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.` : String(error), {
|
||||
cause: error
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { OutputEmitterRef, ResourceImpl, ResourceValueError, computed, encapsulateResourceError, getOutputDestroyRef, linkedSignal, resource, untracked };
|
||||
//# sourceMappingURL=_resource-chunk.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+99
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { SIGNAL, runPostProducerCreatedFn, producerUpdateValueVersion, signalSetFn, producerMarkClean, ERRORED, signalUpdateFn, REACTIVE_NODE, UNSET, defaultEquals, COMPUTING, consumerBeforeComputation, consumerAfterComputation, producerAccessed, setActiveConsumer } from './_effect-chunk.mjs';
|
||||
|
||||
function createLinkedSignal(sourceFn, computationFn, equalityFn) {
|
||||
const node = Object.create(LINKED_SIGNAL_NODE);
|
||||
node.source = sourceFn;
|
||||
node.computation = computationFn;
|
||||
if (equalityFn != undefined) {
|
||||
node.equal = equalityFn;
|
||||
}
|
||||
const linkedSignalGetter = () => {
|
||||
producerUpdateValueVersion(node);
|
||||
producerAccessed(node);
|
||||
if (node.value === ERRORED) {
|
||||
throw node.error;
|
||||
}
|
||||
return node.value;
|
||||
};
|
||||
const getter = linkedSignalGetter;
|
||||
getter[SIGNAL] = node;
|
||||
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
||||
const debugName = node.debugName ? ' (' + node.debugName + ')' : '';
|
||||
getter.toString = () => `[LinkedSignal${debugName}: ${String(node.value)}]`;
|
||||
}
|
||||
runPostProducerCreatedFn(node);
|
||||
return getter;
|
||||
}
|
||||
function linkedSignalSetFn(node, newValue) {
|
||||
producerUpdateValueVersion(node);
|
||||
signalSetFn(node, newValue);
|
||||
producerMarkClean(node);
|
||||
}
|
||||
function linkedSignalUpdateFn(node, updater) {
|
||||
producerUpdateValueVersion(node);
|
||||
if (node.value === ERRORED) {
|
||||
throw node.error;
|
||||
}
|
||||
signalUpdateFn(node, updater);
|
||||
producerMarkClean(node);
|
||||
}
|
||||
const LINKED_SIGNAL_NODE = /* @__PURE__ */(() => {
|
||||
return {
|
||||
...REACTIVE_NODE,
|
||||
value: UNSET,
|
||||
dirty: true,
|
||||
error: null,
|
||||
equal: defaultEquals,
|
||||
kind: 'linkedSignal',
|
||||
producerMustRecompute(node) {
|
||||
return node.value === UNSET || node.value === COMPUTING;
|
||||
},
|
||||
producerRecomputeValue(node) {
|
||||
if (node.value === COMPUTING) {
|
||||
throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '');
|
||||
}
|
||||
const oldValue = node.value;
|
||||
node.value = COMPUTING;
|
||||
const prevConsumer = consumerBeforeComputation(node);
|
||||
let newValue;
|
||||
try {
|
||||
const newSourceValue = node.source();
|
||||
const prev = oldValue === UNSET || oldValue === ERRORED ? undefined : {
|
||||
source: node.sourceValue,
|
||||
value: oldValue
|
||||
};
|
||||
newValue = node.computation(newSourceValue, prev);
|
||||
node.sourceValue = newSourceValue;
|
||||
} catch (err) {
|
||||
newValue = ERRORED;
|
||||
node.error = err;
|
||||
} finally {
|
||||
consumerAfterComputation(node, prevConsumer);
|
||||
}
|
||||
if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
|
||||
node.value = oldValue;
|
||||
return;
|
||||
}
|
||||
node.value = newValue;
|
||||
node.version++;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
function untracked(nonReactiveReadsFn) {
|
||||
const prevConsumer = setActiveConsumer(null);
|
||||
try {
|
||||
return nonReactiveReadsFn();
|
||||
} finally {
|
||||
setActiveConsumer(prevConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
export { createLinkedSignal, linkedSignalSetFn, linkedSignalUpdateFn, untracked };
|
||||
//# sourceMappingURL=_untracked-chunk.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
function setAlternateWeakRefImpl(impl) {}
|
||||
|
||||
export { setAlternateWeakRefImpl };
|
||||
//# sourceMappingURL=_weak_ref-chunk.mjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_weak_ref-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/weak_ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport function setAlternateWeakRefImpl(impl: unknown) {\n // TODO: remove this function\n}\n"],"names":["setAlternateWeakRefImpl","impl"],"mappings":";;;;;;AAQM,SAAUA,uBAAuBA,CAACC,IAAa,EAAA;;;;"}
|
||||
+2952
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
export { NOT_FOUND, NotFoundError, getCurrentInjector, inject, isNotFound, setCurrentInjector } from './_not_found-chunk.mjs';
|
||||
|
||||
function defineInjectable(opts) {
|
||||
return {
|
||||
token: opts.token,
|
||||
providedIn: opts.providedIn || null,
|
||||
factory: opts.factory,
|
||||
value: undefined
|
||||
};
|
||||
}
|
||||
function registerInjectable(ctor, declaration) {
|
||||
ctor.ɵprov = declaration;
|
||||
return ctor;
|
||||
}
|
||||
|
||||
export { defineInjectable, registerInjectable };
|
||||
//# sourceMappingURL=primitives-di.mjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"primitives-di.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injection_token.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Type} from './type';\n/**\n * Information about how a type or `InjectionToken` interfaces with the DI\n * system. This describes:\n *\n * 1. *How* the type is provided\n * The declaration must specify only one of the following:\n * - A `value` which is a predefined instance of the type.\n * - A `factory` which defines how to create the given type `T`, possibly\n * requesting injection of other types if necessary.\n * - Neither, in which case the type is expected to already be present in the\n * injector hierarchy. This is used for internal use cases.\n *\n * 2. *Where* the type is stored (if it is stored)\n * - The `providedIn` parameter specifies which injector the type belongs to.\n * - The `token` is used as the key to store the type in the injector.\n */\nexport interface ɵɵInjectableDeclaration<T> {\n /**\n * Specifies that the given type belongs to a particular `Injector`,\n * `NgModule`, or a special scope (e.g. `'root'`).\n *\n * `any` is deprecated and will be removed soon.\n *\n * A value of `null` indicates that the injectable does not belong to any\n * scope, and won't be stored in any injector. For declarations with a\n * factory, this will create a new instance of the type each time it is\n * requested.\n */\n providedIn: Type<any> | 'root' | 'platform' | 'any' | null;\n\n /**\n * The token to which this definition belongs.\n *\n * Note that this may not be the same as the type that the `factory` will create.\n */\n token: unknown;\n\n /**\n * Factory method to execute to create an instance of the injectable.\n */\n factory?: (t?: Type<any>) => T;\n\n /**\n * In a case of no explicit injector, a location where the instance of the injectable is stored.\n */\n value?: T;\n}\n\n/**\n * A `Type` which has a `ɵprov: ɵɵInjectableDeclaration` static field.\n *\n * `InjectableType`s contain their own Dependency Injection metadata and are usable in an\n * `InjectorDef`-based `StaticInjector`.\n *\n * @publicApi\n */\nexport interface InjectionToken<T> {\n ɵprov: ɵɵInjectableDeclaration<T>;\n}\n\nexport function defineInjectable<T>(opts: {\n token: unknown;\n providedIn?: Type<any> | 'root' | 'platform' | 'any' | 'environment' | null;\n factory: () => T;\n}): ɵɵInjectableDeclaration<T> {\n return {\n token: opts.token,\n providedIn: (opts.providedIn as any) || null,\n factory: opts.factory,\n value: undefined,\n } as ɵɵInjectableDeclaration<T>;\n}\n\nexport type Constructor<T> = Function & {prototype: T};\n\nexport function registerInjectable<T>(\n ctor: unknown,\n declaration: ɵɵInjectableDeclaration<T>,\n): InjectionToken<T> {\n (ctor as unknown as InjectionToken<T>).ɵprov = declaration;\n return ctor as Constructor<T> & InjectionToken<T>;\n}\n"],"names":["defineInjectable","opts","token","providedIn","factory","value","undefined","registerInjectable","ctor","declaration","ɵprov"],"mappings":";;;;;;;;AAqEM,SAAUA,gBAAgBA,CAAIC,IAInC,EAAA;EACC,OAAO;IACLC,KAAK,EAAED,IAAI,CAACC,KAAK;AACjBC,IAAAA,UAAU,EAAGF,IAAI,CAACE,UAAkB,IAAI,IAAI;IAC5CC,OAAO,EAAEH,IAAI,CAACG,OAAO;AACrBC,IAAAA,KAAK,EAAEC;GACsB;AACjC;AAIgB,SAAAC,kBAAkBA,CAChCC,IAAa,EACbC,WAAuC,EAAA;EAEtCD,IAAqC,CAACE,KAAK,GAAGD,WAAW;AAC1D,EAAA,OAAOD,IAA0C;AACnD;;;;"}
|
||||
+788
@@ -0,0 +1,788 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { Attribute } from './_attribute-chunk.mjs';
|
||||
|
||||
const Property = {
|
||||
JSACTION: '__jsaction',
|
||||
OWNER: '__owner'
|
||||
};
|
||||
|
||||
const parseCache = {};
|
||||
function get(element) {
|
||||
return element[Property.JSACTION];
|
||||
}
|
||||
function getDefaulted(element) {
|
||||
const cache = get(element) ?? {};
|
||||
set(element, cache);
|
||||
return cache;
|
||||
}
|
||||
function set(element, actionMap) {
|
||||
element[Property.JSACTION] = actionMap;
|
||||
}
|
||||
function getParsed(text) {
|
||||
return parseCache[text];
|
||||
}
|
||||
function setParsed(text, parsed) {
|
||||
parseCache[text] = parsed;
|
||||
}
|
||||
|
||||
const EventType = {
|
||||
AUXCLICK: 'auxclick',
|
||||
CHANGE: 'change',
|
||||
CLICK: 'click',
|
||||
CLICKMOD: 'clickmod',
|
||||
CLICKONLY: 'clickonly',
|
||||
DBLCLICK: 'dblclick',
|
||||
FOCUS: 'focus',
|
||||
FOCUSIN: 'focusin',
|
||||
BLUR: 'blur',
|
||||
FOCUSOUT: 'focusout',
|
||||
SUBMIT: 'submit',
|
||||
KEYDOWN: 'keydown',
|
||||
KEYPRESS: 'keypress',
|
||||
KEYUP: 'keyup',
|
||||
MOUSEUP: 'mouseup',
|
||||
MOUSEDOWN: 'mousedown',
|
||||
MOUSEOVER: 'mouseover',
|
||||
MOUSEOUT: 'mouseout',
|
||||
MOUSEENTER: 'mouseenter',
|
||||
MOUSELEAVE: 'mouseleave',
|
||||
MOUSEMOVE: 'mousemove',
|
||||
POINTERUP: 'pointerup',
|
||||
POINTERDOWN: 'pointerdown',
|
||||
POINTEROVER: 'pointerover',
|
||||
POINTEROUT: 'pointerout',
|
||||
POINTERENTER: 'pointerenter',
|
||||
POINTERLEAVE: 'pointerleave',
|
||||
POINTERMOVE: 'pointermove',
|
||||
POINTERCANCEL: 'pointercancel',
|
||||
GOTPOINTERCAPTURE: 'gotpointercapture',
|
||||
LOSTPOINTERCAPTURE: 'lostpointercapture',
|
||||
ERROR: 'error',
|
||||
LOAD: 'load',
|
||||
UNLOAD: 'unload',
|
||||
TOUCHSTART: 'touchstart',
|
||||
TOUCHEND: 'touchend',
|
||||
TOUCHMOVE: 'touchmove',
|
||||
INPUT: 'input',
|
||||
SCROLL: 'scroll',
|
||||
TOGGLE: 'toggle',
|
||||
CUSTOM: '_custom'
|
||||
};
|
||||
const MOUSE_SPECIAL_EVENT_TYPES = [EventType.MOUSEENTER, EventType.MOUSELEAVE, 'pointerenter', 'pointerleave'];
|
||||
const BUBBLE_EVENT_TYPES = [EventType.CLICK, EventType.DBLCLICK, EventType.FOCUSIN, EventType.FOCUSOUT, EventType.KEYDOWN, EventType.KEYUP, EventType.KEYPRESS, EventType.MOUSEOVER, EventType.MOUSEOUT, EventType.SUBMIT, EventType.TOUCHSTART, EventType.TOUCHEND, EventType.TOUCHMOVE, 'touchcancel', 'auxclick', 'change', 'compositionstart', 'compositionupdate', 'compositionend', 'beforeinput', 'input', 'select', 'copy', 'cut', 'paste', 'mousedown', 'mouseup', 'wheel', 'contextmenu', 'dragover', 'dragenter', 'dragleave', 'drop', 'dragstart', 'dragend', 'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'pointerover', 'pointerout', 'gotpointercapture', 'lostpointercapture', 'ended', 'loadedmetadata', 'pagehide', 'pageshow', 'visibilitychange', 'beforematch'];
|
||||
const CAPTURE_EVENT_TYPES = [EventType.FOCUS, EventType.BLUR, EventType.ERROR, EventType.LOAD, EventType.TOGGLE];
|
||||
const isCaptureEventType = eventType => CAPTURE_EVENT_TYPES.indexOf(eventType) >= 0;
|
||||
const EARLY_EVENT_TYPES = BUBBLE_EVENT_TYPES.concat(CAPTURE_EVENT_TYPES);
|
||||
const isEarlyEventType = eventType => EARLY_EVENT_TYPES.indexOf(eventType) >= 0;
|
||||
|
||||
function getBrowserEventType(eventType) {
|
||||
if (eventType === EventType.MOUSEENTER) {
|
||||
return EventType.MOUSEOVER;
|
||||
} else if (eventType === EventType.MOUSELEAVE) {
|
||||
return EventType.MOUSEOUT;
|
||||
} else if (eventType === EventType.POINTERENTER) {
|
||||
return EventType.POINTEROVER;
|
||||
} else if (eventType === EventType.POINTERLEAVE) {
|
||||
return EventType.POINTEROUT;
|
||||
}
|
||||
return eventType;
|
||||
}
|
||||
function addEventListener(element, eventType, handler, passive) {
|
||||
let capture = false;
|
||||
if (isCaptureEventType(eventType)) {
|
||||
capture = true;
|
||||
}
|
||||
const options = typeof passive === 'boolean' ? {
|
||||
capture,
|
||||
passive
|
||||
} : capture;
|
||||
element.addEventListener(eventType, handler, options);
|
||||
return {
|
||||
eventType,
|
||||
handler,
|
||||
capture,
|
||||
passive
|
||||
};
|
||||
}
|
||||
function removeEventListener(element, info) {
|
||||
if (element.removeEventListener) {
|
||||
const options = typeof info.passive === 'boolean' ? {
|
||||
capture: info.capture
|
||||
} : info.capture;
|
||||
element.removeEventListener(info.eventType, info.handler, options);
|
||||
} else if (element.detachEvent) {
|
||||
element.detachEvent(`on${info.eventType}`, info.handler);
|
||||
}
|
||||
}
|
||||
function preventDefault(e) {
|
||||
e.preventDefault ? e.preventDefault() : e.returnValue = false;
|
||||
}
|
||||
let isMac = typeof navigator !== 'undefined' && /Macintosh/.test(navigator.userAgent);
|
||||
function isMiddleClick(e) {
|
||||
return (e.which === 2 || e.which == null && e.button === 4
|
||||
);
|
||||
}
|
||||
function isModifiedClickEvent(e) {
|
||||
return (isMac && e.metaKey || !isMac && e.ctrlKey || isMiddleClick(e) || e.shiftKey
|
||||
);
|
||||
}
|
||||
function isMouseSpecialEvent(e, type, element) {
|
||||
const related = e.relatedTarget;
|
||||
return (e.type === EventType.MOUSEOVER && type === EventType.MOUSEENTER || e.type === EventType.MOUSEOUT && type === EventType.MOUSELEAVE || e.type === EventType.POINTEROVER && type === EventType.POINTERENTER || e.type === EventType.POINTEROUT && type === EventType.POINTERLEAVE) && (!related || related !== element && !element.contains(related));
|
||||
}
|
||||
function createMouseSpecialEvent(e, target) {
|
||||
const copy = {};
|
||||
for (const property in e) {
|
||||
if (property === 'srcElement' || property === 'target') {
|
||||
continue;
|
||||
}
|
||||
const key = property;
|
||||
const value = e[key];
|
||||
if (typeof value === 'function') {
|
||||
continue;
|
||||
}
|
||||
copy[key] = value;
|
||||
}
|
||||
if (e.type === EventType.MOUSEOVER) {
|
||||
copy['type'] = EventType.MOUSEENTER;
|
||||
} else if (e.type === EventType.MOUSEOUT) {
|
||||
copy['type'] = EventType.MOUSELEAVE;
|
||||
} else if (e.type === EventType.POINTEROVER) {
|
||||
copy['type'] = EventType.POINTERENTER;
|
||||
} else {
|
||||
copy['type'] = EventType.POINTERLEAVE;
|
||||
}
|
||||
copy['target'] = copy['srcElement'] = target;
|
||||
copy['bubbles'] = false;
|
||||
copy['_originalEvent'] = e;
|
||||
return copy;
|
||||
}
|
||||
|
||||
const isIos = typeof navigator !== 'undefined' && /iPhone|iPad|iPod/.test(navigator.userAgent);
|
||||
class EventContractContainer {
|
||||
element;
|
||||
handlerInfos = [];
|
||||
constructor(element) {
|
||||
this.element = element;
|
||||
}
|
||||
addEventListener(eventType, getHandler, passive) {
|
||||
if (isIos) {
|
||||
this.element.style.cursor = 'pointer';
|
||||
}
|
||||
this.handlerInfos.push(addEventListener(this.element, eventType, getHandler(this.element), passive));
|
||||
}
|
||||
cleanUp() {
|
||||
for (let i = 0; i < this.handlerInfos.length; i++) {
|
||||
removeEventListener(this.element, this.handlerInfos[i]);
|
||||
}
|
||||
this.handlerInfos = [];
|
||||
}
|
||||
}
|
||||
|
||||
const Char = {
|
||||
NAMESPACE_ACTION_SEPARATOR: '.',
|
||||
EVENT_ACTION_SEPARATOR: ':'
|
||||
};
|
||||
|
||||
function getEventType(eventInfo) {
|
||||
return eventInfo.eventType;
|
||||
}
|
||||
function setEventType(eventInfo, eventType) {
|
||||
eventInfo.eventType = eventType;
|
||||
}
|
||||
function getEvent(eventInfo) {
|
||||
return eventInfo.event;
|
||||
}
|
||||
function setEvent(eventInfo, event) {
|
||||
eventInfo.event = event;
|
||||
}
|
||||
function getTargetElement(eventInfo) {
|
||||
return eventInfo.targetElement;
|
||||
}
|
||||
function setTargetElement(eventInfo, targetElement) {
|
||||
eventInfo.targetElement = targetElement;
|
||||
}
|
||||
function getContainer(eventInfo) {
|
||||
return eventInfo.eic;
|
||||
}
|
||||
function setContainer(eventInfo, container) {
|
||||
eventInfo.eic = container;
|
||||
}
|
||||
function getTimestamp(eventInfo) {
|
||||
return eventInfo.timeStamp;
|
||||
}
|
||||
function setTimestamp(eventInfo, timestamp) {
|
||||
eventInfo.timeStamp = timestamp;
|
||||
}
|
||||
function getAction(eventInfo) {
|
||||
return eventInfo.eia;
|
||||
}
|
||||
function setAction(eventInfo, actionName, actionElement) {
|
||||
eventInfo.eia = [actionName, actionElement];
|
||||
}
|
||||
function unsetAction(eventInfo) {
|
||||
eventInfo.eia = undefined;
|
||||
}
|
||||
function getActionElement(actionInfo) {
|
||||
return actionInfo[1];
|
||||
}
|
||||
function getIsReplay(eventInfo) {
|
||||
return eventInfo.eirp;
|
||||
}
|
||||
function setIsReplay(eventInfo, replay) {
|
||||
eventInfo.eirp = replay;
|
||||
}
|
||||
function getResolved(eventInfo) {
|
||||
return eventInfo.eir;
|
||||
}
|
||||
function setResolved(eventInfo, resolved) {
|
||||
eventInfo.eir = resolved;
|
||||
}
|
||||
function cloneEventInfo(eventInfo) {
|
||||
return {
|
||||
eventType: eventInfo.eventType,
|
||||
event: eventInfo.event,
|
||||
targetElement: eventInfo.targetElement,
|
||||
eic: eventInfo.eic,
|
||||
eia: eventInfo.eia,
|
||||
timeStamp: eventInfo.timeStamp,
|
||||
eirp: eventInfo.eirp,
|
||||
eiack: eventInfo.eiack,
|
||||
eir: eventInfo.eir
|
||||
};
|
||||
}
|
||||
function createEventInfoFromParameters(eventType, event, targetElement, container, timestamp, action, isReplay, a11yClickKey) {
|
||||
return {
|
||||
eventType,
|
||||
event,
|
||||
targetElement,
|
||||
eic: container,
|
||||
timeStamp: timestamp,
|
||||
eia: action,
|
||||
eirp: isReplay,
|
||||
eiack: a11yClickKey
|
||||
};
|
||||
}
|
||||
class EventInfoWrapper {
|
||||
eventInfo;
|
||||
constructor(eventInfo) {
|
||||
this.eventInfo = eventInfo;
|
||||
}
|
||||
getEventType() {
|
||||
return getEventType(this.eventInfo);
|
||||
}
|
||||
setEventType(eventType) {
|
||||
setEventType(this.eventInfo, eventType);
|
||||
}
|
||||
getEvent() {
|
||||
return getEvent(this.eventInfo);
|
||||
}
|
||||
setEvent(event) {
|
||||
setEvent(this.eventInfo, event);
|
||||
}
|
||||
getTargetElement() {
|
||||
return getTargetElement(this.eventInfo);
|
||||
}
|
||||
setTargetElement(targetElement) {
|
||||
setTargetElement(this.eventInfo, targetElement);
|
||||
}
|
||||
getContainer() {
|
||||
return getContainer(this.eventInfo);
|
||||
}
|
||||
setContainer(container) {
|
||||
setContainer(this.eventInfo, container);
|
||||
}
|
||||
getTimestamp() {
|
||||
return getTimestamp(this.eventInfo);
|
||||
}
|
||||
setTimestamp(timestamp) {
|
||||
setTimestamp(this.eventInfo, timestamp);
|
||||
}
|
||||
getAction() {
|
||||
const action = getAction(this.eventInfo);
|
||||
if (!action) return undefined;
|
||||
return {
|
||||
name: action[0],
|
||||
element: action[1]
|
||||
};
|
||||
}
|
||||
setAction(action) {
|
||||
if (!action) {
|
||||
unsetAction(this.eventInfo);
|
||||
return;
|
||||
}
|
||||
setAction(this.eventInfo, action.name, action.element);
|
||||
}
|
||||
getIsReplay() {
|
||||
return getIsReplay(this.eventInfo);
|
||||
}
|
||||
setIsReplay(replay) {
|
||||
setIsReplay(this.eventInfo, replay);
|
||||
}
|
||||
getResolved() {
|
||||
return getResolved(this.eventInfo);
|
||||
}
|
||||
setResolved(resolved) {
|
||||
setResolved(this.eventInfo, resolved);
|
||||
}
|
||||
clone() {
|
||||
return new EventInfoWrapper(cloneEventInfo(this.eventInfo));
|
||||
}
|
||||
}
|
||||
|
||||
const EMPTY_ACTION_MAP = {};
|
||||
const REGEXP_SEMICOLON = /\s*;\s*/;
|
||||
const DEFAULT_EVENT_TYPE = EventType.CLICK;
|
||||
class ActionResolver {
|
||||
a11yClickSupport = false;
|
||||
clickModSupport = true;
|
||||
syntheticMouseEventSupport;
|
||||
updateEventInfoForA11yClick = undefined;
|
||||
preventDefaultForA11yClick = undefined;
|
||||
populateClickOnlyAction = undefined;
|
||||
constructor({
|
||||
syntheticMouseEventSupport = false,
|
||||
clickModSupport = true
|
||||
} = {}) {
|
||||
this.syntheticMouseEventSupport = syntheticMouseEventSupport;
|
||||
this.clickModSupport = clickModSupport;
|
||||
}
|
||||
resolveEventType(eventInfo) {
|
||||
if (this.clickModSupport && getEventType(eventInfo) === EventType.CLICK && isModifiedClickEvent(getEvent(eventInfo))) {
|
||||
setEventType(eventInfo, EventType.CLICKMOD);
|
||||
} else if (this.a11yClickSupport) {
|
||||
this.updateEventInfoForA11yClick(eventInfo);
|
||||
}
|
||||
}
|
||||
resolveAction(eventInfo) {
|
||||
if (getResolved(eventInfo)) {
|
||||
return;
|
||||
}
|
||||
this.populateAction(eventInfo, getTargetElement(eventInfo));
|
||||
setResolved(eventInfo, true);
|
||||
}
|
||||
resolveParentAction(eventInfo) {
|
||||
const action = getAction(eventInfo);
|
||||
const actionElement = action && getActionElement(action);
|
||||
unsetAction(eventInfo);
|
||||
const parentNode = actionElement && this.getParentNode(actionElement);
|
||||
if (!parentNode) {
|
||||
return;
|
||||
}
|
||||
this.populateAction(eventInfo, parentNode);
|
||||
}
|
||||
populateAction(eventInfo, currentTarget) {
|
||||
let actionElement = currentTarget;
|
||||
while (actionElement && actionElement !== getContainer(eventInfo)) {
|
||||
if (actionElement.nodeType === Node.ELEMENT_NODE) {
|
||||
this.populateActionOnElement(actionElement, eventInfo);
|
||||
}
|
||||
if (getAction(eventInfo)) {
|
||||
break;
|
||||
}
|
||||
actionElement = this.getParentNode(actionElement);
|
||||
}
|
||||
const action = getAction(eventInfo);
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
if (this.a11yClickSupport) {
|
||||
this.preventDefaultForA11yClick(eventInfo);
|
||||
}
|
||||
if (this.syntheticMouseEventSupport) {
|
||||
if (getEventType(eventInfo) === EventType.MOUSEENTER || getEventType(eventInfo) === EventType.MOUSELEAVE || getEventType(eventInfo) === EventType.POINTERENTER || getEventType(eventInfo) === EventType.POINTERLEAVE) {
|
||||
if (isMouseSpecialEvent(getEvent(eventInfo), getEventType(eventInfo), getActionElement(action))) {
|
||||
const copiedEvent = createMouseSpecialEvent(getEvent(eventInfo), getActionElement(action));
|
||||
setEvent(eventInfo, copiedEvent);
|
||||
setTargetElement(eventInfo, getActionElement(action));
|
||||
} else {
|
||||
unsetAction(eventInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getParentNode(element) {
|
||||
const owner = element[Property.OWNER];
|
||||
if (owner) {
|
||||
return owner;
|
||||
}
|
||||
const parentNode = element.parentNode;
|
||||
if (parentNode?.nodeName === '#document-fragment') {
|
||||
return parentNode?.host ?? null;
|
||||
}
|
||||
return parentNode;
|
||||
}
|
||||
populateActionOnElement(actionElement, eventInfo) {
|
||||
const actionMap = this.parseActions(actionElement);
|
||||
const actionName = actionMap[getEventType(eventInfo)];
|
||||
if (actionName !== undefined) {
|
||||
setAction(eventInfo, actionName, actionElement);
|
||||
}
|
||||
if (this.a11yClickSupport) {
|
||||
this.populateClickOnlyAction(actionElement, eventInfo, actionMap);
|
||||
}
|
||||
}
|
||||
parseActions(actionElement) {
|
||||
let actionMap = get(actionElement);
|
||||
if (!actionMap) {
|
||||
const jsactionAttribute = actionElement.getAttribute(Attribute.JSACTION);
|
||||
if (!jsactionAttribute) {
|
||||
actionMap = EMPTY_ACTION_MAP;
|
||||
set(actionElement, actionMap);
|
||||
} else {
|
||||
actionMap = getParsed(jsactionAttribute);
|
||||
if (!actionMap) {
|
||||
actionMap = {};
|
||||
const values = jsactionAttribute.split(REGEXP_SEMICOLON);
|
||||
for (let idx = 0; idx < values.length; idx++) {
|
||||
const value = values[idx];
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
const colon = value.indexOf(Char.EVENT_ACTION_SEPARATOR);
|
||||
const hasColon = colon !== -1;
|
||||
const type = hasColon ? value.substr(0, colon).trim() : DEFAULT_EVENT_TYPE;
|
||||
const action = hasColon ? value.substr(colon + 1).trim() : value;
|
||||
actionMap[type] = action;
|
||||
}
|
||||
setParsed(jsactionAttribute, actionMap);
|
||||
}
|
||||
set(actionElement, actionMap);
|
||||
}
|
||||
}
|
||||
return actionMap;
|
||||
}
|
||||
addA11yClickSupport(updateEventInfoForA11yClick, preventDefaultForA11yClick, populateClickOnlyAction) {
|
||||
this.a11yClickSupport = true;
|
||||
this.updateEventInfoForA11yClick = updateEventInfoForA11yClick;
|
||||
this.preventDefaultForA11yClick = preventDefaultForA11yClick;
|
||||
this.populateClickOnlyAction = populateClickOnlyAction;
|
||||
}
|
||||
}
|
||||
|
||||
var Restriction;
|
||||
(function (Restriction) {
|
||||
Restriction[Restriction["I_AM_THE_JSACTION_FRAMEWORK"] = 0] = "I_AM_THE_JSACTION_FRAMEWORK";
|
||||
})(Restriction || (Restriction = {}));
|
||||
|
||||
class Dispatcher {
|
||||
dispatchDelegate;
|
||||
actionResolver;
|
||||
eventReplayer;
|
||||
eventReplayScheduled = false;
|
||||
replayEventInfoWrappers = [];
|
||||
constructor(dispatchDelegate, {
|
||||
actionResolver,
|
||||
eventReplayer
|
||||
} = {}) {
|
||||
this.dispatchDelegate = dispatchDelegate;
|
||||
this.actionResolver = actionResolver;
|
||||
this.eventReplayer = eventReplayer;
|
||||
}
|
||||
dispatch(eventInfo) {
|
||||
const eventInfoWrapper = new EventInfoWrapper(eventInfo);
|
||||
this.actionResolver?.resolveEventType(eventInfo);
|
||||
this.actionResolver?.resolveAction(eventInfo);
|
||||
const action = eventInfoWrapper.getAction();
|
||||
if (action && shouldPreventDefaultBeforeDispatching(action.element, eventInfoWrapper)) {
|
||||
preventDefault(eventInfoWrapper.getEvent());
|
||||
}
|
||||
if (this.eventReplayer && eventInfoWrapper.getIsReplay()) {
|
||||
this.scheduleEventInfoWrapperReplay(eventInfoWrapper);
|
||||
return;
|
||||
}
|
||||
this.dispatchDelegate(eventInfoWrapper);
|
||||
}
|
||||
scheduleEventInfoWrapperReplay(eventInfoWrapper) {
|
||||
this.replayEventInfoWrappers.push(eventInfoWrapper);
|
||||
if (this.eventReplayScheduled) {
|
||||
return;
|
||||
}
|
||||
this.eventReplayScheduled = true;
|
||||
Promise.resolve().then(() => {
|
||||
this.eventReplayScheduled = false;
|
||||
this.eventReplayer(this.replayEventInfoWrappers);
|
||||
});
|
||||
}
|
||||
}
|
||||
function shouldPreventDefaultBeforeDispatching(actionElement, eventInfoWrapper) {
|
||||
return actionElement.tagName === 'A' && (eventInfoWrapper.getEventType() === EventType.CLICK || eventInfoWrapper.getEventType() === EventType.CLICKMOD);
|
||||
}
|
||||
|
||||
const PROPAGATION_STOPPED_SYMBOL = /* @__PURE__ */Symbol.for('propagationStopped');
|
||||
const EventPhase = {
|
||||
REPLAY: 101
|
||||
};
|
||||
const PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS = ' Because event replay occurs after browser dispatch, `preventDefault` would have no ' + 'effect. You can check whether an event is being replayed by accessing the event phase: ' + '`event.eventPhase === EventPhase.REPLAY`.';
|
||||
const PREVENT_DEFAULT_ERROR_MESSAGE = `\`preventDefault\` called during event replay.`;
|
||||
const COMPOSED_PATH_ERROR_MESSAGE_DETAILS = ' Because event replay occurs after browser ' + 'dispatch, `composedPath()` will be empty. Iterate parent nodes from `event.target` or ' + '`event.currentTarget` if you need to check elements in the event path.';
|
||||
const COMPOSED_PATH_ERROR_MESSAGE = `\`composedPath\` called during event replay.`;
|
||||
class EventDispatcher {
|
||||
dispatchDelegate;
|
||||
clickModSupport;
|
||||
actionResolver;
|
||||
dispatcher;
|
||||
constructor(dispatchDelegate, clickModSupport = true) {
|
||||
this.dispatchDelegate = dispatchDelegate;
|
||||
this.clickModSupport = clickModSupport;
|
||||
this.actionResolver = new ActionResolver({
|
||||
clickModSupport
|
||||
});
|
||||
this.dispatcher = new Dispatcher(eventInfoWrapper => {
|
||||
this.dispatchToDelegate(eventInfoWrapper);
|
||||
}, {
|
||||
actionResolver: this.actionResolver
|
||||
});
|
||||
}
|
||||
dispatch(eventInfo) {
|
||||
this.dispatcher.dispatch(eventInfo);
|
||||
}
|
||||
dispatchToDelegate(eventInfoWrapper) {
|
||||
if (eventInfoWrapper.getIsReplay()) {
|
||||
prepareEventForReplay(eventInfoWrapper);
|
||||
}
|
||||
prepareEventForBubbling(eventInfoWrapper);
|
||||
while (eventInfoWrapper.getAction()) {
|
||||
prepareEventForDispatch(eventInfoWrapper);
|
||||
if (isCaptureEventType(eventInfoWrapper.getEventType()) && eventInfoWrapper.getAction().element !== eventInfoWrapper.getTargetElement()) {
|
||||
return;
|
||||
}
|
||||
this.dispatchDelegate(eventInfoWrapper.getEvent(), eventInfoWrapper.getAction().name);
|
||||
if (propagationStopped(eventInfoWrapper)) {
|
||||
return;
|
||||
}
|
||||
this.actionResolver.resolveParentAction(eventInfoWrapper.eventInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
function prepareEventForBubbling(eventInfoWrapper) {
|
||||
const event = eventInfoWrapper.getEvent();
|
||||
const originalStopPropagation = eventInfoWrapper.getEvent().stopPropagation.bind(event);
|
||||
const stopPropagation = () => {
|
||||
event[PROPAGATION_STOPPED_SYMBOL] = true;
|
||||
originalStopPropagation();
|
||||
};
|
||||
patchEventInstance(event, 'stopPropagation', stopPropagation);
|
||||
patchEventInstance(event, 'stopImmediatePropagation', stopPropagation);
|
||||
}
|
||||
function propagationStopped(eventInfoWrapper) {
|
||||
const event = eventInfoWrapper.getEvent();
|
||||
return !!event[PROPAGATION_STOPPED_SYMBOL];
|
||||
}
|
||||
function prepareEventForReplay(eventInfoWrapper) {
|
||||
const event = eventInfoWrapper.getEvent();
|
||||
const target = eventInfoWrapper.getTargetElement();
|
||||
const originalPreventDefault = event.preventDefault.bind(event);
|
||||
patchEventInstance(event, 'target', target);
|
||||
patchEventInstance(event, 'eventPhase', EventPhase.REPLAY);
|
||||
patchEventInstance(event, 'preventDefault', () => {
|
||||
originalPreventDefault();
|
||||
throw new Error(PREVENT_DEFAULT_ERROR_MESSAGE + (ngDevMode ? PREVENT_DEFAULT_ERROR_MESSAGE_DETAILS : ''));
|
||||
});
|
||||
patchEventInstance(event, 'composedPath', () => {
|
||||
throw new Error(COMPOSED_PATH_ERROR_MESSAGE + (ngDevMode ? COMPOSED_PATH_ERROR_MESSAGE_DETAILS : ''));
|
||||
});
|
||||
}
|
||||
function prepareEventForDispatch(eventInfoWrapper) {
|
||||
const event = eventInfoWrapper.getEvent();
|
||||
const currentTarget = eventInfoWrapper.getAction()?.element;
|
||||
if (currentTarget) {
|
||||
patchEventInstance(event, 'currentTarget', currentTarget, {
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
function patchEventInstance(event, property, value, {
|
||||
configurable = false
|
||||
} = {}) {
|
||||
Object.defineProperty(event, property, {
|
||||
value,
|
||||
configurable
|
||||
});
|
||||
}
|
||||
function registerDispatcher$1(eventContract, dispatcher) {
|
||||
eventContract.ecrd(eventInfo => {
|
||||
dispatcher.dispatch(eventInfo);
|
||||
}, Restriction.I_AM_THE_JSACTION_FRAMEWORK);
|
||||
}
|
||||
|
||||
function createEarlyJsactionData(container) {
|
||||
const q = [];
|
||||
const d = eventInfo => {
|
||||
q.push(eventInfo);
|
||||
};
|
||||
const h = event => {
|
||||
d(createEventInfoFromParameters(event.type, event, event.target, container, Date.now()));
|
||||
};
|
||||
return {
|
||||
c: container,
|
||||
q,
|
||||
et: [],
|
||||
etc: [],
|
||||
d,
|
||||
h
|
||||
};
|
||||
}
|
||||
function addEvents(earlyJsactionData, types, capture) {
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
const eventType = types[i];
|
||||
const eventTypes = capture ? earlyJsactionData.etc : earlyJsactionData.et;
|
||||
eventTypes.push(eventType);
|
||||
earlyJsactionData.c.addEventListener(eventType, earlyJsactionData.h, capture);
|
||||
}
|
||||
}
|
||||
function getQueuedEventInfos(earlyJsactionData) {
|
||||
return earlyJsactionData?.q ?? [];
|
||||
}
|
||||
function registerDispatcher(earlyJsactionData, dispatcher) {
|
||||
if (!earlyJsactionData) {
|
||||
return;
|
||||
}
|
||||
earlyJsactionData.d = dispatcher;
|
||||
}
|
||||
function removeAllEventListeners(earlyJsactionData) {
|
||||
if (!earlyJsactionData) {
|
||||
return;
|
||||
}
|
||||
removeEventListeners(earlyJsactionData.c, earlyJsactionData.et, earlyJsactionData.h);
|
||||
removeEventListeners(earlyJsactionData.c, earlyJsactionData.etc, earlyJsactionData.h, true);
|
||||
}
|
||||
function removeEventListeners(container, eventTypes, earlyEventHandler, capture) {
|
||||
for (let i = 0; i < eventTypes.length; i++) {
|
||||
container.removeEventListener(eventTypes[i], earlyEventHandler, capture);
|
||||
}
|
||||
}
|
||||
|
||||
const MOUSE_SPECIAL_SUPPORT = false;
|
||||
|
||||
class EventContract {
|
||||
static MOUSE_SPECIAL_SUPPORT = MOUSE_SPECIAL_SUPPORT;
|
||||
containerManager;
|
||||
eventHandlers = {};
|
||||
browserEventTypeToExtraEventTypes = {};
|
||||
dispatcher = null;
|
||||
queuedEventInfos = [];
|
||||
constructor(containerManager) {
|
||||
this.containerManager = containerManager;
|
||||
}
|
||||
handleEvent(eventType, event, container) {
|
||||
const eventInfo = createEventInfoFromParameters(eventType, event, event.target, container, Date.now());
|
||||
this.handleEventInfo(eventInfo);
|
||||
}
|
||||
handleEventInfo(eventInfo) {
|
||||
if (!this.dispatcher) {
|
||||
setIsReplay(eventInfo, true);
|
||||
this.queuedEventInfos?.push(eventInfo);
|
||||
return;
|
||||
}
|
||||
this.dispatcher(eventInfo);
|
||||
}
|
||||
addEvent(eventType, prefixedEventType, passive) {
|
||||
if (eventType in this.eventHandlers || !this.containerManager) {
|
||||
return;
|
||||
}
|
||||
if (!EventContract.MOUSE_SPECIAL_SUPPORT && MOUSE_SPECIAL_EVENT_TYPES.indexOf(eventType) >= 0) {
|
||||
return;
|
||||
}
|
||||
const eventHandler = (eventType, event, container) => {
|
||||
this.handleEvent(eventType, event, container);
|
||||
};
|
||||
this.eventHandlers[eventType] = eventHandler;
|
||||
const browserEventType = getBrowserEventType(prefixedEventType || eventType);
|
||||
if (browserEventType !== eventType) {
|
||||
const eventTypes = this.browserEventTypeToExtraEventTypes[browserEventType] || [];
|
||||
eventTypes.push(eventType);
|
||||
this.browserEventTypeToExtraEventTypes[browserEventType] = eventTypes;
|
||||
}
|
||||
this.containerManager.addEventListener(browserEventType, element => {
|
||||
return event => {
|
||||
eventHandler(eventType, event, element);
|
||||
};
|
||||
}, passive);
|
||||
}
|
||||
replayEarlyEvents(earlyJsactionData = window._ejsa) {
|
||||
if (!earlyJsactionData) {
|
||||
return;
|
||||
}
|
||||
this.replayEarlyEventInfos(earlyJsactionData.q);
|
||||
removeAllEventListeners(earlyJsactionData);
|
||||
delete window._ejsa;
|
||||
}
|
||||
replayEarlyEventInfos(earlyEventInfos) {
|
||||
for (let i = 0; i < earlyEventInfos.length; i++) {
|
||||
const earlyEventInfo = earlyEventInfos[i];
|
||||
const eventTypes = this.getEventTypesForBrowserEventType(earlyEventInfo.eventType);
|
||||
for (let j = 0; j < eventTypes.length; j++) {
|
||||
const eventInfo = cloneEventInfo(earlyEventInfo);
|
||||
setEventType(eventInfo, eventTypes[j]);
|
||||
this.handleEventInfo(eventInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
getEventTypesForBrowserEventType(browserEventType) {
|
||||
const eventTypes = [];
|
||||
if (this.eventHandlers[browserEventType]) {
|
||||
eventTypes.push(browserEventType);
|
||||
}
|
||||
if (this.browserEventTypeToExtraEventTypes[browserEventType]) {
|
||||
eventTypes.push(...this.browserEventTypeToExtraEventTypes[browserEventType]);
|
||||
}
|
||||
return eventTypes;
|
||||
}
|
||||
handler(eventType) {
|
||||
return this.eventHandlers[eventType];
|
||||
}
|
||||
cleanUp() {
|
||||
this.containerManager?.cleanUp();
|
||||
this.containerManager = null;
|
||||
this.eventHandlers = {};
|
||||
this.browserEventTypeToExtraEventTypes = {};
|
||||
this.dispatcher = null;
|
||||
this.queuedEventInfos = [];
|
||||
}
|
||||
registerDispatcher(dispatcher, restriction) {
|
||||
this.ecrd(dispatcher, restriction);
|
||||
}
|
||||
ecrd(dispatcher, restriction) {
|
||||
this.dispatcher = dispatcher;
|
||||
if (this.queuedEventInfos?.length) {
|
||||
for (let i = 0; i < this.queuedEventInfos.length; i++) {
|
||||
this.handleEventInfo(this.queuedEventInfos[i]);
|
||||
}
|
||||
this.queuedEventInfos = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bootstrapAppScopedEarlyEventContract(container, appId, bubbleEventTypes, captureEventTypes, dataContainer = window) {
|
||||
const earlyJsactionData = createEarlyJsactionData(container);
|
||||
if (!dataContainer._ejsas) {
|
||||
dataContainer._ejsas = {};
|
||||
}
|
||||
dataContainer._ejsas[appId] = earlyJsactionData;
|
||||
addEvents(earlyJsactionData, bubbleEventTypes);
|
||||
addEvents(earlyJsactionData, captureEventTypes, true);
|
||||
}
|
||||
function getAppScopedQueuedEventInfos(appId, dataContainer = window) {
|
||||
return getQueuedEventInfos(dataContainer._ejsas?.[appId]);
|
||||
}
|
||||
function registerAppScopedDispatcher(appId, dispatcher, dataContainer = window) {
|
||||
registerDispatcher(dataContainer._ejsas?.[appId], dispatcher);
|
||||
}
|
||||
function removeAllAppScopedEventListeners(appId, dataContainer = window) {
|
||||
removeAllEventListeners(dataContainer._ejsas?.[appId]);
|
||||
}
|
||||
function clearAppScopedEarlyEventContract(appId, dataContainer = window) {
|
||||
if (!dataContainer._ejsas) {
|
||||
return;
|
||||
}
|
||||
dataContainer._ejsas[appId] = undefined;
|
||||
}
|
||||
|
||||
export { Attribute, EventContract, EventContractContainer, EventDispatcher, EventInfoWrapper, EventPhase, bootstrapAppScopedEarlyEventContract, clearAppScopedEarlyEventContract, getDefaulted as getActionCache, getAppScopedQueuedEventInfos, isCaptureEventType, isEarlyEventType, registerAppScopedDispatcher, registerDispatcher$1 as registerDispatcher, removeAllAppScopedEventListeners };
|
||||
//# sourceMappingURL=primitives-event-dispatch.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+187
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { SIGNAL, consumerMarkDirty, REACTIVE_NODE, consumerDestroy, isInNotificationPhase, consumerPollProducersForChange, consumerBeforeComputation, consumerAfterComputation } from './_effect-chunk.mjs';
|
||||
export { BASE_EFFECT_NODE, SIGNAL_NODE, createComputed, createSignal, defaultEquals, finalizeConsumerAfterComputation, getActiveConsumer, isReactive, producerAccessed, producerIncrementEpoch, producerMarkClean, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, resetConsumerBeforeComputation, runEffect, runPostProducerCreatedFn, runPostSignalSetFn, setActiveConsumer, setPostProducerCreatedFn, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalGetFn, signalSetFn, signalUpdateFn } from './_effect-chunk.mjs';
|
||||
export { createLinkedSignal, linkedSignalSetFn, linkedSignalUpdateFn, untracked } from './_untracked-chunk.mjs';
|
||||
export { setAlternateWeakRefImpl } from './_weak_ref-chunk.mjs';
|
||||
|
||||
const formatter = {
|
||||
header: (sig, config) => {
|
||||
if (!isSignal(sig) || config?.ngSkipFormatting) return null;
|
||||
let value;
|
||||
try {
|
||||
value = sig();
|
||||
} catch (e) {
|
||||
return ['span', `Signal(⚠️ Error)${e.message ? `: ${e.message}` : ''}`];
|
||||
}
|
||||
const kind = 'computation' in sig[SIGNAL] ? 'Computed' : 'Signal';
|
||||
const isPrimitive = value === null || !Array.isArray(value) && typeof value !== 'object';
|
||||
return ['span', {}, ['span', {}, `${kind}(`], (() => {
|
||||
if (isSignal(value)) {
|
||||
return formatter.header(value, config);
|
||||
} else if (isPrimitive && value !== undefined && typeof value !== 'function') {
|
||||
return ['object', {
|
||||
object: value
|
||||
}];
|
||||
} else {
|
||||
return prettifyPreview(value);
|
||||
}
|
||||
})(), ['span', {}, `)`]];
|
||||
},
|
||||
hasBody: (sig, config) => {
|
||||
if (!isSignal(sig)) return false;
|
||||
try {
|
||||
sig();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return !config?.ngSkipFormatting;
|
||||
},
|
||||
body: (sig, config) => {
|
||||
const color = 'var(--sys-color-primary)';
|
||||
return ['div', {
|
||||
style: `background: #FFFFFF10; padding-left: 4px; padding-top: 2px; padding-bottom: 2px;`
|
||||
}, ['div', {
|
||||
style: `color: ${color}`
|
||||
}, 'Signal value: '], ['div', {
|
||||
style: `padding-left: .5rem;`
|
||||
}, ['object', {
|
||||
object: sig(),
|
||||
config
|
||||
}]], ['div', {
|
||||
style: `color: ${color}`
|
||||
}, 'Signal function: '], ['div', {
|
||||
style: `padding-left: .5rem;`
|
||||
}, ['object', {
|
||||
object: sig,
|
||||
config: {
|
||||
...config,
|
||||
ngSkipFormatting: true
|
||||
}
|
||||
}]]];
|
||||
}
|
||||
};
|
||||
function prettifyPreview(value) {
|
||||
if (value === null) return 'null';
|
||||
if (Array.isArray(value)) return `Array(${value.length})`;
|
||||
if (value instanceof Element) return `<${value.tagName.toLowerCase()}>`;
|
||||
if (value instanceof URL) return `URL`;
|
||||
switch (typeof value) {
|
||||
case 'undefined':
|
||||
{
|
||||
return 'undefined';
|
||||
}
|
||||
case 'function':
|
||||
{
|
||||
if ('prototype' in value) {
|
||||
return 'class';
|
||||
} else {
|
||||
return '() => {…}';
|
||||
}
|
||||
}
|
||||
case 'object':
|
||||
{
|
||||
if (value.constructor.name === 'Object') {
|
||||
return '{…}';
|
||||
} else {
|
||||
return `${value.constructor.name} {}`;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
return ['object', {
|
||||
object: value,
|
||||
config: {
|
||||
ngSkipFormatting: true
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
function isSignal(value) {
|
||||
return value[SIGNAL] !== undefined;
|
||||
}
|
||||
function installDevToolsSignalFormatter() {
|
||||
globalThis.devtoolsFormatters ??= [];
|
||||
if (!globalThis.devtoolsFormatters.some(f => f === formatter)) {
|
||||
globalThis.devtoolsFormatters.push(formatter);
|
||||
}
|
||||
}
|
||||
|
||||
function createWatch(fn, schedule, allowSignalWrites) {
|
||||
const node = Object.create(WATCH_NODE);
|
||||
if (allowSignalWrites) {
|
||||
node.consumerAllowSignalWrites = true;
|
||||
}
|
||||
node.fn = fn;
|
||||
node.schedule = schedule;
|
||||
const registerOnCleanup = cleanupFn => {
|
||||
node.cleanupFn = cleanupFn;
|
||||
};
|
||||
function isWatchNodeDestroyed(node) {
|
||||
return node.fn === null && node.schedule === null;
|
||||
}
|
||||
function destroyWatchNode(node) {
|
||||
if (!isWatchNodeDestroyed(node)) {
|
||||
consumerDestroy(node);
|
||||
node.cleanupFn();
|
||||
node.fn = null;
|
||||
node.schedule = null;
|
||||
node.cleanupFn = NOOP_CLEANUP_FN;
|
||||
}
|
||||
}
|
||||
const run = () => {
|
||||
if (node.fn === null) {
|
||||
return;
|
||||
}
|
||||
if (isInNotificationPhase()) {
|
||||
throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? 'Schedulers cannot synchronously execute watches while scheduling.' : '');
|
||||
}
|
||||
node.dirty = false;
|
||||
if (node.version > 0 && !consumerPollProducersForChange(node)) {
|
||||
return;
|
||||
}
|
||||
node.version++;
|
||||
const prevConsumer = consumerBeforeComputation(node);
|
||||
try {
|
||||
node.cleanupFn();
|
||||
node.cleanupFn = NOOP_CLEANUP_FN;
|
||||
node.fn(registerOnCleanup);
|
||||
} finally {
|
||||
consumerAfterComputation(node, prevConsumer);
|
||||
}
|
||||
};
|
||||
node.ref = {
|
||||
notify: () => consumerMarkDirty(node),
|
||||
run,
|
||||
cleanup: () => node.cleanupFn(),
|
||||
destroy: () => destroyWatchNode(node),
|
||||
[SIGNAL]: node
|
||||
};
|
||||
return node.ref;
|
||||
}
|
||||
const NOOP_CLEANUP_FN = () => {};
|
||||
const WATCH_NODE = /* @__PURE__ */(() => {
|
||||
return {
|
||||
...REACTIVE_NODE,
|
||||
consumerIsAlwaysLive: true,
|
||||
consumerAllowSignalWrites: false,
|
||||
consumerMarkedDirty: node => {
|
||||
if (node.schedule !== null) {
|
||||
node.schedule(node.ref);
|
||||
}
|
||||
},
|
||||
cleanupFn: NOOP_CLEANUP_FN
|
||||
};
|
||||
})();
|
||||
|
||||
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
||||
installDevToolsSignalFormatter();
|
||||
}
|
||||
|
||||
export { REACTIVE_NODE, SIGNAL, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createWatch, installDevToolsSignalFormatter, isInNotificationPhase };
|
||||
//# sourceMappingURL=primitives-signals.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+260
@@ -0,0 +1,260 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { Observable, ReplaySubject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { assertInInjectionContext, inject, DestroyRef, RuntimeError, Injector, effect, assertNotInReactiveContext, signal, PendingTasks } from './_effect-chunk2.mjs';
|
||||
import { getOutputDestroyRef, untracked, computed, resource, encapsulateResourceError } from './_resource-chunk.mjs';
|
||||
import './_effect-chunk.mjs';
|
||||
import './_not_found-chunk.mjs';
|
||||
import '@angular/core/primitives/signals';
|
||||
import '@angular/core/primitives/di';
|
||||
import './_untracked-chunk.mjs';
|
||||
|
||||
function takeUntilDestroyed(destroyRef) {
|
||||
if (!destroyRef) {
|
||||
ngDevMode && assertInInjectionContext(takeUntilDestroyed);
|
||||
destroyRef = inject(DestroyRef);
|
||||
}
|
||||
const destroyed$ = new Observable(subscriber => {
|
||||
if (destroyRef.destroyed) {
|
||||
subscriber.next();
|
||||
return;
|
||||
}
|
||||
const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));
|
||||
return unregisterFn;
|
||||
});
|
||||
return source => {
|
||||
return source.pipe(takeUntil(destroyed$));
|
||||
};
|
||||
}
|
||||
|
||||
class OutputFromObservableRef {
|
||||
source;
|
||||
destroyed = false;
|
||||
destroyRef = inject(DestroyRef);
|
||||
constructor(source) {
|
||||
this.source = source;
|
||||
this.destroyRef.onDestroy(() => {
|
||||
this.destroyed = true;
|
||||
});
|
||||
}
|
||||
subscribe(callbackFn) {
|
||||
if (this.destroyed) {
|
||||
throw new RuntimeError(953, ngDevMode && 'Unexpected subscription to destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');
|
||||
}
|
||||
const subscription = this.source.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
||||
next: value => callbackFn(value)
|
||||
});
|
||||
return {
|
||||
unsubscribe: () => subscription.unsubscribe()
|
||||
};
|
||||
}
|
||||
}
|
||||
function outputFromObservable(observable, opts) {
|
||||
ngDevMode && assertInInjectionContext(outputFromObservable);
|
||||
return new OutputFromObservableRef(observable);
|
||||
}
|
||||
|
||||
function outputToObservable(ref) {
|
||||
const destroyRef = getOutputDestroyRef(ref);
|
||||
return new Observable(observer => {
|
||||
const unregisterOnDestroy = destroyRef?.onDestroy(() => observer.complete());
|
||||
const subscription = ref.subscribe(v => observer.next(v));
|
||||
return () => {
|
||||
subscription.unsubscribe();
|
||||
unregisterOnDestroy?.();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function toObservable(source, options) {
|
||||
if (ngDevMode && !options?.injector) {
|
||||
assertInInjectionContext(toObservable);
|
||||
}
|
||||
const injector = options?.injector ?? inject(Injector);
|
||||
const subject = new ReplaySubject(1);
|
||||
const watcher = effect(() => {
|
||||
let value;
|
||||
try {
|
||||
value = source();
|
||||
} catch (err) {
|
||||
untracked(() => subject.error(err));
|
||||
return;
|
||||
}
|
||||
untracked(() => subject.next(value));
|
||||
}, {
|
||||
injector,
|
||||
manualCleanup: true
|
||||
});
|
||||
injector.get(DestroyRef).onDestroy(() => {
|
||||
watcher.destroy();
|
||||
subject.complete();
|
||||
});
|
||||
return subject.asObservable();
|
||||
}
|
||||
|
||||
function toSignal(source, options) {
|
||||
typeof ngDevMode !== 'undefined' && ngDevMode && assertNotInReactiveContext(toSignal, 'Invoking `toSignal` causes new subscriptions every time. ' + 'Consider moving `toSignal` outside of the reactive context and read the signal value where needed.');
|
||||
const requiresCleanup = !options?.manualCleanup;
|
||||
if (ngDevMode && requiresCleanup && !options?.injector) {
|
||||
assertInInjectionContext(toSignal);
|
||||
}
|
||||
const cleanupRef = requiresCleanup ? options?.injector?.get(DestroyRef) ?? inject(DestroyRef) : null;
|
||||
const equal = makeToSignalEqual(options?.equal);
|
||||
let state;
|
||||
if (options?.requireSync) {
|
||||
state = signal({
|
||||
kind: 0
|
||||
}, {
|
||||
equal,
|
||||
...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)
|
||||
});
|
||||
} else {
|
||||
state = signal({
|
||||
kind: 1,
|
||||
value: options?.initialValue
|
||||
}, {
|
||||
equal,
|
||||
...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)
|
||||
});
|
||||
}
|
||||
let destroyUnregisterFn;
|
||||
const sub = source.subscribe({
|
||||
next: value => state.set({
|
||||
kind: 1,
|
||||
value
|
||||
}),
|
||||
error: error => {
|
||||
state.set({
|
||||
kind: 2,
|
||||
error
|
||||
});
|
||||
destroyUnregisterFn?.();
|
||||
},
|
||||
complete: () => {
|
||||
destroyUnregisterFn?.();
|
||||
}
|
||||
});
|
||||
if (options?.requireSync && state().kind === 0) {
|
||||
throw new RuntimeError(601, (typeof ngDevMode === 'undefined' || ngDevMode) && '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');
|
||||
}
|
||||
destroyUnregisterFn = cleanupRef?.onDestroy(sub.unsubscribe.bind(sub));
|
||||
return computed(() => {
|
||||
const current = state();
|
||||
switch (current.kind) {
|
||||
case 1:
|
||||
return current.value;
|
||||
case 2:
|
||||
throw current.error;
|
||||
case 0:
|
||||
throw new RuntimeError(601, (typeof ngDevMode === 'undefined' || ngDevMode) && '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');
|
||||
}
|
||||
}, {
|
||||
equal: options?.equal,
|
||||
...(ngDevMode ? createDebugNameObject(options?.debugName, 'source') : undefined)
|
||||
});
|
||||
}
|
||||
function makeToSignalEqual(userEquality = Object.is) {
|
||||
return (a, b) => a.kind === 1 && b.kind === 1 && userEquality(a.value, b.value);
|
||||
}
|
||||
function createDebugNameObject(toSignalDebugName, internalSignalDebugName) {
|
||||
return {
|
||||
debugName: `toSignal${toSignalDebugName ? '#' + toSignalDebugName : ''}.${internalSignalDebugName}`
|
||||
};
|
||||
}
|
||||
|
||||
function pendingUntilEvent(injector) {
|
||||
if (injector === undefined) {
|
||||
ngDevMode && assertInInjectionContext(pendingUntilEvent);
|
||||
injector = inject(Injector);
|
||||
}
|
||||
const taskService = injector.get(PendingTasks);
|
||||
return sourceObservable => {
|
||||
return new Observable(originalSubscriber => {
|
||||
const removeTask = taskService.add();
|
||||
let cleanedUp = false;
|
||||
function cleanupTask() {
|
||||
if (cleanedUp) {
|
||||
return;
|
||||
}
|
||||
removeTask();
|
||||
cleanedUp = true;
|
||||
}
|
||||
const innerSubscription = sourceObservable.subscribe({
|
||||
next: v => {
|
||||
originalSubscriber.next(v);
|
||||
cleanupTask();
|
||||
},
|
||||
complete: () => {
|
||||
originalSubscriber.complete();
|
||||
cleanupTask();
|
||||
},
|
||||
error: e => {
|
||||
originalSubscriber.error(e);
|
||||
cleanupTask();
|
||||
}
|
||||
});
|
||||
innerSubscription.add(() => {
|
||||
originalSubscriber.unsubscribe();
|
||||
cleanupTask();
|
||||
});
|
||||
return innerSubscription;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function rxResource(opts) {
|
||||
if (ngDevMode && !opts?.injector) {
|
||||
assertInInjectionContext(rxResource);
|
||||
}
|
||||
return resource({
|
||||
...opts,
|
||||
loader: undefined,
|
||||
stream: params => {
|
||||
let sub;
|
||||
const onAbort = () => sub?.unsubscribe();
|
||||
params.abortSignal.addEventListener('abort', onAbort);
|
||||
const stream = signal({
|
||||
value: undefined
|
||||
});
|
||||
let resolve;
|
||||
const promise = new Promise(r => resolve = r);
|
||||
function send(value) {
|
||||
stream.set(value);
|
||||
resolve?.(stream);
|
||||
resolve = undefined;
|
||||
}
|
||||
const streamFn = opts.stream ?? opts.loader;
|
||||
if (streamFn === undefined) {
|
||||
throw new RuntimeError(990, ngDevMode && `Must provide \`stream\` option.`);
|
||||
}
|
||||
sub = streamFn(params).subscribe({
|
||||
next: value => send({
|
||||
value
|
||||
}),
|
||||
error: error => {
|
||||
send({
|
||||
error: encapsulateResourceError(error)
|
||||
});
|
||||
params.abortSignal.removeEventListener('abort', onAbort);
|
||||
},
|
||||
complete: () => {
|
||||
if (resolve) {
|
||||
send({
|
||||
error: new RuntimeError(991, ngDevMode && 'Resource completed before producing a value')
|
||||
});
|
||||
}
|
||||
params.abortSignal.removeEventListener('abort', onAbort);
|
||||
}
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { outputFromObservable, outputToObservable, pendingUntilEvent, rxResource, takeUntilDestroyed, toObservable, toSignal };
|
||||
//# sourceMappingURL=rxjs-interop.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+2509
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user