@swiftwc/ui 0.0.0-dev.64 → 0.0.0-dev.65

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.
@@ -108,12 +108,13 @@ document.addEventListener('touchstart', () => { }, { passive: true });
108
108
  //#endregion
109
109
  // SECTION
110
110
  const handleHelp = ({ target, relatedTarget }) => {
111
+ console.log(999, target);
111
112
  if (!(target instanceof HTMLElement))
112
113
  return;
113
114
  const trigger = target.closest('[help]');
114
115
  if (!trigger)
115
116
  return;
116
- if ('PICKER-VIEW' === trigger.tagName)
117
+ if (['PICKER-VIEW'].includes(trigger.tagName))
117
118
  return;
118
119
  if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
119
120
  return;
@@ -132,7 +133,7 @@ const handleHelp = ({ target, relatedTarget }) => {
132
133
  const trigger = target.closest('[help]');
133
134
  if (!trigger)
134
135
  return;
135
- if ('PICKER-VIEW' === trigger.tagName)
136
+ if (['PICKER-VIEW'].includes(trigger.tagName))
136
137
  return;
137
138
  if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
138
139
  return;
@@ -34,6 +34,7 @@ export declare class PickerView extends FormAssociatedBase {
34
34
  CURRENT_VALUE_ICON: string;
35
35
  TRIGGER_HELP: string;
36
36
  DICTIONARY: string;
37
+ REQUIRED: string;
37
38
  };
38
39
  static get observedAttributes(): string[];
39
40
  get selection(): string;
@@ -128,6 +128,7 @@ export class PickerView extends FormAssociatedBase {
128
128
  CURRENT_VALUE_ICON: 'current-value-icon',
129
129
  TRIGGER_HELP: 'help',
130
130
  DICTIONARY: 'dictionary',
131
+ REQUIRED: 'required',
131
132
  };
132
133
  }
133
134
  static get observedAttributes() {
@@ -367,6 +368,8 @@ export class PickerView extends FormAssociatedBase {
367
368
  el.remove();
368
369
  CleanupRegistry.unregister(this, 'trigger');
369
370
  CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, currentValueLabel).on(), 'trigger');
371
+ if (this.hasAttribute(this.constructor.ATTR.TRIGGER_HELP))
372
+ currentValueLabel?.setAttribute(this.constructor.ATTR.TRIGGER_HELP, this.getAttribute(this.constructor.ATTR.TRIGGER_HELP) ?? '');
370
373
  // rebuild snapshot(tree)
371
374
  if (!this.#spawn)
372
375
  break;
@@ -400,8 +403,8 @@ export class PickerView extends FormAssociatedBase {
400
403
  // renderLabelIcon(currentValueLabel, 'dots-three') // overwritten
401
404
  // renderLabelTitle(currentValueLabel, this.#currentValueLabel) // overwritten
402
405
  // }
403
- if (this.hasAttribute('help'))
404
- currentValueLabel?.setAttribute('help', this.getAttribute('help') ?? '');
406
+ if (this.hasAttribute(this.constructor.ATTR.TRIGGER_HELP))
407
+ currentValueLabel?.setAttribute(this.constructor.ATTR.TRIGGER_HELP, this.getAttribute(this.constructor.ATTR.TRIGGER_HELP) ?? '');
405
408
  _a.#reflectButtons(input.source, menu);
406
409
  break;
407
410
  }
@@ -617,6 +620,11 @@ export class PickerView extends FormAssociatedBase {
617
620
  break;
618
621
  this.#renderDictionary(parseDictionary(newValue));
619
622
  break;
623
+ case this.constructor.ATTR.REQUIRED:
624
+ if (oldValue === newValue)
625
+ break;
626
+ this.#sendValueToForm(false);
627
+ break;
620
628
  case this.constructor.ATTR.SELECTION:
621
629
  // nothing happens
622
630
  break;
@@ -949,10 +957,10 @@ export class PickerView extends FormAssociatedBase {
949
957
  //udnefined
950
958
  }
951
959
  }
952
- if (this.hasAttribute('help'))
953
- trigger?.setAttribute('help', this.getAttribute('help') ?? '');
960
+ if (this.hasAttribute(this.constructor.ATTR.TRIGGER_HELP))
961
+ trigger?.setAttribute(this.constructor.ATTR.TRIGGER_HELP, this.getAttribute(this.constructor.ATTR.TRIGGER_HELP) ?? '');
954
962
  else
955
- trigger?.removeAttribute('help');
963
+ trigger?.removeAttribute(this.constructor.ATTR.TRIGGER_HELP);
956
964
  }
957
965
  // Optional: form participation properties
958
966
  get name() {
@@ -8127,6 +8127,66 @@
8127
8127
  inherits: true;
8128
8128
  }
8129
8129
  }
