@swiftwc/ui 0.0.0-dev.1 → 0.0.0-dev.11
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/README.md +15 -0
- package/generated/client/index.d.ts +16 -2
- package/generated/client/index.js +293 -8
- package/generated/components/body-view.d.ts +5 -0
- package/generated/components/body-view.js +11 -0
- package/generated/components/bordered-button.d.ts +7 -0
- package/generated/components/bordered-button.js +20 -0
- package/generated/components/bordered-prominent-button.d.ts +7 -0
- package/generated/components/bordered-prominent-button.js +20 -0
- package/generated/components/borderless-button.d.ts +9 -0
- package/generated/components/borderless-button.js +35 -0
- package/generated/components/confirmation-dialog.d.ts +9 -0
- package/generated/components/confirmation-dialog.js +102 -0
- package/generated/components/date-picker.d.ts +46 -0
- package/generated/components/date-picker.js +430 -0
- package/generated/components/disclosure-group.d.ts +9 -0
- package/generated/components/disclosure-group.js +51 -0
- package/generated/components/form-view.d.ts +6 -0
- package/generated/components/form-view.js +58 -0
- package/generated/components/glass-button.d.ts +6 -0
- package/generated/components/glass-button.js +17 -0
- package/generated/components/glass-prominent-button.d.ts +6 -0
- package/generated/components/glass-prominent-button.js +17 -0
- package/generated/components/index.d.ts +39 -1
- package/generated/components/index.js +38 -5
- package/generated/components/label-view.d.ts +9 -0
- package/generated/components/label-view.js +83 -0
- package/generated/components/list-view.d.ts +5 -0
- package/generated/components/list-view.js +29 -0
- package/generated/components/menu-view.d.ts +9 -0
- package/generated/components/menu-view.js +133 -0
- package/generated/components/navigation-large-title.d.ts +6 -0
- package/generated/components/navigation-large-title.js +177 -0
- package/generated/components/navigation-split-view.d.ts +7 -0
- package/generated/components/navigation-split-view.js +18 -0
- package/generated/components/navigation-stack.d.ts +7 -0
- package/generated/components/navigation-stack.js +24 -0
- package/generated/components/navigation-title.d.ts +8 -0
- package/generated/components/navigation-title.js +66 -0
- package/generated/components/picker-view.d.ts +27 -0
- package/generated/components/picker-view.js +442 -0
- package/generated/components/plain-button.d.ts +7 -0
- package/generated/components/plain-button.js +20 -0
- package/generated/components/screen-view.d.ts +5 -0
- package/generated/components/screen-view.js +9 -0
- package/generated/components/scroll-view.d.ts +10 -0
- package/generated/components/scroll-view.js +187 -0
- package/generated/components/section-view.d.ts +9 -0
- package/generated/components/section-view.js +81 -0
- package/generated/components/sheet-view.d.ts +9 -0
- package/generated/components/sheet-view.js +69 -0
- package/generated/components/sidebar-toggle.d.ts +7 -0
- package/generated/components/sidebar-toggle.js +107 -0
- package/generated/components/sidebar-view.d.ts +7 -0
- package/generated/components/sidebar-view.js +29 -0
- package/generated/components/sticky-container.d.ts +6 -0
- package/generated/components/sticky-container.js +22 -0
- package/generated/components/tab-bar.d.ts +7 -0
- package/generated/components/tab-bar.js +33 -0
- package/generated/components/tab-item.d.ts +7 -0
- package/generated/components/tab-item.js +120 -0
- package/generated/components/tab-view.d.ts +22 -0
- package/generated/components/tab-view.js +256 -0
- package/generated/components/table-view.d.ts +7 -0
- package/generated/components/table-view.js +175 -0
- package/generated/components/text-field.d.ts +29 -0
- package/generated/components/text-field.js +489 -0
- package/generated/components/tool-bar-item-group.d.ts +5 -0
- package/generated/components/tool-bar-item-group.js +11 -0
- package/generated/components/tool-bar-item.d.ts +5 -0
- package/generated/components/tool-bar-item.js +19 -0
- package/generated/components/tool-bar.d.ts +7 -0
- package/generated/components/tool-bar.js +77 -0
- package/generated/components/v-keyboard.d.ts +11 -0
- package/generated/components/v-keyboard.js +81 -0
- package/generated/components/v-stack.d.ts +5 -0
- package/generated/components/v-stack.js +11 -0
- package/generated/confirmation-dialog/index.d.ts +1 -0
- package/generated/confirmation-dialog/index.js +1 -0
- package/generated/css/index.css +7463 -0
- package/generated/events/confirmation-dialog.d.ts +9 -0
- package/generated/events/confirmation-dialog.js +1 -0
- package/generated/events/date-picker.d.ts +8 -0
- package/generated/events/date-picker.js +1 -0
- package/generated/events/index.d.ts +7 -0
- package/generated/events/index.js +7 -0
- package/generated/events/lifecycle-observer.d.ts +10 -0
- package/generated/events/lifecycle-observer.js +1 -0
- package/generated/events/picker-view.d.ts +8 -0
- package/generated/events/picker-view.js +1 -0
- package/generated/events/scroll-view.d.ts +10 -0
- package/generated/events/scroll-view.js +1 -0
- package/generated/events/tab-view.d.ts +24 -0
- package/generated/events/tab-view.js +1 -0
- package/generated/events/text-field.d.ts +8 -0
- package/generated/events/text-field.js +1 -0
- package/generated/i18n/index.d.ts +24 -0
- package/generated/i18n/index.js +139 -0
- package/generated/index.js +1 -1
- package/generated/internal/class/cleanup-registry.d.ts +5 -0
- package/generated/internal/class/cleanup-registry.js +38 -0
- package/generated/internal/class/css-style-observer.d.ts +8 -0
- package/generated/internal/class/css-style-observer.js +25 -0
- package/generated/internal/class/form-associated-base.d.ts +20 -0
- package/generated/internal/class/form-associated-base.js +93 -0
- package/generated/internal/class/mutation-observer-singleton.d.ts +10 -0
- package/generated/internal/class/mutation-observer-singleton.js +46 -0
- package/generated/internal/class/navigation-path.d.ts +15 -0
- package/generated/internal/class/navigation-path.js +84 -0
- package/generated/internal/class/navigation-view.d.ts +8 -0
- package/generated/internal/class/navigation-view.js +77 -0
- package/generated/internal/class/resize-observer-singleton.d.ts +7 -0
- package/generated/internal/class/resize-observer-singleton.js +22 -0
- package/generated/internal/decorators/custom-element.d.ts +5 -0
- package/generated/internal/decorators/custom-element.js +4 -0
- package/generated/internal/privateNamespace.d.ts +4 -0
- package/generated/internal/privateNamespace.js +1 -0
- package/generated/internal/utils/add.d.ts +1 -0
- package/generated/internal/utils/add.js +7 -0
- package/generated/internal/utils/cash/ancestors.d.ts +1 -0
- package/generated/internal/utils/cash/ancestors.js +27 -0
- package/generated/internal/utils/cash/index.d.ts +22 -0
- package/generated/internal/utils/cash/index.js +23 -0
- package/generated/internal/utils/cash/next-all.d.ts +1 -0
- package/generated/internal/utils/cash/next-all.js +10 -0
- package/generated/internal/utils/cash/next.d.ts +1 -0
- package/generated/internal/utils/cash/next.js +9 -0
- package/generated/internal/utils/cash/prev-all.d.ts +1 -0
- package/generated/internal/utils/cash/prev-all.js +10 -0
- package/generated/internal/utils/cash/prev.d.ts +1 -0
- package/generated/internal/utils/cash/prev.js +9 -0
- package/generated/internal/utils/cash/prop.d.ts +18 -0
- package/generated/internal/utils/cash/prop.js +30 -0
- package/generated/internal/utils/cash/siblings.d.ts +1 -0
- package/generated/internal/utils/cash/siblings.js +10 -0
- package/generated/internal/utils/clamp.d.ts +1 -0
- package/generated/internal/utils/clamp.js +4 -0
- package/generated/internal/utils/compare-big-decimals.d.ts +1 -0
- package/generated/internal/utils/compare-big-decimals.js +90 -0
- package/generated/internal/utils/css-time.d.ts +1 -0
- package/generated/internal/utils/css-time.js +3 -0
- package/generated/internal/utils/debounce.d.ts +1 -0
- package/generated/internal/utils/debounce.js +13 -0
- package/generated/internal/utils/frame.d.ts +1 -0
- package/generated/internal/utils/frame.js +6 -0
- package/generated/internal/utils/index.d.ts +17 -1
- package/generated/internal/utils/index.js +18 -1
- package/generated/internal/utils/kebab-case.d.ts +1 -1
- package/generated/internal/utils/kebab-case.js +3 -3
- package/generated/internal/utils/list-active.d.ts +7 -0
- package/generated/internal/utils/list-active.js +28 -0
- package/generated/internal/utils/microtask.d.ts +1 -0
- package/generated/internal/utils/microtask.js +3 -0
- package/generated/internal/utils/onoff.d.ts +45 -0
- package/generated/internal/utils/onoff.js +31 -0
- package/generated/internal/utils/set.d.ts +1 -0
- package/generated/internal/utils/set.js +7 -0
- package/generated/internal/utils/sleep.d.ts +1 -0
- package/generated/internal/utils/sleep.js +3 -0
- package/generated/internal/utils/slow-hide-show.d.ts +1 -0
- package/generated/internal/utils/slow-hide-show.js +16 -0
- package/generated/internal/utils/timeout.d.ts +5 -0
- package/generated/internal/utils/timeout.js +16 -0
- package/generated/internal/utils/touch-glass.d.ts +7 -0
- package/generated/internal/utils/touch-glass.js +19 -0
- package/generated/lifecycle-observer/index.d.ts +1 -0
- package/generated/lifecycle-observer/index.js +1 -0
- package/generated/namespace-browser/base.d.ts +36 -0
- package/generated/namespace-browser/base.js +92 -0
- package/generated/namespace-browser/index.d.ts +7 -0
- package/generated/namespace-browser/index.js +1 -0
- package/generated/snapshot/index.d.ts +7 -0
- package/generated/snapshot/index.js +37 -0
- package/package.json +27 -7
- package/scss/_base.scss +5 -0
- package/scss/_components.scss +75 -0
- package/scss/_final.scss +1 -0
- package/scss/_functions.scss +21 -0
- package/scss/_mixins.scss +3 -0
- package/scss/_placeholders.scss +3 -0
- package/scss/_transitions.scss +27 -0
- package/scss/_utils.scss +9 -0
- package/scss/_vars.scss +174 -0
- package/scss/base/_layout.scss +56 -0
- package/scss/base/_reboot.scss +158 -0
- package/scss/base/_root.scss +399 -0
- package/scss/colors/_index.scss +653 -0
- package/scss/components/_body-view.scss +17 -0
- package/scss/components/_bordered-button.scss +22 -0
- package/scss/components/_bordered-prominent-button.scss +19 -0
- package/scss/components/_borderless-button.scss +19 -0
- package/scss/components/_confirmation-dialog.scss +110 -0
- package/scss/components/_date-picker.scss +30 -0
- package/scss/components/_detail-placeholder.scss +155 -0
- package/scss/components/_disclosure-group.scss +128 -0
- package/scss/components/_form-view.scss +195 -0
- package/scss/components/_full-screen.scss +15 -0
- package/scss/components/_glass-button.scss +24 -0
- package/scss/components/_glass-prominent-button.scss +24 -0
- package/scss/components/_h-divider.scss +13 -0
- package/scss/components/_h-stack.scss +39 -0
- package/scss/components/_index.scss +241 -0
- package/scss/components/_label-view.scss +386 -0
- package/scss/components/_labeled-content.scss +9 -0
- package/scss/components/_list-view.scss +229 -0
- package/scss/components/_menu-view.scss +188 -0
- package/scss/components/_navigation-large-title.scss +27 -0
- package/scss/components/_navigation-split-view.scss +424 -0
- package/scss/components/_navigation-stack.scss +11 -0
- package/scss/components/_navigation-title.scss +10 -0
- package/scss/components/_picker-view.scss +122 -0
- package/scss/components/_plain-button.scss +11 -0
- package/scss/components/_scroll-view-proxy.scss +79 -0
- package/scss/components/_scroll-view-toolbars.scss +126 -0
- package/scss/components/_scroll-view.scss +130 -0
- package/scss/components/_section-view.scss +119 -0
- package/scss/components/_sheet-view.scss +93 -0
- package/scss/components/_sidebar-toggle.scss +124 -0
- package/scss/components/_sidebar-view.scss +53 -0
- package/scss/components/_sticky-container.scss +42 -0
- package/scss/components/_tab-bar.scss +254 -0
- package/scss/components/_tab-item.scss +25 -0
- package/scss/components/_tab-view.scss +310 -0
- package/scss/components/_table-column.scss +52 -0
- package/scss/components/_table-row.scss +172 -0
- package/scss/components/_table-view.scss +223 -0
- package/scss/components/_text-field.scss +37 -0
- package/scss/components/_tool-bar-item-group.scss +48 -0
- package/scss/components/_tool-bar-item.scss +145 -0
- package/scss/components/_tool-bar.scss +133 -0
- package/scss/components/_v-divider.scss +13 -0
- package/scss/components/_v-flex-stack.scss +29 -0
- package/scss/components/_v-keyboard.scss +14 -0
- package/scss/components/_v-stack.scss +18 -0
- package/scss/final/_touch-glass.scss +67 -0
- package/scss/index.scss +18 -1
- package/scss/mixins/_dialog.scss +88 -0
- package/scss/mixins/_index.scss +405 -0
- package/scss/placeholders/_buttons.scss +83 -0
- package/scss/placeholders/_lists.scss +589 -0
- package/scss/transitions/_bwd.navbar.scss +19 -0
- package/scss/transitions/_bwd.scss +39 -0
- package/scss/transitions/_confirmation-dialog.scss +19 -0
- package/scss/transitions/_dialog.scss +28 -0
- package/scss/transitions/_disclosure-group.scss +35 -0
- package/scss/transitions/_fwd.navbar.scss +41 -0
- package/scss/transitions/_fwd.scss +24 -0
- package/scss/transitions/_glass-button.scss +12 -0
- package/scss/transitions/_glass-prominent-button.scss +12 -0
- package/scss/transitions/_index.scss +74 -0
- package/scss/transitions/_menu-view.scss +26 -0
- package/scss/transitions/_navigation-split-view.scss +23 -0
- package/scss/transitions/_sidebar-view.scss +36 -0
- package/scss/transitions/_tab-bar.scss +19 -0
- package/scss/utils/_frame.scss +84 -0
- package/scss/utils/_index.scss +68 -0
- package/scss/utils/_scroll-view.scss +14 -0
- package/scss/utils/_spacing.scss +25 -0
- package/scss/utils/_stacks.scss +242 -0
- package/web-components.html-data/en.json +330 -0
- package/generated/internal/snapshot.d.ts +0 -5
- package/generated/internal/snapshot.js +0 -23
- package/generated/styles.css +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function single(types, listener, t, addOptions) {
|
|
2
|
+
const events = types?.split(' ');
|
|
3
|
+
const removeOptions = typeof addOptions === 'boolean' ? addOptions : addOptions !== undefined && 'capture' in addOptions ? { capture: addOptions.capture } : undefined;
|
|
4
|
+
const off = () => {
|
|
5
|
+
for (const event of events)
|
|
6
|
+
t?.removeEventListener(event, listener, removeOptions);
|
|
7
|
+
}, on = () => {
|
|
8
|
+
for (const event of events)
|
|
9
|
+
t?.addEventListener(event, listener, addOptions);
|
|
10
|
+
return off;
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
on,
|
|
14
|
+
off,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default function (typesOrConfigs, listenerOrT, t, addOptions) {
|
|
18
|
+
if (Array.isArray(typesOrConfigs)) {
|
|
19
|
+
const element = listenerOrT, results = typesOrConfigs.map((c) => single(c.types, c.listener, element, c.addOptions)); //, c.t ?? element, c.addOptions))
|
|
20
|
+
const off = () => results.forEach((r) => r.off()), on = () => {
|
|
21
|
+
for (const r of results)
|
|
22
|
+
r.on();
|
|
23
|
+
return off;
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
on,
|
|
27
|
+
off,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return single(typesOrConfigs, listenerOrT, t, addOptions);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function <T extends object, K extends keyof T>(obj: T, key: K, value: T[K]): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (ms: number): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (to: 'show' | 'hide', el?: HTMLElement): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import frame from './frame';
|
|
2
|
+
export default function (to, el) {
|
|
3
|
+
const transcleanup = ({ propertyName }) => {
|
|
4
|
+
if ('opacity' !== propertyName)
|
|
5
|
+
return;
|
|
6
|
+
el?.removeAttribute('slow');
|
|
7
|
+
};
|
|
8
|
+
for (const eventType of ['transitionend', 'transitioncancel'])
|
|
9
|
+
el?.addEventListener(eventType, transcleanup, {
|
|
10
|
+
once: true,
|
|
11
|
+
});
|
|
12
|
+
el?.setAttribute('slow', '');
|
|
13
|
+
frame(el).then(() => {
|
|
14
|
+
el?.setAttribute('slow', to);
|
|
15
|
+
}); //self.requestAnimationFrame(() => el?.setAttribute('slow', to))
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function () {
|
|
2
|
+
let id;
|
|
3
|
+
const cancel = () => {
|
|
4
|
+
if (!id)
|
|
5
|
+
return;
|
|
6
|
+
self.clearTimeout(id);
|
|
7
|
+
id = undefined;
|
|
8
|
+
}, next = (fn, ms) => {
|
|
9
|
+
cancel();
|
|
10
|
+
id = self.setTimeout(() => {
|
|
11
|
+
fn();
|
|
12
|
+
id = undefined;
|
|
13
|
+
}, ms);
|
|
14
|
+
}, pending = () => undefined !== id;
|
|
15
|
+
return { next, cancel, pending };
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const makePointerDownHandler = (target, targetCallback, checkCallback) => {
|
|
2
|
+
return function (evt) {
|
|
3
|
+
// if (event.pointerType !== 'touch') return
|
|
4
|
+
if (!checkCallback(evt))
|
|
5
|
+
return;
|
|
6
|
+
targetCallback(target).toggleAttribute('touch-glass', true);
|
|
7
|
+
};
|
|
8
|
+
}, makePointerCancelHandler = (target, targetCallback) => {
|
|
9
|
+
return function (evt) {
|
|
10
|
+
targetCallback(target).toggleAttribute('touch-glass', false);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default function (t, targetCallback, checkCallback) {
|
|
14
|
+
const onListener = makePointerDownHandler(t, targetCallback, checkCallback), offListener = makePointerCancelHandler(t, targetCallback);
|
|
15
|
+
return [
|
|
16
|
+
{ types: 'pointerdown', listener: onListener, addOptions: { passive: true } },
|
|
17
|
+
{ types: 'pointerup pointercancel pointerleave', listener: offListener, addOptions: { passive: true } },
|
|
18
|
+
];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LifecycleObserver: EventTarget;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LifecycleObserver = new EventTarget();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare abstract class DialogBase extends HTMLDialogElement {
|
|
2
|
+
static polyfillExtends: "dialog";
|
|
3
|
+
static polyfillConnectedCallback(el: HTMLDialogElement): void;
|
|
4
|
+
static polyfillDisconnectedCallback(el: HTMLDialogElement): void;
|
|
5
|
+
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class ButtonBase extends HTMLButtonElement {
|
|
11
|
+
static polyfillExtends: "button";
|
|
12
|
+
static polyfillConnectedCallback(el: HTMLButtonElement): void;
|
|
13
|
+
static polyfillDisconnectedCallback(el: HTMLButtonElement): void;
|
|
14
|
+
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class DetailsBase extends HTMLDetailsElement {
|
|
20
|
+
static polyfillExtends: "details";
|
|
21
|
+
static polyfillConnectedCallback(el: HTMLDetailsElement): void;
|
|
22
|
+
static polyfillDisconnectedCallback(el: HTMLDetailsElement): void;
|
|
23
|
+
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
27
|
+
}
|
|
28
|
+
export declare abstract class FormBase extends HTMLFormElement {
|
|
29
|
+
static polyfillExtends: "form";
|
|
30
|
+
static polyfillConnectedCallback(el: HTMLFormElement): void;
|
|
31
|
+
static polyfillDisconnectedCallback(el: HTMLFormElement): void;
|
|
32
|
+
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export class DialogBase extends HTMLDialogElement {
|
|
2
|
+
static polyfillExtends = 'dialog';
|
|
3
|
+
static polyfillConnectedCallback(el) { }
|
|
4
|
+
static polyfillDisconnectedCallback(el) { }
|
|
5
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
6
|
+
disconnectedCallback() {
|
|
7
|
+
const ctor = this.constructor;
|
|
8
|
+
ctor.polyfillDisconnectedCallback(this);
|
|
9
|
+
}
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
const ctor = this.constructor;
|
|
12
|
+
ctor.polyfillConnectedCallback(this);
|
|
13
|
+
}
|
|
14
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
15
|
+
const ctor = this.constructor;
|
|
16
|
+
const entry = {
|
|
17
|
+
attributeName: name,
|
|
18
|
+
oldValue,
|
|
19
|
+
target: this,
|
|
20
|
+
};
|
|
21
|
+
ctor.polyfillAttributeChangedCallback([entry]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class ButtonBase extends HTMLButtonElement {
|
|
25
|
+
static polyfillExtends = 'button';
|
|
26
|
+
static polyfillConnectedCallback(el) { }
|
|
27
|
+
static polyfillDisconnectedCallback(el) { }
|
|
28
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
const ctor = this.constructor;
|
|
31
|
+
ctor.polyfillDisconnectedCallback(this);
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
const ctor = this.constructor;
|
|
35
|
+
ctor.polyfillConnectedCallback(this);
|
|
36
|
+
}
|
|
37
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
|
+
const ctor = this.constructor;
|
|
39
|
+
const entry = {
|
|
40
|
+
attributeName: name,
|
|
41
|
+
oldValue,
|
|
42
|
+
target: this,
|
|
43
|
+
};
|
|
44
|
+
ctor.polyfillAttributeChangedCallback([entry]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export class DetailsBase extends HTMLDetailsElement {
|
|
48
|
+
static polyfillExtends = 'details';
|
|
49
|
+
static polyfillConnectedCallback(el) { }
|
|
50
|
+
static polyfillDisconnectedCallback(el) { }
|
|
51
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
const ctor = this.constructor;
|
|
54
|
+
ctor.polyfillDisconnectedCallback(this);
|
|
55
|
+
}
|
|
56
|
+
connectedCallback() {
|
|
57
|
+
const ctor = this.constructor;
|
|
58
|
+
ctor.polyfillConnectedCallback(this);
|
|
59
|
+
}
|
|
60
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
61
|
+
const ctor = this.constructor;
|
|
62
|
+
const entry = {
|
|
63
|
+
attributeName: name,
|
|
64
|
+
oldValue,
|
|
65
|
+
target: this,
|
|
66
|
+
};
|
|
67
|
+
ctor.polyfillAttributeChangedCallback([entry]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class FormBase extends HTMLFormElement {
|
|
71
|
+
static polyfillExtends = 'form';
|
|
72
|
+
static polyfillConnectedCallback(el) { }
|
|
73
|
+
static polyfillDisconnectedCallback(el) { }
|
|
74
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
const ctor = this.constructor;
|
|
77
|
+
ctor.polyfillDisconnectedCallback(this);
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
const ctor = this.constructor;
|
|
81
|
+
ctor.polyfillConnectedCallback(this);
|
|
82
|
+
}
|
|
83
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
84
|
+
const ctor = this.constructor;
|
|
85
|
+
const entry = {
|
|
86
|
+
attributeName: name,
|
|
87
|
+
oldValue,
|
|
88
|
+
target: this,
|
|
89
|
+
};
|
|
90
|
+
ctor.polyfillAttributeChangedCallback([entry]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type WebComponentCtor = typeof HTMLElement & {
|
|
2
|
+
observedAttributes?: string[];
|
|
3
|
+
polyfillExtends?: string;
|
|
4
|
+
polyfillConnectedCallback(el: HTMLElement): void;
|
|
5
|
+
polyfillDisconnectedCallback(el: HTMLElement): void;
|
|
6
|
+
polyfillAttributeChangedCallback?(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class Snapshot {
|
|
2
|
+
#private;
|
|
3
|
+
static readonly waitReady: Promise<[unknown, void]>;
|
|
4
|
+
static waitReadyFor<T extends HTMLElement>(element: T): Promise<T | null>;
|
|
5
|
+
static get config(): Record<string, string> | undefined;
|
|
6
|
+
static setOwnConfig(): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class Snapshot {
|
|
2
|
+
static #readyCalled = false;
|
|
3
|
+
static #config;
|
|
4
|
+
static waitReady = Promise.all([
|
|
5
|
+
'complete' === document.readyState ? Promise.resolve() : new Promise((r) => self.addEventListener('load', r, { once: true })),
|
|
6
|
+
(async () => {
|
|
7
|
+
if (!this.#readyCalled)
|
|
8
|
+
await this.setOwnConfig();
|
|
9
|
+
})(), // Lazy config read promise, triggered on first access
|
|
10
|
+
]);
|
|
11
|
+
static async waitReadyFor(element) {
|
|
12
|
+
if (!element.isConnected)
|
|
13
|
+
return null;
|
|
14
|
+
await this.waitReady;
|
|
15
|
+
return element.isConnected ? element : null;
|
|
16
|
+
}
|
|
17
|
+
static get config() {
|
|
18
|
+
return this.#config;
|
|
19
|
+
}
|
|
20
|
+
static async setOwnConfig() {
|
|
21
|
+
if (!this.#readyCalled)
|
|
22
|
+
this.#readyCalled = true;
|
|
23
|
+
if ('complete' !== document.readyState)
|
|
24
|
+
await new Promise((r) => self.addEventListener('load', r, { once: true }));
|
|
25
|
+
this.#getOwnConfig();
|
|
26
|
+
}
|
|
27
|
+
static #getOwnConfig() {
|
|
28
|
+
const style = self.getComputedStyle(document.documentElement, '::before'), content = style.getPropertyValue('content'), unquoted = content.replace(/^"(.*)"$/, '$1'); // Remove quotes around the content
|
|
29
|
+
try {
|
|
30
|
+
this.#config = Object.fromEntries(new URLSearchParams(unquoted).entries()); // {"none": ""}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
console.error('could-not-parse-config');
|
|
34
|
+
}
|
|
35
|
+
console.debug(this.#config);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swiftwc/ui",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
4
|
-
"description": "Elegant SwiftUI-inspired web components for
|
|
3
|
+
"version": "0.0.0-dev.11",
|
|
4
|
+
"description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
"url": "git+https://github.com/swiftwc/ui.git",
|
|
16
16
|
"directory": "packages/ui"
|
|
17
17
|
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/swiftwc/ui/issues"
|
|
20
|
+
},
|
|
18
21
|
"files": [
|
|
19
22
|
"generated",
|
|
20
|
-
"scss"
|
|
23
|
+
"scss",
|
|
24
|
+
"web-components.html-data"
|
|
21
25
|
],
|
|
26
|
+
"sass": "scss/index.scss",
|
|
22
27
|
"keywords": [
|
|
23
28
|
"components",
|
|
24
29
|
"ui",
|
|
@@ -38,7 +43,10 @@
|
|
|
38
43
|
"types": "./generated/client/index.d.ts",
|
|
39
44
|
"default": "./generated/client/index.js"
|
|
40
45
|
},
|
|
41
|
-
"./
|
|
46
|
+
"./css": "./generated/css/index.css",
|
|
47
|
+
"./scss": "./scss/index.scss",
|
|
48
|
+
"./scss/*": "./scss/*.scss",
|
|
49
|
+
"./customElements/en": "./custom-elements/en.json"
|
|
42
50
|
},
|
|
43
51
|
"bin": {
|
|
44
52
|
"swiftwc": "./generated/index.js"
|
|
@@ -46,10 +54,22 @@
|
|
|
46
54
|
"scripts": {
|
|
47
55
|
"prebuild": "rm -rf generated",
|
|
48
56
|
"build": "npm run build:ts && npm run build:scss",
|
|
57
|
+
"build:ts:watch": "npm run prebuild && tsc --watch",
|
|
49
58
|
"build:ts": "tsc",
|
|
50
|
-
"build:scss": "sass --no-source-map scss/index.scss generated/
|
|
59
|
+
"build:scss": "sass --style=expanded --no-source-map scss/index.scss generated/css/index.css",
|
|
60
|
+
"build:manifest": "tsx scripts/make-manifest.ts",
|
|
61
|
+
"build:barrels": "barrelsby -D -q -S -d ./js/components -e \".\\.test\\.ts\"",
|
|
62
|
+
"format:check": "prettier . --check",
|
|
63
|
+
"format:write": "prettier . --write",
|
|
64
|
+
"test": "vitest --dom"
|
|
51
65
|
},
|
|
52
66
|
"devDependencies": {
|
|
53
|
-
"
|
|
54
|
-
|
|
67
|
+
"doctrine": "^3.0.0",
|
|
68
|
+
"happy-dom": "^20.7.0",
|
|
69
|
+
"sass": "^1.98.0",
|
|
70
|
+
"ts-morph": "^28.0.0",
|
|
71
|
+
"tsx": "^4.21.0",
|
|
72
|
+
"vitest": "^4.0.18"
|
|
73
|
+
},
|
|
74
|
+
"customElements": "custom-elements/en.json"
|
|
55
75
|
}
|
package/scss/_base.scss
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@forward 'components/index';
|
|
2
|
+
|
|
3
|
+
@forward 'components/v-keyboard';
|
|
4
|
+
|
|
5
|
+
@forward 'components/disclosure-group';
|
|
6
|
+
|
|
7
|
+
@forward 'components/h-divider';
|
|
8
|
+
@forward 'components/v-divider';
|
|
9
|
+
|
|
10
|
+
@forward 'components/full-screen';
|
|
11
|
+
|
|
12
|
+
@forward 'components/detail-placeholder';
|
|
13
|
+
|
|
14
|
+
@forward 'components/sticky-container';
|
|
15
|
+
|
|
16
|
+
@forward 'components/sheet-view';
|
|
17
|
+
|
|
18
|
+
@forward 'components/confirmation-dialog';
|
|
19
|
+
|
|
20
|
+
@forward 'components/scroll-view';
|
|
21
|
+
@forward 'components/scroll-view-proxy';
|
|
22
|
+
|
|
23
|
+
@forward 'components/h-stack';
|
|
24
|
+
@forward 'components/v-stack';
|
|
25
|
+
@forward 'components/v-flex-stack';
|
|
26
|
+
|
|
27
|
+
@forward 'components/scroll-view-toolbars';
|
|
28
|
+
|
|
29
|
+
@forward 'components/tool-bar-item';
|
|
30
|
+
|
|
31
|
+
@forward 'components/tool-bar-item-group';
|
|
32
|
+
|
|
33
|
+
@forward 'components/plain-button';
|
|
34
|
+
@forward 'components/borderless-button';
|
|
35
|
+
@forward 'components/bordered-button';
|
|
36
|
+
@forward 'components/bordered-prominent-button';
|
|
37
|
+
@forward 'components/glass-button';
|
|
38
|
+
@forward 'components/glass-prominent-button';
|
|
39
|
+
|
|
40
|
+
@forward 'components/tool-bar';
|
|
41
|
+
|
|
42
|
+
@forward 'components/label-view';
|
|
43
|
+
|
|
44
|
+
@forward 'components/labeled-content';
|
|
45
|
+
|
|
46
|
+
// @forward 'components/button-view';
|
|
47
|
+
|
|
48
|
+
@forward 'components/body-view';
|
|
49
|
+
|
|
50
|
+
@forward 'components/navigation-large-title';
|
|
51
|
+
@forward 'components/navigation-title';
|
|
52
|
+
|
|
53
|
+
@forward 'components/sidebar-toggle';
|
|
54
|
+
|
|
55
|
+
@forward 'components/menu-view';
|
|
56
|
+
|
|
57
|
+
@forward 'components/sidebar-view';
|
|
58
|
+
|
|
59
|
+
@forward 'components/list-view';
|
|
60
|
+
@forward 'components/form-view';
|
|
61
|
+
@forward 'components/section-view';
|
|
62
|
+
@forward 'components/table-view';
|
|
63
|
+
@forward 'components/table-row';
|
|
64
|
+
@forward 'components/table-column';
|
|
65
|
+
|
|
66
|
+
@forward 'components/text-field';
|
|
67
|
+
@forward 'components/date-picker';
|
|
68
|
+
@forward 'components/picker-view';
|
|
69
|
+
|
|
70
|
+
@forward 'components/navigation-stack';
|
|
71
|
+
@forward 'components/navigation-split-view';
|
|
72
|
+
|
|
73
|
+
@forward 'components/tab-view';
|
|
74
|
+
@forward 'components/tab-bar';
|
|
75
|
+
@forward 'components/tab-item';
|
package/scss/_final.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward 'final/touch-glass';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
|
|
4
|
+
@function subtract-tiny($value) {
|
|
5
|
+
@if math.unit($value) == 'px' {
|
|
6
|
+
@return $value - 0.01px;
|
|
7
|
+
} @else if math.unit($value) == 'rem' {
|
|
8
|
+
@return $value - 0.0001rem; // “very large” subtraction
|
|
9
|
+
} @else {
|
|
10
|
+
@warn "Unsupported unit: #{unit($value)}";
|
|
11
|
+
@return $value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@function map-to-query($map) {
|
|
16
|
+
$parts: '';
|
|
17
|
+
@each $key, $value in $map {
|
|
18
|
+
$parts: string.insert($parts, '&#{$key}=#{$value}', 0);
|
|
19
|
+
}
|
|
20
|
+
@return string.slice($parts, 2);
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@forward 'transitions/index';
|
|
2
|
+
|
|
3
|
+
@forward 'transitions/fwd';
|
|
4
|
+
|
|
5
|
+
@forward 'transitions/bwd';
|
|
6
|
+
|
|
7
|
+
@forward 'transitions/fwd.navbar';
|
|
8
|
+
|
|
9
|
+
@forward 'transitions/bwd.navbar';
|
|
10
|
+
|
|
11
|
+
@forward 'transitions/dialog';
|
|
12
|
+
|
|
13
|
+
@forward 'transitions/menu-view';
|
|
14
|
+
|
|
15
|
+
@forward 'transitions/glass-button';
|
|
16
|
+
|
|
17
|
+
@forward 'transitions/glass-prominent-button';
|
|
18
|
+
|
|
19
|
+
@forward 'transitions/confirmation-dialog';
|
|
20
|
+
|
|
21
|
+
@forward 'transitions/navigation-split-view';
|
|
22
|
+
|
|
23
|
+
@forward 'transitions/disclosure-group';
|
|
24
|
+
|
|
25
|
+
@forward 'transitions/sidebar-view';
|
|
26
|
+
|
|
27
|
+
@forward 'transitions/tab-bar';
|