@blotch/angular-lynx 22.2.4 → 22.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1787,6 +1787,7 @@ var LynxBlurView = class LynxBlurView extends LynxElementBase {
1787
1787
  "android-capture-target";
1788
1788
  "experimental-update-blur-radius";
1789
1789
  "blur-effect";
1790
+ "blur-material";
1790
1791
  spacing;
1791
1792
  "glass-interactive";
1792
1793
  "glass-tint-color";
@@ -1813,6 +1814,7 @@ var LynxBlurView = class LynxBlurView extends LynxElementBase {
1813
1814
  "android-capture-target": "android-capture-target",
1814
1815
  "experimental-update-blur-radius": "experimental-update-blur-radius",
1815
1816
  "blur-effect": "blur-effect",
1817
+ "blur-material": "blur-material",
1816
1818
  spacing: "spacing",
1817
1819
  "glass-interactive": "glass-interactive",
1818
1820
  "glass-tint-color": "glass-tint-color",
@@ -1839,6 +1841,7 @@ i0.ɵɵngDeclareClassMetadata({
1839
1841
  "android-capture-target",
1840
1842
  "experimental-update-blur-radius",
1841
1843
  "blur-effect",
1844
+ "blur-material",
1842
1845
  "spacing",
1843
1846
  "glass-interactive",
1844
1847
  "glass-tint-color",
@@ -3402,6 +3405,62 @@ i0.ɵɵngDeclareClassMetadata({
3402
3405
  }],
3403
3406
  ctorParameters: () => []
3404
3407
  });
3408
+ var LynxAccessibilityTraits = class LynxAccessibilityTraits {
3409
+ lynxAccessibilityTraits = input(...ngDevMode ? [void 0, { debugName: "lynxAccessibilityTraits" }] : /* istanbul ignore next */ []);
3410
+ #element = inject(ElementRef).nativeElement;
3411
+ #added = [];
3412
+ constructor() {
3413
+ effect(() => {
3414
+ const states = this.lynxAccessibilityTraits() ?? {};
3415
+ const on = Object.keys(states).filter((trait) => states[trait]);
3416
+ for (const trait of this.#added) if (!on.includes(trait)) this.#element.setAccessibilityTrait(trait, false);
3417
+ for (const trait of on) this.#element.setAccessibilityTrait(trait, true);
3418
+ this.#added = on;
3419
+ });
3420
+ }
3421
+ static ɵfac = i0.ɵɵngDeclareFactory({
3422
+ minVersion: "12.0.0",
3423
+ version: "22.2.1",
3424
+ ngImport: i0,
3425
+ type: LynxAccessibilityTraits,
3426
+ deps: [],
3427
+ target: i0.ɵɵFactoryTarget.Directive
3428
+ });
3429
+ static ɵdir = i0.ɵɵngDeclareDirective({
3430
+ minVersion: "17.1.0",
3431
+ version: "22.2.1",
3432
+ type: LynxAccessibilityTraits,
3433
+ isStandalone: true,
3434
+ selector: "[lynxAccessibilityTraits]",
3435
+ inputs: { lynxAccessibilityTraits: {
3436
+ classPropertyName: "lynxAccessibilityTraits",
3437
+ publicName: "lynxAccessibilityTraits",
3438
+ isSignal: true,
3439
+ isRequired: false,
3440
+ transformFunction: null
3441
+ } },
3442
+ ngImport: i0
3443
+ });
3444
+ };
3445
+ i0.ɵɵngDeclareClassMetadata({
3446
+ minVersion: "12.0.0",
3447
+ version: "22.2.1",
3448
+ ngImport: i0,
3449
+ type: LynxAccessibilityTraits,
3450
+ decorators: [{
3451
+ type: Directive,
3452
+ args: [{ selector: "[lynxAccessibilityTraits]" }]
3453
+ }],
3454
+ ctorParameters: () => [],
3455
+ propDecorators: { lynxAccessibilityTraits: [{
3456
+ type: i0.Input,
3457
+ args: [{
3458
+ isSignal: true,
3459
+ alias: "lynxAccessibilityTraits",
3460
+ required: false
3461
+ }]
3462
+ }] }
3463
+ });
3405
3464
  const LYNX_ELEMENTS = [
3406
3465
  LynxView,
3407
3466
  LynxText,
@@ -3434,7 +3493,8 @@ const LYNX_ELEMENTS = [
3434
3493
  LynxWebView,
3435
3494
  LynxCoverView,
3436
3495
  LynxTitleBarView,
3437
- LynxRouterLinkActive
3496
+ LynxRouterLinkActive,
3497
+ LynxAccessibilityTraits
3438
3498
  ];
3439
3499
  const LOG_EVENT = "__lynx_log__";
3440
3500
  const logUrl = () => __DEV__ && typeof __DEV_LOG_URL__ !== "undefined" ? __DEV_LOG_URL__ : "";
@@ -4290,12 +4350,71 @@ i0.ɵɵngDeclareClassMetadata({
4290
4350
  args: [{ providedIn: "root" }]
4291
4351
  }]
4292
4352
  });
4353
+ const DYNAMIC_COLOR_ROLES = [
4354
+ "primary",
4355
+ "onPrimary",
4356
+ "primaryContainer",
4357
+ "onPrimaryContainer",
4358
+ "inversePrimary",
4359
+ "secondary",
4360
+ "onSecondary",
4361
+ "secondaryContainer",
4362
+ "onSecondaryContainer",
4363
+ "tertiary",
4364
+ "onTertiary",
4365
+ "tertiaryContainer",
4366
+ "onTertiaryContainer",
4367
+ "background",
4368
+ "onBackground",
4369
+ "surface",
4370
+ "onSurface",
4371
+ "surfaceVariant",
4372
+ "onSurfaceVariant",
4373
+ "surfaceDim",
4374
+ "surfaceBright",
4375
+ "surfaceContainerLowest",
4376
+ "surfaceContainerLow",
4377
+ "surfaceContainer",
4378
+ "surfaceContainerHigh",
4379
+ "surfaceContainerHighest",
4380
+ "inverseSurface",
4381
+ "inverseOnSurface",
4382
+ "outline",
4383
+ "outlineVariant"
4384
+ ];
4385
+ const HEX_COLOR = /^#[0-9a-f]{6}$/i;
4386
+ const parseScheme = (value) => {
4387
+ if (typeof value !== "object" || value === null) return null;
4388
+ const colors = value;
4389
+ const scheme = {};
4390
+ for (const role of DYNAMIC_COLOR_ROLES) {
4391
+ const color = colors[role];
4392
+ if (typeof color !== "string" || !HEX_COLOR.test(color)) return null;
4393
+ scheme[role] = color;
4394
+ }
4395
+ return scheme;
4396
+ };
4397
+ const parseDynamicColors = (value) => {
4398
+ if (typeof value !== "object" || value === null) return null;
4399
+ const { light, dark } = value;
4400
+ const lightScheme = parseScheme(light);
4401
+ const darkScheme = parseScheme(dark);
4402
+ return lightScheme && darkScheme ? {
4403
+ light: lightScheme,
4404
+ dark: darkScheme
4405
+ } : null;
4406
+ };
4407
+ const sameColors = (a, b) => a === b || a !== null && b !== null && DYNAMIC_COLOR_ROLES.every((role) => a.light[role] === b.light[role] && a.dark[role] === b.dark[role]);
4293
4408
  var LynxTheme = class LynxTheme {
4294
4409
  #globalData = inject(LynxGlobalData);
4295
4410
  theme = computed(() => {
4296
4411
  return this.#globalData.globalData()["theme"] ?? "Light";
4297
4412
  }, ...ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []);
4298
4413
  isDarkMode = computed(() => this.theme() === "Dark", ...ngDevMode ? [{ debugName: "isDarkMode" }] : /* istanbul ignore next */ []);
4414
+ dynamicColors = computed(() => parseDynamicColors(this.#globalData.globalData()["dynamicColors"]), {
4415
+ ...ngDevMode ? { debugName: "dynamicColors" } : /* istanbul ignore next */ {},
4416
+ equal: sameColors
4417
+ });
4299
4418
  static ɵfac = i0.ɵɵngDeclareFactory({
4300
4419
  minVersion: "12.0.0",
4301
4420
  version: "22.2.1",
@@ -4781,7 +4900,7 @@ const isAndroid = () => {
4781
4900
  const createBlurViewElement = (pageId) => {
4782
4901
  const element = __CreateElement("blur-view", pageId);
4783
4902
  if (!__WEB__ && isAndroid()) __SetAttribute(element, "android-capture-target", ANDROID_BLUR_CAPTURE_TARGET);
4784
- if (__WEB__ && __MAIN_THREAD__) import("./blotch-angular-lynx-web-glass-ciDHw7Bw.mjs").then(({ attachWebGlass }) => attachWebGlass(element)).catch(() => {});
4903
+ if (__WEB__ && __MAIN_THREAD__) import("./blotch-angular-lynx-web-glass-zlVeee5K.mjs").then(({ attachWebGlass }) => attachWebGlass(element)).catch(() => {});
4785
4904
  return element;
4786
4905
  };
4787
4906
  const createCommentElement = (pageId) => {
@@ -5081,6 +5200,7 @@ const withAddedTraits = (own, added) => {
5081
5200
  for (const trait of added) if (!traits.includes(trait)) traits.push(trait);
5082
5201
  return traits.join(",");
5083
5202
  };
5203
+ const isCustomProperty = (name) => name.startsWith("--");
5084
5204
  const wouldFormCycle = (parent, candidate) => {
5085
5205
  const candidateId = __GetElementUniqueID(candidate);
5086
5206
  for (let cur = parent; cur; cur = __GetParent(cur)) if (__GetElementUniqueID(cur) === candidateId) return true;
@@ -5105,6 +5225,10 @@ const flushesBefore = (first, second) => {
5105
5225
  }
5106
5226
  return false;
5107
5227
  };
5228
+ const isIOS = () => {
5229
+ return ((typeof lynx !== "undefined" ? lynx.SystemInfo : void 0) ?? (typeof SystemInfo !== "undefined" ? SystemInfo : void 0))?.platform === "iOS";
5230
+ };
5231
+ const insertHidesBlurView = (parent, child) => !__WEB__ && child.tagName === "blur-view" && parent.tagName !== "blur-view" && isIOS();
5108
5232
  const isTextish = (el) => el.tagName === "text" || el.tagName === "raw-text";
5109
5233
  var LynxElement = class {
5110
5234
  #nativeRef;
@@ -5125,6 +5249,7 @@ var LynxElement = class {
5125
5249
  #inlineStyleWhole = null;
5126
5250
  #inlineStyleKeys = /* @__PURE__ */ new Map();
5127
5251
  #runtimeStyle = "";
5252
+ #customProperties = /* @__PURE__ */ new Map();
5128
5253
  #ownTraits = null;
5129
5254
  #addedTraits = [];
5130
5255
  #listeners = [];
@@ -5137,6 +5262,8 @@ var LynxElement = class {
5137
5262
  #paintingDead = false;
5138
5263
  static #pendingRemovals = /* @__PURE__ */ new Set();
5139
5264
  static #pendingTextNormalization = /* @__PURE__ */ new Set();
5265
+ static #pendingAttributeRemovals = /* @__PURE__ */ new Set();
5266
+ #removedAttributes = /* @__PURE__ */ new Set();
5140
5267
  static #byNativeId = /* @__PURE__ */ new Map();
5141
5268
  static #canonicalFor(ref) {
5142
5269
  return _a.#byNativeId.get(__GetElementUniqueID(ref)) ?? new _a(ref);
@@ -5183,7 +5310,14 @@ var LynxElement = class {
5183
5310
  this.#ownTraits = value ?? null;
5184
5311
  value = withAddedTraits(this.#ownTraits, this.#addedTraits);
5185
5312
  }
5186
- __SetAttribute(this.element, name, value);
5313
+ if (value == null) {
5314
+ this.#removedAttributes.add(name);
5315
+ _a.#pendingAttributeRemovals.add(this);
5316
+ scheduleSettleFlush();
5317
+ } else {
5318
+ this.#removedAttributes.delete(name);
5319
+ __SetAttribute(this.element, name, value);
5320
+ }
5187
5321
  if (value == null) this.#attrs.delete(name);
5188
5322
  else this.#attrs.set(name, value);
5189
5323
  if (this.tagName === "raw-text" && name === "text") {
@@ -5210,10 +5344,25 @@ var LynxElement = class {
5210
5344
  this.setAttribute(name, null);
5211
5345
  }
5212
5346
  setStyle(key, value) {
5347
+ if (isCustomProperty(key)) {
5348
+ if (value == null || value === "") {
5349
+ this.removeStyle(key);
5350
+ return;
5351
+ }
5352
+ const text = String(value);
5353
+ if (this.#customProperties.get(key) === text) return;
5354
+ this.#customProperties.set(key, text);
5355
+ this.#rewriteInlineStyle();
5356
+ return;
5357
+ }
5213
5358
  __AddInlineStyle(this.element, key, value);
5214
5359
  this.#inlineStyleKeys.set(key, value);
5215
5360
  }
5216
5361
  removeStyle(key) {
5362
+ if (isCustomProperty(key)) {
5363
+ if (this.#customProperties.delete(key)) this.#rewriteInlineStyle();
5364
+ return;
5365
+ }
5217
5366
  __AddInlineStyle(this.element, key, null);
5218
5367
  this.#inlineStyleKeys.delete(key);
5219
5368
  }
@@ -5222,12 +5371,20 @@ var LynxElement = class {
5222
5371
  this.#inlineStyleWhole = inlineStyle;
5223
5372
  }
5224
5373
  #withRuntimeStyle(inlineStyle) {
5225
- if (!this.#runtimeStyle) return inlineStyle;
5226
- return inlineStyle ? `${this.#runtimeStyle}; ${inlineStyle}` : this.#runtimeStyle;
5374
+ if (!this.#runtimeStyle && this.#customProperties.size === 0) return inlineStyle;
5375
+ const variables = [...this.#customProperties].map(([name, value]) => `${name}: ${value}`).join("; ");
5376
+ return [
5377
+ this.#runtimeStyle,
5378
+ inlineStyle?.replace(/[\s;]+$/, ""),
5379
+ variables
5380
+ ].filter(Boolean).join("; ");
5227
5381
  }
5228
5382
  #setRuntimeStyle(style) {
5229
5383
  if (style === this.#runtimeStyle) return;
5230
5384
  this.#runtimeStyle = style;
5385
+ this.#rewriteInlineStyle();
5386
+ }
5387
+ #rewriteInlineStyle() {
5231
5388
  __SetInlineStyles(this.element, this.#withRuntimeStyle(this.#inlineStyleWhole));
5232
5389
  for (const [key, value] of this.#inlineStyleKeys) __AddInlineStyle(this.element, key, value);
5233
5390
  }
@@ -5239,11 +5396,19 @@ var LynxElement = class {
5239
5396
  if (refChild == null) this.appendChild(newChild);
5240
5397
  else {
5241
5398
  if (wouldFormCycle(this.element, newChild.element)) return;
5242
- __InsertElementBefore(this.element, newChild.element, refChild.element);
5399
+ if (insertHidesBlurView(this, newChild)) this.#appendBefore(newChild, refChild);
5400
+ else __InsertElementBefore(this.element, newChild.element, refChild.element);
5243
5401
  this.#adoptChild(newChild, refChild);
5244
5402
  if (isTextish(this) || isTextish(newChild)) _a.#enqueueTextNormalization(newChild);
5245
5403
  }
5246
5404
  }
5405
+ #appendBefore(newChild, refChild) {
5406
+ const childId = __GetElementUniqueID(newChild.element);
5407
+ const following = [];
5408
+ for (let sibling = refChild.element; sibling; sibling = __NextElement(sibling)) if (__GetElementUniqueID(sibling) !== childId) following.push(sibling);
5409
+ __AppendElement(this.element, newChild.element);
5410
+ for (const sibling of following) __AppendElement(this.element, sibling);
5411
+ }
5247
5412
  appendChild(newChild) {
5248
5413
  if (newChild.isRootPageElement) return;
5249
5414
  newChild.#cancelPendingRemoval();
@@ -5295,6 +5460,15 @@ var LynxElement = class {
5295
5460
  }
5296
5461
  _a.#pendingRemovals.add(this);
5297
5462
  }
5463
+ static commitPendingAttributeRemovals() {
5464
+ if (_a.#pendingAttributeRemovals.size === 0) return;
5465
+ const elements = [..._a.#pendingAttributeRemovals];
5466
+ _a.#pendingAttributeRemovals.clear();
5467
+ for (const el of elements) {
5468
+ for (const name of el.#removedAttributes) __SetAttribute(el.element, name, null);
5469
+ el.#removedAttributes.clear();
5470
+ }
5471
+ }
5298
5472
  static commitPendingRemovals() {
5299
5473
  if (_a.#pendingRemovals.size === 0) return;
5300
5474
  const items = [..._a.#pendingRemovals];
@@ -5529,6 +5703,9 @@ _a = LynxElement;
5529
5703
  const processPendingRemovals = () => {
5530
5704
  LynxElement.commitPendingRemovals();
5531
5705
  };
5706
+ const processPendingAttributeRemovals = () => {
5707
+ LynxElement.commitPendingAttributeRemovals();
5708
+ };
5532
5709
  const processPendingTextNormalization = () => {
5533
5710
  LynxElement.commitPendingTextNormalization();
5534
5711
  };
@@ -5540,6 +5717,7 @@ const scheduleSettleFlush = () => {
5540
5717
  settleFlushScheduled = false;
5541
5718
  if (isInsideChangeDetection()) return;
5542
5719
  LynxElement.commitPendingRemovals();
5720
+ LynxElement.commitPendingAttributeRemovals();
5543
5721
  LynxElement.commitPendingTextNormalization();
5544
5722
  __FlushElementTree();
5545
5723
  });
@@ -5976,6 +6154,7 @@ var LynxRendererFactory2 = class LynxRendererFactory2 {
5976
6154
  }
5977
6155
  /* v8 ignore stop */
5978
6156
  processPendingRemovals();
6157
+ processPendingAttributeRemovals();
5979
6158
  processPendingTextNormalization();
5980
6159
  if (!isFirstRenderPending()) __FlushElementTree();
5981
6160
  processPendingListUpdates();
@@ -8362,6 +8541,6 @@ const bootstrapOnMainThread = async (rootComponent, options) => {
8362
8541
  if (__WEB__ && !wasHydrating) setTimeout(() => __FlushElementTree(), 0);
8363
8542
  return appRef;
8364
8543
  };
8365
- export { BaseGesture, ComposedGesture, ContinuousGesture, FlingDirection, FlingGesture, Gesture, GestureState, GestureStateManager, GestureType, LYNX_ELEMENTS, LYNX_FORM_ACCESSORS, LongPressGesture, LynxAccessibility, LynxAccessibilitySettings, LynxAnimation, LynxBlock, LynxBlurView, LynxCoverView, LynxDevTools, LynxErrorHandler, LynxExposure, LynxFont, LynxFor, LynxFrame, LynxGestureDetector, LynxGlobalData, LynxGlobalExposure, LynxIf, LynxImage, LynxInitData, LynxInlineTruncation, LynxInput, LynxInputValueAccessor, LynxList, LynxListItem, LynxLocale, LynxLocationStrategy, LynxLogger, LynxMainThread, LynxMainThreadEvent, LynxNativeModule, LynxOverlay, LynxPerformance, LynxPlatformLocation, LynxPortal, LynxRefresh, LynxRefreshHeader, LynxResourcePrefetch, LynxRouteReuseStrategy, LynxRouterLinkActive, LynxSafeArea, LynxScrollCoordinator, LynxScrollCoordinatorHeader, LynxScrollCoordinatorSlot, LynxScrollCoordinatorSlotDrag, LynxScrollCoordinatorToolbar, LynxScrollView, LynxSessionStorage, LynxSvg, LynxSystemInfo, LynxText, LynxTextMeasure, LynxTextarea, LynxTextareaValueAccessor, LynxTheme, LynxTitleBarView, LynxTransition, LynxTransitionGroup, LynxVideo, LynxView, LynxViewPager, LynxViewPagerItem, LynxWebView, MainThreadElement, MainThreadRef, PanGesture, PinchGesture, PortalRef, RotationGesture, SAFE_AREA_INSET_BOTTOM, SAFE_AREA_INSET_LEFT, SAFE_AREA_INSET_RIGHT, SAFE_AREA_INSET_TOP, TapGesture, backgroundFn, bootstrapApplication, createMainThreadRef, getLynxAppLocale, loadLazyBundle, mainThreadFn, provideLocale, provideRenderer, provideRouter, registerDataProcessors, ɵhmrAccept, ɵstartBackgroundThread };
8544
+ export { BaseGesture, ComposedGesture, ContinuousGesture, DYNAMIC_COLOR_ROLES, FlingDirection, FlingGesture, Gesture, GestureState, GestureStateManager, GestureType, LYNX_ELEMENTS, LYNX_FORM_ACCESSORS, LongPressGesture, LynxAccessibility, LynxAccessibilitySettings, LynxAccessibilityTraits, LynxAnimation, LynxBlock, LynxBlurView, LynxCoverView, LynxDevTools, LynxErrorHandler, LynxExposure, LynxFont, LynxFor, LynxFrame, LynxGestureDetector, LynxGlobalData, LynxGlobalExposure, LynxIf, LynxImage, LynxInitData, LynxInlineTruncation, LynxInput, LynxInputValueAccessor, LynxList, LynxListItem, LynxLocale, LynxLocationStrategy, LynxLogger, LynxMainThread, LynxMainThreadEvent, LynxNativeModule, LynxOverlay, LynxPerformance, LynxPlatformLocation, LynxPortal, LynxRefresh, LynxRefreshHeader, LynxResourcePrefetch, LynxRouteReuseStrategy, LynxRouterLinkActive, LynxSafeArea, LynxScrollCoordinator, LynxScrollCoordinatorHeader, LynxScrollCoordinatorSlot, LynxScrollCoordinatorSlotDrag, LynxScrollCoordinatorToolbar, LynxScrollView, LynxSessionStorage, LynxSvg, LynxSystemInfo, LynxText, LynxTextMeasure, LynxTextarea, LynxTextareaValueAccessor, LynxTheme, LynxTitleBarView, LynxTransition, LynxTransitionGroup, LynxVideo, LynxView, LynxViewPager, LynxViewPagerItem, LynxWebView, MainThreadElement, MainThreadRef, PanGesture, PinchGesture, PortalRef, RotationGesture, SAFE_AREA_INSET_BOTTOM, SAFE_AREA_INSET_LEFT, SAFE_AREA_INSET_RIGHT, SAFE_AREA_INSET_TOP, TapGesture, backgroundFn, bootstrapApplication, createMainThreadRef, getLynxAppLocale, loadLazyBundle, mainThreadFn, provideLocale, provideRenderer, provideRouter, registerDataProcessors, ɵhmrAccept, ɵstartBackgroundThread };
8366
8545
 
8367
8546
  //# sourceMappingURL=blotch-angular-lynx.mjs.map