8130
+ @property --purple {
8131
+ syntax: "<color>";
8132
+ initial-value: oklch(61.67% 0.2607 326deg);
8133
+ inherits: true;
8134
+ }
8135
+ @media (prefers-color-scheme: dark) {
8136
+ @property --purple {
8137
+ syntax: "<color>";
8138
+ initial-value: oklch(65.86% 0.2795 325.94deg);
8139
+ inherits: true;
8140
+ }
8141
+ }
8142
+ @property --purple2 {
8143
+ syntax: "<color>";
8144
+ initial-value: oklch(78.07% 0.1464 325.64deg);
8145
+ inherits: true;
8146
+ }
8147
+ @media (prefers-color-scheme: dark) {
8148
+ @property --purple2 {
8149
+ syntax: "<color>";
8150
+ initial-value: oklch(44.3% 0.1667 326.12deg);
8151
+ inherits: true;
8152
+ }
8153
+ }
8154
+ @property --purple3 {
8155
+ syntax: "<color>";
8156
+ initial-value: oklch(88.73% 0.0728 324.7deg);
8157
+ inherits: true;
8158
+ }
8159
+ @media (prefers-color-scheme: dark) {
8160
+ @property --purple3 {
8161
+ syntax: "<color>";
8162
+ initial-value: oklch(32.88% 0.0959 325.84deg);
8163
+ inherits: true;
8164
+ }
8165
+ }
8166
+ @property --purple4 {
8167
+ syntax: "<color>";
8168
+ initial-value: oklch(91.84% 0.0518 323.99deg);
8169
+ inherits: true;
8170
+ }
8171
+ @media (prefers-color-scheme: dark) {
8172
+ @property --purple4 {
8173
+ syntax: "<color>";
8174
+ initial-value: oklch(29.81% 0.0724 325.02deg);
8175
+ inherits: true;
8176
+ }
8177
+ }
8178
+ @property --purple5 {
8179
+ syntax: "<color>";
8180
+ initial-value: oklch(94.55% 0.0358 323.99deg);
8181
+ inherits: true;
8182
+ }
8183
+ @media (prefers-color-scheme: dark) {
8184
+ @property --purple5 {
8185
+ syntax: "<color>";
8186
+ initial-value: oklch(24.54% 0.0522 323.99deg);
8187
+ inherits: true;
8188
+ }
8189
+ }
8130
8190
  @property --canvas {
8131
8191
  syntax: "<color>";
8132
8192
  initial-value: oklch(100% 0 0deg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.64",
3
+ "version": "0.0.0-dev.65",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -365,6 +365,61 @@ $color-tokens: (
365
365
  ),
366
366
  ),
367
367
  ),
368
+ purple: (
369
+ props: (
370
+ inherits: true,
371
+ ),
372
+ media: (
373
+ base: (
374
+ light: oklch(0.6167 0.2607 326),
375
+ dark: oklch(0.6586 0.2795 325.94),
376
+ ),
377
+ ),
378
+ ),
379
+ purple2: (
380
+ props: (
381
+ inherits: true,
382
+ ),
383
+ media: (
384
+ base: (
385
+ light: oklch(0.7807 0.1464 325.64),
386
+ dark: oklch(0.443 0.1667 326.12),
387
+ ),
388
+ ),
389
+ ),
390
+ purple3: (
391
+ props: (
392
+ inherits: true,
393
+ ),
394
+ media: (
395
+ base: (
396
+ light: oklch(0.8873 0.0728 324.7),
397
+ dark: oklch(0.3288 0.0959 325.84),
398
+ ),
399
+ ),
400
+ ),
401
+ purple4: (
402
+ props: (
403
+ inherits: true,
404
+ ),
405
+ media: (
406
+ base: (
407
+ light: oklch(0.9184 0.0518 323.99),
408
+ dark: oklch(0.2981 0.0724 325.02),
409
+ ),
410
+ ),
411
+ ),
412
+ purple5: (
413
+ props: (
414
+ inherits: true,
415
+ ),
416
+ media: (
417
+ base: (
418
+ light: oklch(0.9455 0.0358 323.99),
419
+ dark: oklch(0.2454 0.0522 323.99),
420
+ ),
421
+ ),
422
+ ),
368
423
  //orangeemphasis light: oklch(0.6414 0.157 55.97) dark: oklch(0.83 0.1633 79.36)
369
424
  // SECTION: SystemColor
370
425
  canvas: (
@@ -655,6 +655,10 @@
655
655
  {
656
656
  "name": "orange",
657
657
  "description": "system orange color"
658
+ },
659
+ {
660
+ "name": "purple",
661
+ "description": "system purple color"
658
662
  }
659
663
  ]
660
664
  },
@@ -672,6 +676,26 @@
672
676
  {
673
677
  "name": "blue.secondary",
674
678
  "description": "system secondary blue color"
679
+ },
680
+ {
681
+ "name": "gray",
682
+ "description": "system gray color"
683
+ },
684
+ {
685
+ "name": "red",
686
+ "description": "system red color"
687
+ },
688
+ {
689
+ "name": "green",
690
+ "description": "system green color"
691
+ },
692
+ {
693
+ "name": "orange",
694
+ "description": "system orange color"
695
+ },
696
+ {
697
+ "name": "purple",
698
+ "description": "system purple color"
675
699
  }
676
700
  ]
677
701
  },