@swiftwc/ui 0.0.0-dev.20 → 0.0.0-dev.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/buses/alert-dialog.d.ts +2 -0
- package/generated/buses/alert-dialog.js +1 -0
- package/generated/buses/confirmation-dialog.d.ts +2 -0
- package/generated/buses/confirmation-dialog.js +1 -0
- package/generated/buses/index.d.ts +6 -0
- package/generated/buses/index.js +6 -0
- package/generated/buses/lifecycle-observer.d.ts +2 -0
- package/generated/buses/lifecycle-observer.js +1 -0
- package/generated/client/index.d.ts +17 -4
- package/generated/client/index.js +83 -32
- package/generated/components/alert-dialog.d.ts +8 -0
- package/generated/components/alert-dialog.js +94 -0
- package/generated/components/bordered-button.d.ts +6 -0
- package/generated/components/bordered-button.js +22 -1
- package/generated/components/bordered-prominent-button.d.ts +6 -0
- package/generated/components/bordered-prominent-button.js +22 -1
- package/generated/components/borderless-button.d.ts +5 -1
- package/generated/components/borderless-button.js +13 -7
- package/generated/components/confirmation-dialog.d.ts +1 -1
- package/generated/components/confirmation-dialog.js +26 -20
- package/generated/components/content-unavailable-view.js +2 -2
- package/generated/components/date-picker.js +24 -10
- package/generated/components/disclosure-group.js +4 -1
- package/generated/components/glass-button.d.ts +6 -0
- package/generated/components/glass-button.js +22 -1
- package/generated/components/glass-prominent-button.d.ts +6 -0
- package/generated/components/glass-prominent-button.js +22 -1
- package/generated/components/index.d.ts +1 -0
- package/generated/components/index.js +1 -0
- package/generated/components/label-view.js +3 -35
- package/generated/components/menu-view.js +12 -7
- package/generated/components/navigation-title.js +4 -4
- package/generated/components/picker-view.js +35 -25
- package/generated/components/scroll-view.js +27 -13
- package/generated/components/section-view.js +3 -3
- package/generated/components/sheet-view.d.ts +1 -2
- package/generated/components/sheet-view.js +38 -22
- package/generated/components/sidebar-toggle.js +6 -4
- package/generated/components/sidebar-view.js +10 -4
- package/generated/components/sticky-container.js +3 -1
- package/generated/components/tab-bar.js +10 -4
- package/generated/components/tab-item.js +3 -1
- package/generated/components/tab-view.js +11 -8
- package/generated/components/table-view.js +22 -10
- package/generated/components/text-field.js +37 -32
- package/generated/components/tool-bar-item-group.js +17 -0
- package/generated/components/tool-bar-item.js +20 -1
- package/generated/components/tool-bar.d.ts +12 -0
- package/generated/components/tool-bar.js +20 -7
- package/generated/components/v-stack.d.ts +5 -0
- package/generated/components/v-stack.js +5 -0
- package/generated/css/index.css +377 -86
- package/generated/events/alert-dialog.d.ts +8 -0
- package/generated/events/alert-dialog.js +1 -0
- package/generated/events/confirmation-dialog.d.ts +2 -2
- package/generated/events/index.d.ts +1 -0
- package/generated/events/index.js +1 -0
- package/generated/events/tab-view.d.ts +6 -2
- package/generated/i18n/locales/el.d.ts +9 -0
- package/generated/i18n/locales/el.js +9 -0
- package/generated/i18n/locales/en.d.ts +9 -0
- package/generated/i18n/locales/en.js +9 -0
- package/generated/internal/class/css-style-observer.js +1 -1
- package/generated/internal/class/form-associated-base.js +4 -1
- package/generated/internal/class/navigation-view.js +4 -4
- package/generated/internal/utils/button-role.d.ts +1 -0
- package/generated/internal/utils/button-role.js +39 -0
- package/generated/internal/utils/cash/index.d.ts +4 -3
- package/generated/internal/utils/cash/index.js +6 -4
- package/generated/internal/utils/index.d.ts +2 -0
- package/generated/internal/utils/index.js +2 -0
- package/generated/internal/utils/is-inside.d.ts +1 -0
- package/generated/internal/utils/is-inside.js +4 -0
- package/generated/internal/utils/list-active.js +15 -5
- package/generated/snapshot/index.d.ts +2 -0
- package/generated/snapshot/index.js +21 -0
- package/package.json +7 -4
- package/scss/_components.scss +2 -0
- package/scss/_functions.scss +10 -0
- package/scss/_transitions.scss +1 -0
- package/scss/_vars.scss +5 -0
- package/scss/base/_reboot.scss +10 -0
- package/scss/colors/_index.scss +39 -21
- package/scss/components/_alert-dialog.scss +106 -0
- package/scss/components/_bordered-button.scss +14 -0
- package/scss/components/_bordered-prominent-button.scss +13 -0
- package/scss/components/_borderless-button.scss +4 -0
- package/scss/components/_confirmation-dialog.scss +39 -39
- package/scss/components/_content-unavailable-view.scss +1 -1
- package/scss/components/_disclosure-group.scss +80 -33
- package/scss/components/_glass-button.scss +14 -0
- package/scss/components/_glass-prominent-button.scss +14 -0
- package/scss/components/_h-stack.scss +3 -13
- package/scss/components/_index.scss +1 -0
- package/scss/components/_label-view.scss +42 -16
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_sheet-view.scss +13 -3
- package/scss/components/_tab-bar.scss +5 -0
- package/scss/components/_tool-bar-item.scss +19 -0
- package/scss/components/_tool-bar.scss +25 -0
- package/scss/components/_v-stack.scss +3 -13
- package/scss/final/_touch-glass.scss +7 -0
- package/scss/mixins/_index.scss +17 -0
- package/scss/placeholders/_buttons.scss +87 -10
- package/scss/transitions/_alert-dialog.scss +19 -0
- package/scss/transitions/_tab-bar.scss +6 -5
- package/scss/utils/_frame.scss +7 -0
- package/web-components.html-data/en.json +81 -13
- package/generated/confirmation-dialog/index.d.ts +0 -1
- package/generated/confirmation-dialog/index.js +0 -1
- package/generated/lifecycle-observer/index.d.ts +0 -1
- package/generated/lifecycle-observer/index.js +0 -1
- package/scss/components/_components.scss +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ConfirmationReturnDetail = {
|
|
2
2
|
returnValue: string;
|
|
3
3
|
positionAnchor: string;
|
|
4
4
|
};
|
|
5
5
|
declare global {
|
|
6
6
|
interface HTMLElementEventMap {
|
|
7
|
-
return: CustomEvent<
|
|
7
|
+
'confirmation:return': CustomEvent<ConfirmationReturnDetail>;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type NavigationSplitView, type NavigationStack } from '../components';
|
|
2
2
|
import { type TabBarPlacement } from '../components/tab-view';
|
|
3
|
+
export type TabBeforeDetail = {
|
|
4
|
+
tag: string;
|
|
5
|
+
ms: number;
|
|
6
|
+
};
|
|
3
7
|
export type TabDetail = {
|
|
4
8
|
tag: string;
|
|
5
9
|
};
|
|
@@ -16,8 +20,8 @@ declare global {
|
|
|
16
20
|
tabhide: CustomEvent<TabDetail>;
|
|
17
21
|
tabreveal: CustomEvent<TabDetail>;
|
|
18
22
|
tabswap: CustomEvent<TabDetail>;
|
|
19
|
-
beforetabreveal: CustomEvent<
|
|
20
|
-
beforetabswap: CustomEvent<
|
|
23
|
+
beforetabreveal: CustomEvent<TabBeforeDetail>;
|
|
24
|
+
beforetabswap: CustomEvent<TabBeforeDetail>;
|
|
21
25
|
'tab-view:toggle': CustomEvent<TabViewDetail>;
|
|
22
26
|
'tab-view:adaptable-tab-bar-placement-change': CustomEvent<TabViewAdaptableTabBarPlacementDetail>;
|
|
23
27
|
}
|
|
@@ -4,5 +4,14 @@ declare const _default: () => {
|
|
|
4
4
|
readonly Label: "Κανένα αποτέλεσμα για «{search}»";
|
|
5
5
|
readonly Description: "Ελέγξτε την ορθογραφία ή δοκιμάστε μια νέα αναζήτηση.";
|
|
6
6
|
};
|
|
7
|
+
readonly ButtonRole: {
|
|
8
|
+
readonly Default: {
|
|
9
|
+
readonly Cancel: "Cancel";
|
|
10
|
+
readonly Close: "Close";
|
|
11
|
+
readonly Confirm: "Confirm";
|
|
12
|
+
readonly Destructive: "Διαγραφή";
|
|
13
|
+
readonly OK: "OK";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
7
16
|
};
|
|
8
17
|
export default _default;
|
|
@@ -5,4 +5,13 @@ export default defineTranslations(() => ({
|
|
|
5
5
|
Label: 'Κανένα αποτέλεσμα για «{search}»',
|
|
6
6
|
Description: 'Ελέγξτε την ορθογραφία ή δοκιμάστε μια νέα αναζήτηση.',
|
|
7
7
|
},
|
|
8
|
+
ButtonRole: {
|
|
9
|
+
Default: {
|
|
10
|
+
Cancel: 'Cancel',
|
|
11
|
+
Close: 'Close',
|
|
12
|
+
Confirm: 'Confirm',
|
|
13
|
+
Destructive: 'Διαγραφή',
|
|
14
|
+
OK: 'OK',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
8
17
|
}));
|
|
@@ -4,5 +4,14 @@ declare const _default: () => {
|
|
|
4
4
|
readonly Label: "No Results for ”{search}”";
|
|
5
5
|
readonly Description: "Check the spelling or try a new search.";
|
|
6
6
|
};
|
|
7
|
+
readonly ButtonRole: {
|
|
8
|
+
readonly Default: {
|
|
9
|
+
readonly Cancel: "Cancel";
|
|
10
|
+
readonly Close: "Close";
|
|
11
|
+
readonly Confirm: "Confirm";
|
|
12
|
+
readonly Destructive: "Delete";
|
|
13
|
+
readonly OK: "OK";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
7
16
|
};
|
|
8
17
|
export default _default;
|
|
@@ -5,4 +5,13 @@ export default defineTranslations(() => ({
|
|
|
5
5
|
Label: 'No Results for ”{search}”',
|
|
6
6
|
Description: 'Check the spelling or try a new search.',
|
|
7
7
|
},
|
|
8
|
+
ButtonRole: {
|
|
9
|
+
Default: {
|
|
10
|
+
Cancel: 'Cancel',
|
|
11
|
+
Close: 'Close',
|
|
12
|
+
Confirm: 'Confirm',
|
|
13
|
+
Destructive: 'Delete',
|
|
14
|
+
OK: 'OK',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
8
17
|
}));
|
|
@@ -16,7 +16,7 @@ export class CSSStyleObserver {
|
|
|
16
16
|
this.#cleanups?.();
|
|
17
17
|
}
|
|
18
18
|
#handleTransitionrun = (callback, evt) => {
|
|
19
|
-
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
19
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type} (${evt.propertyName})`);
|
|
20
20
|
if (!this.#options?.properties.some((prop) => evt.propertyName.startsWith(prop)))
|
|
21
21
|
return;
|
|
22
22
|
callback?.(evt);
|
|
@@ -12,7 +12,10 @@ export function getInternals(instance) {
|
|
|
12
12
|
export function makeSlotchangeHandler(t) {
|
|
13
13
|
const handleSlotchange = (evt) => {
|
|
14
14
|
console.debug(`${makeSlotchangeHandler.name} ⚡️ ${evt?.type}`);
|
|
15
|
-
const slot = evt.target
|
|
15
|
+
const slot = evt.target instanceof HTMLSlotElement && evt.target;
|
|
16
|
+
if (!slot)
|
|
17
|
+
return;
|
|
18
|
+
const assigned = slot.assignedElements({ flatten: true });
|
|
16
19
|
observers.syncObservations(trackedElements.get(t) ?? new Set(), assigned, handleTagMutation, ['value', 'label']);
|
|
17
20
|
// for (const el of trackedElements.get(t) ?? [])
|
|
18
21
|
// if (!assigned.includes(el)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { lifecycleObserver } from '../../buses';
|
|
2
3
|
import { CleanupRegistry } from '../../internal/class/cleanup-registry';
|
|
3
|
-
import { LifecycleObserver } from '../../lifecycle-observer';
|
|
4
4
|
import { frame, onoff } from '../utils';
|
|
5
5
|
export class NavigationView extends HTMLElement {
|
|
6
6
|
static get observedAttributes() {
|
|
@@ -16,7 +16,7 @@ export class NavigationView extends HTMLElement {
|
|
|
16
16
|
this.#recentBefore = undefined;
|
|
17
17
|
// this.removeEventListener('tabreveal', this.#handleTabReveal)
|
|
18
18
|
if (this.closest('tab-view'))
|
|
19
|
-
frame().then(() =>
|
|
19
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabhide', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
20
20
|
}
|
|
21
21
|
connectedCallback() {
|
|
22
22
|
if (this.closest('tab-view')) {
|
|
@@ -32,7 +32,7 @@ export class NavigationView extends HTMLElement {
|
|
|
32
32
|
if (this.closest('tab-view'))
|
|
33
33
|
frame(this).then(() => {
|
|
34
34
|
// if (!r) return
|
|
35
|
-
|
|
35
|
+
lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true }));
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -42,7 +42,7 @@ export class NavigationView extends HTMLElement {
|
|
|
42
42
|
break;
|
|
43
43
|
if (!this.closest('tab-view'))
|
|
44
44
|
break; // tabview stuff
|
|
45
|
-
let eventType = this.hasAttribute(name) ? 'tabhide' : 'tabshow', target =
|
|
45
|
+
let eventType = this.hasAttribute(name) ? 'tabhide' : 'tabshow', target = lifecycleObserver;
|
|
46
46
|
// isRecent by 100ms window
|
|
47
47
|
if (this.#recentBefore && performance.now() - this.#recentBefore.time <= 100) {
|
|
48
48
|
if (this.#recentBefore.type === 'beforetabreveal') {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (target: HTMLElement, attributeName: string | null): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { I18n } from '../../i18n';
|
|
2
|
+
import { Snapshot } from '../../snapshot';
|
|
3
|
+
import { CleanupRegistry } from '../class/cleanup-registry';
|
|
4
|
+
import { default as $ } from './cash';
|
|
5
|
+
import onoff from './onoff';
|
|
6
|
+
function renderPlaceholder(el, role) {
|
|
7
|
+
const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'));
|
|
8
|
+
switch (role) {
|
|
9
|
+
case 'cancel':
|
|
10
|
+
label.setAttribute('title', I18n.t('ButtonRole').Default.Cancel);
|
|
11
|
+
label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
|
|
12
|
+
break;
|
|
13
|
+
case 'close':
|
|
14
|
+
label.setAttribute('title', I18n.t('ButtonRole').Default.Close);
|
|
15
|
+
label.setAttribute('system-image', Snapshot.config['close-button-icon']);
|
|
16
|
+
break;
|
|
17
|
+
case 'confirm':
|
|
18
|
+
label.setAttribute('title', I18n.t('ButtonRole').Default.Confirm);
|
|
19
|
+
label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
|
|
20
|
+
break;
|
|
21
|
+
case 'destructive':
|
|
22
|
+
label.setAttribute('title', I18n.t('ButtonRole').Default.Destructive);
|
|
23
|
+
label.setAttribute('system-image', Snapshot.config['delete-button-icon']);
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
label?.remove();
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
// if (role) {
|
|
30
|
+
// label.setAttribute('title', I18n.t('ButtonRole').Default.Destructive)
|
|
31
|
+
// } else label?.remove()
|
|
32
|
+
}
|
|
33
|
+
export default function (target, attributeName) {
|
|
34
|
+
renderPlaceholder(target, target.getAttribute(attributeName ?? ''));
|
|
35
|
+
CleanupRegistry.unregister(target, 'i18n');
|
|
36
|
+
CleanupRegistry.register(target, onoff('localechange', () => {
|
|
37
|
+
renderPlaceholder(target, target.getAttribute(attributeName ?? ''));
|
|
38
|
+
}, I18n.on).on(), 'i18n');
|
|
39
|
+
}
|
|
@@ -5,10 +5,11 @@ import prev from './prev';
|
|
|
5
5
|
import prevAll from './prev-all';
|
|
6
6
|
import prop from './prop';
|
|
7
7
|
import siblings from './siblings';
|
|
8
|
-
declare const DEFAULT: "
|
|
8
|
+
declare const DEFAULT: ">1";
|
|
9
9
|
interface CashFn {
|
|
10
|
-
(innerHTML: string
|
|
11
|
-
(innerHTML: string, selector:
|
|
10
|
+
(innerHTML: string): DocumentFragment;
|
|
11
|
+
<T extends Element = Element>(innerHTML: string, selector: typeof DEFAULT): T;
|
|
12
|
+
<T extends Element = Element>(innerHTML: string, selector: string): T;
|
|
12
13
|
prop: typeof prop;
|
|
13
14
|
nextAll: typeof nextAll;
|
|
14
15
|
prevAll: typeof prevAll;
|
|
@@ -5,12 +5,14 @@ import prev from './prev';
|
|
|
5
5
|
import prevAll from './prev-all';
|
|
6
6
|
import prop from './prop';
|
|
7
7
|
import siblings from './siblings';
|
|
8
|
-
const DEFAULT = '
|
|
9
|
-
const cash = ((innerHTML, selector
|
|
8
|
+
const DEFAULT = '>1';
|
|
9
|
+
const cash = ((innerHTML, selector) => {
|
|
10
10
|
const template = Object.assign(document.createElement('template'), { innerHTML });
|
|
11
|
+
if (!selector)
|
|
12
|
+
return template.content;
|
|
11
13
|
if (selector === DEFAULT)
|
|
12
|
-
return template.content.firstElementChild;
|
|
13
|
-
return template.content;
|
|
14
|
+
return template.content.firstElementChild; // OVERKILL
|
|
15
|
+
return template.content.querySelector('>1' === selector ? ':first-child' : selector);
|
|
14
16
|
});
|
|
15
17
|
cash.prop = prop;
|
|
16
18
|
cash.nextAll = nextAll;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import cash from './cash';
|
|
2
2
|
export { default as add } from './add';
|
|
3
|
+
export { default as buttonRole } from './button-role';
|
|
3
4
|
export { default as clamp } from './clamp';
|
|
4
5
|
export { default as compareBigDecimals } from './compare-big-decimals';
|
|
5
6
|
export { default as cssTime } from './css-time';
|
|
6
7
|
export { default as debounce } from './debounce';
|
|
7
8
|
export { default as frame } from './frame';
|
|
9
|
+
export { default as isInside } from './is-inside';
|
|
8
10
|
export { default as kebabCase } from './kebab-case';
|
|
9
11
|
export { default as listActive } from './list-active';
|
|
10
12
|
export { default as microtask } from './microtask';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// import * as _intl from './intl'
|
|
2
2
|
import cash from './cash';
|
|
3
3
|
export { default as add } from './add';
|
|
4
|
+
export { default as buttonRole } from './button-role';
|
|
4
5
|
export { default as clamp } from './clamp';
|
|
5
6
|
export { default as compareBigDecimals } from './compare-big-decimals';
|
|
6
7
|
export { default as cssTime } from './css-time';
|
|
7
8
|
export { default as debounce } from './debounce';
|
|
8
9
|
export { default as frame } from './frame';
|
|
10
|
+
export { default as isInside } from './is-inside';
|
|
9
11
|
export { default as kebabCase } from './kebab-case';
|
|
10
12
|
export { default as listActive } from './list-active';
|
|
11
13
|
export { default as microtask } from './microtask';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (x: number, y: number, rect: DOMRect): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const touchList = new WeakMap();
|
|
2
2
|
function onDown({ target }) {
|
|
3
|
-
|
|
3
|
+
if (!(target instanceof HTMLElement && target))
|
|
4
|
+
return;
|
|
5
|
+
const el = target.closest('button,summary');
|
|
4
6
|
if (!el)
|
|
5
7
|
return;
|
|
6
8
|
touchList.set(el, setTimeout(() => {
|
|
@@ -12,7 +14,9 @@ function onDown({ target }) {
|
|
|
12
14
|
el.closest('scroll-view')?.addEventListener('scroll', onScroll, { once: true, passive: true });
|
|
13
15
|
}
|
|
14
16
|
function onOver({ target, buttons }) {
|
|
15
|
-
|
|
17
|
+
if (!(target instanceof HTMLElement && target))
|
|
18
|
+
return;
|
|
19
|
+
const el = target.closest('button,summary');
|
|
16
20
|
if (!el)
|
|
17
21
|
return;
|
|
18
22
|
if (0 === buttons)
|
|
@@ -22,7 +26,9 @@ function onOver({ target, buttons }) {
|
|
|
22
26
|
el.addEventListener('pointerleave', onLeave, { once: true, passive: true });
|
|
23
27
|
}
|
|
24
28
|
function onLeave({ target }) {
|
|
25
|
-
|
|
29
|
+
if (!(target instanceof HTMLElement && target))
|
|
30
|
+
return;
|
|
31
|
+
const el = target.closest('button,summary');
|
|
26
32
|
if (!el)
|
|
27
33
|
return;
|
|
28
34
|
el.addEventListener('pointerover', onOver, { once: true, passive: true });
|
|
@@ -36,7 +42,9 @@ function onLeave({ target }) {
|
|
|
36
42
|
// })
|
|
37
43
|
}
|
|
38
44
|
function onCancel({ target }) {
|
|
39
|
-
|
|
45
|
+
if (!(target instanceof HTMLElement && target))
|
|
46
|
+
return;
|
|
47
|
+
const el = target.closest('button,summary');
|
|
40
48
|
if (!el)
|
|
41
49
|
return;
|
|
42
50
|
// self.requestAnimationFrame(() => {
|
|
@@ -50,7 +58,9 @@ function onCancel({ target }) {
|
|
|
50
58
|
// })
|
|
51
59
|
}
|
|
52
60
|
function onScroll({ target }) {
|
|
53
|
-
|
|
61
|
+
if (!(target instanceof HTMLElement && target))
|
|
62
|
+
return;
|
|
63
|
+
for (const el of target.querySelectorAll('button,summary') ?? []) {
|
|
54
64
|
el.classList.remove('active');
|
|
55
65
|
if (touchList.has(el))
|
|
56
66
|
clearTimeout(touchList.get(el));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare class Snapshot {
|
|
2
2
|
#private;
|
|
3
|
+
static get breakpoints(): ReadonlyMap<string, boolean> | undefined;
|
|
4
|
+
static on: EventTarget;
|
|
3
5
|
static readonly waitReady: Promise<[unknown, void]>;
|
|
4
6
|
static waitReadyFor<T extends HTMLElement>(element: T): Promise<T | null>;
|
|
5
7
|
static get config(): Record<string, string> | undefined;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { onoff } from '../internal/utils';
|
|
1
2
|
export class Snapshot {
|
|
2
3
|
static #readyCalled = false;
|
|
3
4
|
static #config;
|
|
5
|
+
static #listeners;
|
|
6
|
+
static #breakpoints;
|
|
7
|
+
static get breakpoints() {
|
|
8
|
+
return this.#breakpoints;
|
|
9
|
+
}
|
|
10
|
+
static on = new EventTarget();
|
|
4
11
|
static waitReady = Promise.all([
|
|
5
12
|
'complete' === document.readyState ? Promise.resolve() : new Promise((r) => self.addEventListener('load', r, { once: true })),
|
|
6
13
|
(async () => {
|
|
@@ -32,6 +39,20 @@ export class Snapshot {
|
|
|
32
39
|
catch {
|
|
33
40
|
console.error('could-not-parse-config');
|
|
34
41
|
}
|
|
42
|
+
for (const off of this.#listeners ?? [])
|
|
43
|
+
off?.();
|
|
44
|
+
this.#listeners = new Set();
|
|
45
|
+
const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${this.#config['ipad-sheet-view-inline-size']}) and (min-height: ${this.#config['ipad-sheet-view-height']})`);
|
|
46
|
+
this.#breakpoints = new Map([['fine_dialog_sheet', mediaQueryList.matches]]);
|
|
47
|
+
this.#listeners.add(onoff('change', (evt) => this.#handleMediaChange(evt, 'fine_dialog_sheet:change'), mediaQueryList).on());
|
|
35
48
|
console.debug(this.#config);
|
|
36
49
|
}
|
|
50
|
+
static #handleMediaChange = ({ type, matches, media }, kind) => {
|
|
51
|
+
console.debug(`${Snapshot.name} ⚡️ ${type}`);
|
|
52
|
+
this.#breakpoints?.set('fine_dialog_sheet', matches);
|
|
53
|
+
this.on.dispatchEvent(new MediaQueryListEvent(kind, {
|
|
54
|
+
matches,
|
|
55
|
+
media,
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
37
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swiftwc/ui",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.22",
|
|
4
4
|
"description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -57,19 +57,22 @@
|
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"prebuild": "rm -rf generated",
|
|
60
|
-
"build": "npm run build:ts && npm run build:scss && npm run build:manifest && npm run build:barrels
|
|
60
|
+
"build": "npm run build:ts && npm run build:scss && npm run build:manifest && npm run build:barrels",
|
|
61
61
|
"postbuild": "npm run format:write",
|
|
62
62
|
"build:ts:watch": "npm run prebuild && tsc --watch",
|
|
63
63
|
"build:ts": "tsc",
|
|
64
64
|
"build:scss": "sass --style=expanded --no-source-map scss/index.scss generated/css/index.css",
|
|
65
65
|
"build:manifest": "tsx scripts/make-manifest.ts",
|
|
66
|
-
"build:barrels": "
|
|
66
|
+
"build:barrels": "npm run build:barrels:components && npm run build:barrels:events && npm run build:barrels:buses && npm run build:barrels:i18n",
|
|
67
|
+
"build:barrels:components": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --directory ./js/components --exclude \".\\.test\\.ts\"",
|
|
68
|
+
"build:barrels:events": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --directory ./js/events --exclude \".\\.test\\.ts\"",
|
|
69
|
+
"build:barrels:buses": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/buses",
|
|
67
70
|
"build:barrels:i18n": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --fullPathname --directory ./js/i18n/locales",
|
|
68
71
|
"format:check": "prettier . --check",
|
|
69
72
|
"format:write": "prettier . --write",
|
|
70
73
|
"test": "vitest --dom",
|
|
71
74
|
"predeploy": "rm -rf generated",
|
|
72
|
-
"deploy":"npm run build:ts && npm run build:scss",
|
|
75
|
+
"deploy": "npm run build:ts && npm run build:scss",
|
|
73
76
|
"version:pkg": "npm version $npm_config_bump --no-git-tag-version --preid=dev"
|
|
74
77
|
},
|
|
75
78
|
"devDependencies": {
|
package/scss/_components.scss
CHANGED
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
@forward 'components/content-unavailable-view';
|
|
19
19
|
|
|
20
20
|
@forward 'components/confirmation-dialog';
|
|
21
|
+
@forward 'components/alert-dialog';
|
|
21
22
|
|
|
22
23
|
@forward 'components/scroll-view';
|
|
23
24
|
@forward 'components/scroll-view-proxy';
|
|
24
25
|
|
|
25
26
|
@forward 'components/h-stack';
|
|
26
27
|
@forward 'components/v-stack';
|
|
28
|
+
@forward 'components/h-flex-stack';
|
|
27
29
|
@forward 'components/v-flex-stack';
|
|
28
30
|
|
|
29
31
|
@forward 'components/scroll-view-toolbars';
|
package/scss/_functions.scss
CHANGED
|
@@ -19,3 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
@return string.slice($parts, 2);
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
@function str-replace($string, $search, $replace: '') {
|
|
24
|
+
$index: string.index($string, $search);
|
|
25
|
+
|
|
26
|
+
@if $index {
|
|
27
|
+
@return string.slice($string, 1, $index - 1) + $replace + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@return $string;
|
|
31
|
+
}
|
package/scss/_transitions.scss
CHANGED
package/scss/_vars.scss
CHANGED
|
@@ -147,6 +147,11 @@ $disclosure-affordance: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000
|
|
|
147
147
|
$table-col-affordance: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor" viewBox="0 0 256 256"%3E%3Cpath d="M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"%3E%3C/path%3E%3C/svg%3E'; // ph-caret-up-bold
|
|
148
148
|
$picker-affordance: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor" viewBox="0 0 256 256"%3E%3Cpath d="M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"%3E%3C/path%3E%3C/svg%3E'; // ph-check-bold
|
|
149
149
|
|
|
150
|
+
$cancel-button-icon: 'x'; // ph-trash
|
|
151
|
+
$close-button-icon: 'x'; // ph-trash
|
|
152
|
+
$confirm-button-icon: 'check'; // ph-trash
|
|
153
|
+
$delete-button-icon: 'trash'; // ph-trash
|
|
154
|
+
|
|
150
155
|
// SECTION: computed(s)
|
|
151
156
|
|
|
152
157
|
$ipad-portrait-bp-max: #{functions.subtract-tiny($ipad-portrait-bp)};
|
package/scss/base/_reboot.scss
CHANGED
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
text-transform: none;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.ph,
|
|
47
|
+
.ph::before {
|
|
48
|
+
display: grid;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
button,
|
|
47
52
|
*::part(button),
|
|
48
53
|
input,
|
|
@@ -149,6 +154,11 @@
|
|
|
149
154
|
// ipad-landscape-bp-min: vars.$ipad-landscape-bp-min,
|
|
150
155
|
ipad-sheet-view-inline-size: vars.$ipad-sheet-view-inline-size,
|
|
151
156
|
ipad-sheet-view-height: vars.$ipad-sheet-view-height,
|
|
157
|
+
//
|
|
158
|
+
cancel-button-icon: vars.$cancel-button-icon,
|
|
159
|
+
close-button-icon: vars.$close-button-icon,
|
|
160
|
+
confirm-button-icon: vars.$confirm-button-icon,
|
|
161
|
+
delete-button-icon: vars.$delete-button-icon,
|
|
152
162
|
);
|
|
153
163
|
|
|
154
164
|
@debug functions.map-to-query($CONFIG);
|
package/scss/colors/_index.scss
CHANGED
|
@@ -439,7 +439,7 @@ $colors: map.merge(
|
|
|
439
439
|
// --canvastext: light-dark(var(--primary-label), var(--primary-label-dark));
|
|
440
440
|
// }
|
|
441
441
|
|
|
442
|
-
:where([is='sheet-view'], [is='full-screen'], [is='confirmation-dialog']) {
|
|
442
|
+
:where([is='sheet-view'], [is='full-screen'], [is='confirmation-dialog'], [is='alert-dialog']) {
|
|
443
443
|
// modify background/secondarybg/tertiarybg etc for ELEVATED STYLES!!
|
|
444
444
|
// ANCHOR: level 1
|
|
445
445
|
--face: var(--background); // IMPORTANT: redeclare references scope or it WONT pick up!
|
|
@@ -488,31 +488,49 @@ $colors: map.merge(
|
|
|
488
488
|
|
|
489
489
|
:where([is='tab-bar']) {
|
|
490
490
|
--toolbaritemtext: light-dark(var(--secondary-text), var(--secondary-text-dark));
|
|
491
|
+
--toolbaritemhighlighttext: light-dark(var(--secondary-text), var(--secondary-text-dark));
|
|
492
|
+
--toolbaritemactivetext: light-dark(var(--secondary-text), var(--secondary-text-dark));
|
|
491
493
|
}
|
|
492
494
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
--toolbaritemface: light-dark(var(--toolbar-cell-bg), var(--toolbar-cell-bg-dark));
|
|
497
|
-
--toolbaritemhighlightface: light-dark(var(--toolbar-cell-focus-bg), var(--toolbar-cell-focus-bg-dark));
|
|
498
|
-
--toolbaritemactiveface: light-dark(var(--toolbar-cell-active-bg), var(--toolbar-cell-active-bg-dark));
|
|
499
|
-
// --toolbaritemtext: light-dark(var(--primary-label), var(--primary-label-dark)); //light-dark(oklch(var(--tint-lch) / 1), oklch(var(--tint-lch-dark) / 1));
|
|
500
|
-
|
|
501
|
-
// @media (pointer: fine) {
|
|
502
|
-
// --toolbaritemface: light-dark(var(--toolbar-cell-bg), var(--toolbar-cell-bg-dark));
|
|
503
|
-
// --toolbaritemhighlightface: light-dark(var(--toolbar-cell-focus-bg), var(--toolbar-cell-focus-bg-dark));
|
|
504
|
-
// --toolbaritemactiveface: light-dark(var(--toolbar-cell-active-bg), var(--toolbar-cell-active-bg-dark));
|
|
505
|
-
// // --toolbaritemtext: light-dark(var(--primary-label), var(--primary-label-dark));
|
|
506
|
-
// }
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
[is='tab-bar'] [is='tab-item'] {
|
|
495
|
+
tool-bar-item,
|
|
496
|
+
tool-bar-item-group,
|
|
497
|
+
navigation-split-view sidebar-toggle {
|
|
510
498
|
:where(&) {
|
|
511
|
-
|
|
512
|
-
|
|
499
|
+
//, list-view) {
|
|
500
|
+
//, [is='form-view'] BREAKS sidebar
|
|
501
|
+
--toolbaritemface: light-dark(var(--toolbar-cell-bg), var(--toolbar-cell-bg-dark));
|
|
502
|
+
--toolbaritemhighlightface: light-dark(var(--toolbar-cell-focus-bg), var(--toolbar-cell-focus-bg-dark));
|
|
503
|
+
--toolbaritemactiveface: light-dark(var(--toolbar-cell-active-bg), var(--toolbar-cell-active-bg-dark));
|
|
504
|
+
// --toolbaritemtext: light-dark(var(--primary-label), var(--primary-label-dark)); //light-dark(oklch(var(--tint-lch) / 1), oklch(var(--tint-lch-dark) / 1));
|
|
505
|
+
|
|
506
|
+
// @media (pointer: fine) {
|
|
507
|
+
// --toolbaritemface: light-dark(var(--toolbar-cell-bg), var(--toolbar-cell-bg-dark));
|
|
508
|
+
// --toolbaritemhighlightface: light-dark(var(--toolbar-cell-focus-bg), var(--toolbar-cell-focus-bg-dark));
|
|
509
|
+
// --toolbaritemactiveface: light-dark(var(--toolbar-cell-active-bg), var(--toolbar-cell-active-bg-dark));
|
|
510
|
+
// // --toolbaritemtext: light-dark(var(--primary-label), var(--primary-label-dark));
|
|
511
|
+
// }
|
|
512
|
+
}
|
|
513
|
+
:where(&[tint]) {
|
|
514
|
+
--toolbaritemtext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
|
|
515
|
+
--toolbaritemhighlighttext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
|
|
516
|
+
--toolbaritemactivetext: oklch(from var(--accentColor) clamp(0, (0.7 - l) * 999, 1) none none);
|
|
517
|
+
|
|
518
|
+
--toolbaritemface: var(--accentColor); //light-dark(var(--accentColor), var(--accentColor));
|
|
519
|
+
--toolbaritemhighlightface: light-dark(
|
|
520
|
+
oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h),
|
|
521
|
+
oklch(from var(--accentColor) min(calc(l * 1.1), 1) min(calc(c * 1.1), c) h)
|
|
522
|
+
);
|
|
523
|
+
--toolbaritemactiveface: light-dark(oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h), oklch(from var(--accentColor) min(calc(l * 1.2), 1) min(calc(c * 1.1), c) h));
|
|
513
524
|
}
|
|
514
525
|
}
|
|
515
526
|
|
|
527
|
+
// [is='tab-bar'] [is='tab-item'] {
|
|
528
|
+
// :where(&) {
|
|
529
|
+
// --toolbaritemhighlighttext: yellow;
|
|
530
|
+
// --toolbaritemactivetext: chocolate;
|
|
531
|
+
// }
|
|
532
|
+
// }
|
|
533
|
+
|
|
516
534
|
sidebar-toggle,
|
|
517
535
|
// tool-bar-item,
|
|
518
536
|
// [is='tab-item'],
|
|
@@ -536,7 +554,7 @@ $colors: map.merge(
|
|
|
536
554
|
}
|
|
537
555
|
}
|
|
538
556
|
|
|
539
|
-
:where([is='confirmation-dialog']) {
|
|
557
|
+
:where([is='confirmation-dialog'], [is='alert-dialog']) {
|
|
540
558
|
--dialogbtnface: light-dark(var(--toolbar-cell-bg), var(--toolbar-cell-bg-dark));
|
|
541
559
|
--dialogbtnhighlightface: light-dark(var(--toolbar-cell-focus-bg), var(--toolbar-cell-focus-bg-dark));
|
|
542
560
|
--dialogbtnactiveface: light-dark(var(--toolbar-cell-active-bg), var(--toolbar-cell-active-bg-dark));
|