@iyulab/components 1.35.1 → 1.35.7
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/CHANGELOG.md +91 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.147.0 → _@oxc-project_runtime@0.148.0}/helpers/esm/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.147.0 → _@oxc-project_runtime@0.148.0}/helpers/esm/decorateMetadata.js +1 -1
- package/dist/assets/locales/ar.json.js +14 -2
- package/dist/assets/locales/de.json.js +14 -2
- package/dist/assets/locales/en.json.js +14 -2
- package/dist/assets/locales/es.json.js +14 -2
- package/dist/assets/locales/fr.json.js +14 -2
- package/dist/assets/locales/id.json.js +14 -2
- package/dist/assets/locales/ja.json.js +14 -2
- package/dist/assets/locales/ko.json.js +14 -2
- package/dist/assets/locales/pt-BR.json.js +14 -2
- package/dist/assets/locales/ru.json.js +14 -2
- package/dist/assets/locales/th.json.js +14 -2
- package/dist/assets/locales/vi.json.js +14 -2
- package/dist/assets/locales/zh-CN.json.js +14 -2
- package/dist/assets/locales/zh-TW.json.js +14 -2
- package/dist/components/UFloatingElement.js +2 -2
- package/dist/components/UFormControlElement.js +3 -3
- package/dist/components/UOverlayElement.js +2 -2
- package/dist/components/alert/UAlert.js +4 -2
- package/dist/components/avatar/UAvatar.js +2 -2
- package/dist/components/badge/UBadge.js +2 -2
- package/dist/components/breadcrumb/UBreadcrumb.js +1 -1
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +2 -2
- package/dist/components/button/UButton.js +3 -3
- package/dist/components/button-group/UButtonGroup.js +2 -2
- package/dist/components/card/UCard.js +2 -2
- package/dist/components/carousel/UCarousel.js +2 -2
- package/dist/components/checkbox/UCheckbox.js +2 -2
- package/dist/components/checkbox/UCheckbox.styles.js +5 -2
- package/dist/components/chip/UChip.js +2 -2
- package/dist/components/copy-button/UCopyButton.js +4 -2
- package/dist/components/date-picker/UDatePicker.js +6 -6
- package/dist/components/dialog/UDialog.js +4 -2
- package/dist/components/divider/UDivider.js +2 -2
- package/dist/components/drawer/UDrawer.js +4 -2
- package/dist/components/expander/UExpander.js +2 -2
- package/dist/components/field/UField.js +2 -2
- package/dist/components/form/UForm.js +2 -2
- package/dist/components/icon/UIcon.js +2 -2
- package/dist/components/icon-button/UIconButton.d.ts +8 -0
- package/dist/components/icon-button/UIconButton.js +18 -2
- package/dist/components/input/UInput.js +6 -2
- package/dist/components/menu/UMenu.js +2 -2
- package/dist/components/menu-item/UMenuItem.js +2 -2
- package/dist/components/option/UOption.js +2 -2
- package/dist/components/panel/UPanel.js +2 -2
- package/dist/components/popover/UPopover.js +2 -2
- package/dist/components/progress-bar/UProgressBar.js +2 -2
- package/dist/components/progress-ring/UProgressRing.js +2 -2
- package/dist/components/radio/URadio.js +2 -2
- package/dist/components/rating/URating.js +2 -2
- package/dist/components/select/USelect.js +2 -2
- package/dist/components/skeleton/USkeleton.js +2 -2
- package/dist/components/slider/USlider.js +3 -3
- package/dist/components/spinner/USpinner.js +2 -2
- package/dist/components/split-panel/USplitPanel.js +2 -2
- package/dist/components/switch/USwitch.js +2 -2
- package/dist/components/tab/UTab.js +2 -2
- package/dist/components/tab-panel/UTabPanel.js +2 -2
- package/dist/components/tag/UTag.js +2 -2
- package/dist/components/text/UText.js +2 -2
- package/dist/components/textarea/UTextarea.js +2 -2
- package/dist/components/tooltip/UTooltip.js +2 -2
- package/dist/components/tree/UTree.js +2 -2
- package/dist/components/tree-item/UTreeItem.js +2 -2
- package/dist/index.js +1 -1
- package/dist/utilities/BrowserStorage.js +3 -3
- package/dist/utilities/Locale.d.ts +1 -1
- package/package.json +2 -1
- package/skills/iyulab-components/references/utilities/browser-storage.md +18 -5
- package/skills/iyulab-components/references/utilities/dialog.md +13 -10
- package/skills/iyulab-components/references/utilities/theme.md +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/components",
|
|
3
3
|
"description": "web-components library based on lit-element made by iyulab",
|
|
4
|
-
"version": "1.35.
|
|
4
|
+
"version": "1.35.7",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"components",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"./plugins/*": "./dist/plugins/*"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
+
"preversion": "node -e \"if(require('fs').existsSync('../../scripts/preversion-check.mjs'))require('child_process').execFileSync('node',['../../scripts/preversion-check.mjs'],{stdio:'inherit'})\"",
|
|
50
51
|
"start": "vite --force",
|
|
51
52
|
"test": "vitest run",
|
|
52
53
|
"test:browser": "vitest run --project=browser",
|
|
@@ -6,6 +6,11 @@ import { BrowserStorage } from '@iyulab/components';
|
|
|
6
6
|
|
|
7
7
|
Unified key-value storage API over `localStorage` or browser cookies.
|
|
8
8
|
|
|
9
|
+
⚠ Cookie storage uses the [Cookie Store API](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore)
|
|
10
|
+
(`window.cookieStore`) — supported in Chromium browsers, not yet in Safari or Firefox as of
|
|
11
|
+
writing. `new BrowserStorage({ type: 'cookie' })` throws `"Cookies are not supported in this
|
|
12
|
+
browser."` where it's unavailable; `localStorage` has no such restriction.
|
|
13
|
+
|
|
9
14
|
## Usage
|
|
10
15
|
|
|
11
16
|
```ts
|
|
@@ -20,7 +25,7 @@ await storage.remove('theme');
|
|
|
20
25
|
const cookieStorage = new BrowserStorage({
|
|
21
26
|
type: 'cookie',
|
|
22
27
|
path: '/',
|
|
23
|
-
|
|
28
|
+
expires: Date.now() + 30 * 24 * 60 * 60 * 1000 // 30 days, ms since epoch
|
|
24
29
|
});
|
|
25
30
|
|
|
26
31
|
await cookieStorage.set('session', 'abc123');
|
|
@@ -37,7 +42,10 @@ await cookieStorage.set('session', 'abc123');
|
|
|
37
42
|
## Types
|
|
38
43
|
|
|
39
44
|
```ts
|
|
40
|
-
type BrowserStorageOptions = LocalStorageOptions | CookieOptions
|
|
45
|
+
type BrowserStorageOptions = (LocalStorageOptions | CookieOptions) & {
|
|
46
|
+
/** Prefix prepended to every key. */
|
|
47
|
+
prefix?: string;
|
|
48
|
+
};
|
|
41
49
|
|
|
42
50
|
interface LocalStorageOptions {
|
|
43
51
|
type: 'localStorage';
|
|
@@ -46,9 +54,14 @@ interface LocalStorageOptions {
|
|
|
46
54
|
interface CookieOptions {
|
|
47
55
|
type: 'cookie';
|
|
48
56
|
path?: string;
|
|
49
|
-
domain?: string;
|
|
50
|
-
|
|
57
|
+
domain?: string | null;
|
|
58
|
+
/** Expiry as ms since epoch (`DOMHighResTimeStamp`). Omit for a session cookie. */
|
|
59
|
+
expires?: DOMHighResTimeStamp | null;
|
|
51
60
|
sameSite?: 'strict' | 'lax' | 'none';
|
|
52
|
-
|
|
61
|
+
/** Partitioned cookie (CHIPS) — isolates the cookie per top-level site in a third-party context. */
|
|
62
|
+
partitioned?: boolean;
|
|
53
63
|
}
|
|
54
64
|
```
|
|
65
|
+
|
|
66
|
+
Only `'localStorage'` and `'cookie'` are valid `type` values — there is no `'sessionStorage'`
|
|
67
|
+
storage backend.
|
|
@@ -17,7 +17,7 @@ const confirmed = await Dialog.confirm('Delete this item?');
|
|
|
17
17
|
if (confirmed) deleteItem();
|
|
18
18
|
|
|
19
19
|
// Prompt — returns entered string or null if cancelled
|
|
20
|
-
const name = await Dialog.prompt('Enter your name:', {
|
|
20
|
+
const name = await Dialog.prompt('Enter your name:', { defaultValue: 'Alice' });
|
|
21
21
|
|
|
22
22
|
// Custom dialog with action buttons
|
|
23
23
|
const result = await Dialog.show({
|
|
@@ -44,26 +44,29 @@ const result = await Dialog.show({
|
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
interface DialogOptions {
|
|
47
|
-
target?: HTMLElement;
|
|
47
|
+
target?: HTMLElement; // shows contained instead of as an overlay when set
|
|
48
48
|
title?: string;
|
|
49
|
-
closable?: boolean;
|
|
50
49
|
placement?: DialogPlacement;
|
|
50
|
+
offset?: number; // gap from the edge, px
|
|
51
|
+
modal?: boolean; // default: true
|
|
52
|
+
buttonClose?: boolean; // show an explicit close button — default: false
|
|
53
|
+
escapeClose?: boolean; // close on Esc — default: true
|
|
54
|
+
backdropClose?: boolean; // close on backdrop click — default: true
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
interface ConfirmDialogOptions extends DialogOptions {
|
|
54
|
-
confirmLabel?: string;
|
|
55
|
-
cancelLabel?: string;
|
|
58
|
+
confirmLabel?: string; // default: 'Confirm'
|
|
59
|
+
cancelLabel?: string; // default: 'Cancel'
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
interface PromptDialogOptions extends
|
|
59
|
-
|
|
62
|
+
interface PromptDialogOptions extends ConfirmDialogOptions {
|
|
63
|
+
type?: InputType; // input field type — default: 'text'
|
|
64
|
+
defaultValue?: string;
|
|
60
65
|
placeholder?: string;
|
|
61
|
-
confirmLabel?: string;
|
|
62
|
-
cancelLabel?: string;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
interface CustomDialogOptions extends DialogOptions {
|
|
66
|
-
content
|
|
69
|
+
content: string | TemplateResult;
|
|
67
70
|
actions?: DialogAction[];
|
|
68
71
|
}
|
|
69
72
|
|