@xihan-ui/web-components 1.0.0-alpha.1 → 1.0.0-alpha.2
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 +58 -0
- package/custom-elements.json +60 -0
- package/dist/backgrounds.js +1 -1
- package/dist/define.d.ts +37 -28
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +102 -11
- package/dist/define.js.map +1 -1
- package/dist/{element-BxtVEMuI.js → element-BHyfNDKE.js} +2 -2
- package/dist/{element-BxtVEMuI.js.map → element-BHyfNDKE.js.map} +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{machine-controller-Cq9t_cfJ.js → machine-controller-B1dE9_NF.js} +45 -4
- package/dist/machine-controller-B1dE9_NF.js.map +1 -0
- package/package.json +12 -11
- package/dist/machine-controller-Cq9t_cfJ.js.map +0 -1
package/dist/define.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { a as containsPart, i as PART_ATTR, o as discoverParts, r as createSpreader, s as wcNormalize, t as MachineController } from "./machine-controller-
|
|
1
|
+
import { a as containsPart, i as PART_ATTR, o as discoverParts, r as createSpreader, s as wcNormalize, t as MachineController } from "./machine-controller-B1dE9_NF.js";
|
|
2
2
|
import { t as defineElement } from "./registry-DR6I2_zF.js";
|
|
3
|
-
import { n as version, t as XhReactiveElement } from "./element-
|
|
3
|
+
import { n as version, t as XhReactiveElement } from "./element-BHyfNDKE.js";
|
|
4
4
|
import { DIAGNOSTIC_CODES, createCounterIdGenerator, createRuntimeConfig, createScope, getDiagnostics, reportDiagnostic } from "@xihan-ui/kernel";
|
|
5
5
|
import { ITEM_VALUE_ATTR, declaredItemDisabled, isItemDisabled } from "@xihan-ui/behavior";
|
|
6
6
|
import { accordionAnatomy, accordionMachine, accordionMeta, affixAnatomy, affixMachine, affixMeta, alertAnatomy, alertMachine, alertMeta, anchorAnatomy, anchorMachine, anchorMeta, autoSizeTextarea, avatarAnatomy, avatarGroupAnatomy, avatarGroupMeta, avatarMachine, avatarMeta, backTopAnatomy, backTopMachine, backTopMeta, badgeAnatomy, badgeMeta, breadcrumbAnatomy, breadcrumbMeta, buttonAnatomy, buttonGroupAnatomy, buttonGroupMeta, buttonMeta, calendarAnatomy, calendarMachine, calendarMeta, cardAnatomy, cardMeta, carouselAnatomy, carouselMachine, carouselMeta, cascaderAnatomy, cascaderMachine, cascaderMeta, checkboxAnatomy, checkboxGroupAnatomy, checkboxGroupMachine, checkboxGroupMeta, checkboxMachine, checkboxMeta, clipboardAnatomy, clipboardMachine, clipboardMeta, codeBlockAnatomy, codeBlockMeta, collapsibleAnatomy, collapsibleMachine, collapsibleMeta, colorPickerAnatomy, colorPickerMachine, colorPickerMeta, colorPickerToChannel, colorPickerToInputChannel, comboboxAnatomy, comboboxMachine, comboboxMeta, composerAnatomy, composerMachine, composerMeta, connectAccordion, connectAffix, connectAlert, connectAnchor, connectAvatar, connectAvatarGroup, connectBackTop, connectBadge, connectBreadcrumb, connectButton, connectButtonGroup, connectCalendar, connectCard, connectCarousel, connectCascader, connectCheckbox, connectCheckboxGroup, connectClipboard, connectCodeBlock, connectCollapsible, connectColorPicker, connectCombobox, connectComposer, connectContextMenu, connectCountdown, connectDateField, connectDatePicker, connectDescriptions, connectDialog, connectDrawer, connectDynamicInput, connectEditable, connectEllipsis, connectEmptyState, connectField, connectFileUpload, connectFlex, connectFloatButton, connectForm, connectGradientText, connectGrid, connectHighlight, connectHoverCard, connectIcon, connectIconWrapper, connectImage, connectImageViewer, connectInfiniteScroll, connectLayout, connectList, connectListbox, connectLoadingBar, connectLog, connectMarquee, connectMention, connectMenu, connectMenubar, connectNavigationMenu, connectNumberAnimation, connectNumberField, connectPageHeader, connectPagination, connectPinInput, connectPopconfirm, connectPopover, connectPopselect, connectProgress, connectQrCode, connectRadioGroup, connectRating, connectResult, connectScrollArea, connectSelect, connectSeparator, connectSideNav, connectSkeleton, connectSlider, connectSpinner, connectSplitter, connectStatistic, connectSteps, connectSwitch, connectTable, connectTabs, connectTagsInput, connectTextField, connectThread, connectTime, connectTimeField, connectTimePicker, connectTimeline, connectToast, connectToaster, connectToggle, connectToggleGroup, connectToolbar, connectTooltip, connectTour, connectTransfer, connectTree, connectTreeSelect, connectTypography, connectVirtualizer, connectWatermark, contextMenuAnatomy, contextMenuMachine, contextMenuMeta, countdownAnatomy, countdownMachine, countdownMeta, dateFieldAnatomy, dateFieldMachine, dateFieldMeta, datePickerAnatomy, datePickerCalendarProps, datePickerFieldEndProps, datePickerFieldProps, datePickerMachine, datePickerMeta, descriptionsAnatomy, descriptionsMeta, dialogAnatomy, dialogMachine, dialogMeta, drawerAnatomy, drawerMachine, drawerMeta, dynamicInputAnatomy, dynamicInputMachine, dynamicInputMeta, editableAnatomy, editableMachine, editableMeta, ellipsisAnatomy, ellipsisMachine, ellipsisMeta, emptyStateAnatomy, emptyStateMeta, fieldAnatomy, fieldMeta, fileUploadAnatomy, fileUploadMachine, fileUploadMeta, flexAnatomy, flexMeta, floatButtonAnatomy, floatButtonMeta, formAnatomy, formMachine, formMeta, gradientTextAnatomy, gradientTextMeta, gridAnatomy, gridMeta, highlightAnatomy, highlightMeta, hoverCardAnatomy, hoverCardMachine, hoverCardMeta, iconAnatomy, iconMeta, iconWrapperAnatomy, iconWrapperMeta, imageAnatomy, imageMachine, imageMeta, imageViewerAnatomy, imageViewerCounterText, imageViewerMachine, imageViewerMeta, infiniteScrollAnatomy, infiniteScrollMachine, infiniteScrollMeta, layoutAnatomy, layoutMachine, layoutMeta, listAnatomy, listMeta, listboxAnatomy, listboxMachine, listboxMeta, loadingBarAnatomy, loadingBarMachine, loadingBarMeta, logAnatomy, logMeta, marqueeAnatomy, marqueeMeta, mentionAnatomy, mentionMachine, mentionMeta, menuAnatomy, menuMachine, menuMeta, menubarAnatomy, menubarMachine, menubarMeta, navigationMenuAnatomy, navigationMenuMachine, navigationMenuMeta, numberAnimationAnatomy, numberAnimationMachine, numberAnimationMeta, numberFieldAnatomy, numberFieldMachine, numberFieldMeta, pageHeaderAnatomy, pageHeaderMeta, paginationAnatomy, paginationMachine, paginationMeta, pinInputAnatomy, pinInputMachine, pinInputMeta, popconfirmAnatomy, popconfirmMeta, popoverAnatomy, popoverMachine, popoverMeta, popselectAnatomy, popselectInitialFocus, popselectMeta, progressAnatomy, progressMeta, qrCodeAnatomy, qrCodeMeta, radioGroupAnatomy, radioGroupMachine, radioGroupMeta, ratingAnatomy, ratingMachine, ratingMeta, resultAnatomy, resultMeta, scrollAreaAnatomy, scrollAreaMachine, scrollAreaMeta, selectAnatomy, selectMachine, selectMeta, separatorAnatomy, separatorMeta, sideNavAnatomy, sideNavMachine, sideNavMeta, skeletonAnatomy, skeletonMeta, sliderAnatomy, sliderMachine, sliderMeta, spinnerAnatomy, spinnerMeta, splitterAnatomy, splitterMachine, splitterMeta, statisticAnatomy, statisticMeta, stepsAnatomy, stepsMachine, stepsMeta, switchAnatomy, switchMachine, switchMeta, tableAnatomy, tableMachine, tableMeta, tabsAnatomy, tabsMachine, tabsMeta, tagsInputAnatomy, tagsInputMachine, tagsInputMeta, textFieldAnatomy, textFieldMachine, textFieldMeta, threadAnatomy, threadMachine, threadMeta, timeAnatomy, timeFieldAnatomy, timeFieldMachine, timeFieldMeta, timeMeta, timePickerAnatomy, timePickerMachine, timePickerMeta, timelineAnatomy, timelineMeta, toastAnatomy, toastMachine, toastMeta, toasterAnatomy, toasterMachine, toasterMeta, toggleAnatomy, toggleGroupAnatomy, toggleGroupMachine, toggleGroupMeta, toggleMachine, toggleMeta, toolbarAnatomy, toolbarMachine, toolbarMeta, tooltipAnatomy, tooltipMachine, tooltipMeta, tourAnatomy, tourMachine, tourMeta, transferAnatomy, transferFocusKey, transferMachine, transferMeta, treeAnatomy, treeMachine, treeMeta, treeSelectAnatomy, treeSelectMachine, treeSelectMeta, typographyAnatomy, typographyMeta, virtualizerAnatomy, virtualizerMachine, virtualizerMeta, watermarkAnatomy, watermarkMeta } from "@xihan-ui/headless";
|
|
7
7
|
import { createPositionEngine } from "@xihan-ui/position";
|
|
8
8
|
import { createHighlighter } from "@xihan-ui/code-highlight";
|
|
9
|
+
import { attachCssExit, createPresence } from "@xihan-ui/behavior/presence";
|
|
9
10
|
//#region src/dom/part-contract.ts
|
|
10
11
|
/**
|
|
11
12
|
* 比对已发现的角色节点与契约:缺必需 part 报 error,出现解剖外的 part 名报 warn。
|
|
@@ -3306,6 +3307,42 @@ var XhDescriptionsElement = class extends XhElement {
|
|
|
3306
3307
|
}
|
|
3307
3308
|
};
|
|
3308
3309
|
//#endregion
|
|
3310
|
+
//#region src/overlay-exit.ts
|
|
3311
|
+
function createOverlayExit(options) {
|
|
3312
|
+
let disposed = false;
|
|
3313
|
+
let node = null;
|
|
3314
|
+
let detach;
|
|
3315
|
+
const presence = createPresence({
|
|
3316
|
+
config: options.config,
|
|
3317
|
+
open: options.open,
|
|
3318
|
+
onRenderedChange: (rendered) => {
|
|
3319
|
+
if (!rendered && !disposed) options.onExitComplete();
|
|
3320
|
+
}
|
|
3321
|
+
});
|
|
3322
|
+
return {
|
|
3323
|
+
get visible() {
|
|
3324
|
+
return !disposed && presence.rendered;
|
|
3325
|
+
},
|
|
3326
|
+
track(next) {
|
|
3327
|
+
if (disposed || next === node) return;
|
|
3328
|
+
node = next;
|
|
3329
|
+
detach?.();
|
|
3330
|
+
detach = next ? attachCssExit(next, presence) : void 0;
|
|
3331
|
+
},
|
|
3332
|
+
update(open) {
|
|
3333
|
+
if (!disposed) presence.update(open);
|
|
3334
|
+
},
|
|
3335
|
+
dispose() {
|
|
3336
|
+
if (disposed) return;
|
|
3337
|
+
disposed = true;
|
|
3338
|
+
detach?.();
|
|
3339
|
+
detach = void 0;
|
|
3340
|
+
node = null;
|
|
3341
|
+
presence.dispose();
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
//#endregion
|
|
3309
3346
|
//#region src/elements/dialog.ts
|
|
3310
3347
|
const BOOLEAN_CONVERTER$40 = { fromAttribute: (v) => v === null ? void 0 : v !== "false" };
|
|
3311
3348
|
const STRING_CONVERTER$62 = { fromAttribute: (v) => v ?? void 0 };
|
|
@@ -3356,6 +3393,7 @@ var XhDialogElement = class extends XhElement {
|
|
|
3356
3393
|
dialogScope = createScope(null, this.idGen);
|
|
3357
3394
|
config = null;
|
|
3358
3395
|
contentNode = null;
|
|
3396
|
+
exit = null;
|
|
3359
3397
|
backdropNode = null;
|
|
3360
3398
|
notify = (details) => {
|
|
3361
3399
|
this.dispatchEvent(new CustomEvent("open-change", {
|
|
@@ -3387,6 +3425,16 @@ var XhDialogElement = class extends XhElement {
|
|
|
3387
3425
|
idGenerator: this.idGen
|
|
3388
3426
|
});
|
|
3389
3427
|
}
|
|
3428
|
+
/** 退场闸门建一次;presence 不是响应式 cell,退场结束要显式排一次更新才轮得到收起。 */
|
|
3429
|
+
ensureExit() {
|
|
3430
|
+
this.ensureConfig();
|
|
3431
|
+
this.exit ??= createOverlayExit({
|
|
3432
|
+
config: this.config,
|
|
3433
|
+
open: this.ctrl.service.state.get() === "open",
|
|
3434
|
+
onExitComplete: () => this.requestUpdate()
|
|
3435
|
+
});
|
|
3436
|
+
return this.exit;
|
|
3437
|
+
}
|
|
3390
3438
|
registerLayer = () => {
|
|
3391
3439
|
this.ensureConfig();
|
|
3392
3440
|
return this.config.layerRegistry.register({
|
|
@@ -3424,13 +3472,20 @@ var XhDialogElement = class extends XhElement {
|
|
|
3424
3472
|
put("title", api.getTitleProps());
|
|
3425
3473
|
put("description", api.getDescriptionProps());
|
|
3426
3474
|
put("close-trigger", api.getCloseTriggerProps());
|
|
3475
|
+
const exit = this.ensureExit();
|
|
3476
|
+
exit.track(this.contentNode);
|
|
3477
|
+
exit.update(open);
|
|
3478
|
+
const visible = exit.visible;
|
|
3427
3479
|
const positioner = this.getPart("positioner");
|
|
3428
|
-
if (positioner) this.setPartHidden(positioner, !
|
|
3429
|
-
if (this.backdropNode) this.setPartHidden(this.backdropNode, !
|
|
3430
|
-
this.setPartHidden(this.contentNode, !
|
|
3480
|
+
if (positioner) this.setPartHidden(positioner, !visible);
|
|
3481
|
+
if (this.backdropNode) this.setPartHidden(this.backdropNode, !visible);
|
|
3482
|
+
this.setPartHidden(this.contentNode, !visible);
|
|
3431
3483
|
}
|
|
3432
3484
|
disconnectedCallback() {
|
|
3433
3485
|
super.disconnectedCallback();
|
|
3486
|
+
this.exit?.dispose();
|
|
3487
|
+
this.exit = null;
|
|
3488
|
+
if (this.ctrl.service.state.get() !== "open") this.setPartHidden(this.contentNode, true);
|
|
3434
3489
|
this.config = null;
|
|
3435
3490
|
}
|
|
3436
3491
|
};
|
|
@@ -3496,6 +3551,7 @@ var XhDrawerElement = class extends XhElement {
|
|
|
3496
3551
|
drawerScope = createScope(null, this.idGen);
|
|
3497
3552
|
config = null;
|
|
3498
3553
|
contentNode = null;
|
|
3554
|
+
exit = null;
|
|
3499
3555
|
backdropNode = null;
|
|
3500
3556
|
notify = (details) => {
|
|
3501
3557
|
this.dispatchEvent(new CustomEvent("open-change", {
|
|
@@ -3530,6 +3586,16 @@ var XhDrawerElement = class extends XhElement {
|
|
|
3530
3586
|
idGenerator: this.idGen
|
|
3531
3587
|
});
|
|
3532
3588
|
}
|
|
3589
|
+
/** 退场闸门建一次;presence 不是响应式 cell,退场结束要显式排一次更新才轮得到收起。 */
|
|
3590
|
+
ensureExit() {
|
|
3591
|
+
this.ensureConfig();
|
|
3592
|
+
this.exit ??= createOverlayExit({
|
|
3593
|
+
config: this.config,
|
|
3594
|
+
open: this.ctrl.service.state.get() === "open",
|
|
3595
|
+
onExitComplete: () => this.requestUpdate()
|
|
3596
|
+
});
|
|
3597
|
+
return this.exit;
|
|
3598
|
+
}
|
|
3533
3599
|
registerLayer = () => {
|
|
3534
3600
|
this.ensureConfig();
|
|
3535
3601
|
return this.config.layerRegistry.register({
|
|
@@ -3568,13 +3634,20 @@ var XhDrawerElement = class extends XhElement {
|
|
|
3568
3634
|
put("title", api.getTitleProps());
|
|
3569
3635
|
put("description", api.getDescriptionProps());
|
|
3570
3636
|
put("close-trigger", api.getCloseTriggerProps());
|
|
3637
|
+
const exit = this.ensureExit();
|
|
3638
|
+
exit.track(this.contentNode);
|
|
3639
|
+
exit.update(open);
|
|
3640
|
+
const visible = exit.visible;
|
|
3571
3641
|
const positioner = this.getPart("positioner");
|
|
3572
|
-
if (positioner) this.setPartHidden(positioner, !
|
|
3573
|
-
if (this.backdropNode) this.setPartHidden(this.backdropNode, !
|
|
3574
|
-
this.setPartHidden(this.contentNode, !
|
|
3642
|
+
if (positioner) this.setPartHidden(positioner, !visible);
|
|
3643
|
+
if (this.backdropNode) this.setPartHidden(this.backdropNode, !visible);
|
|
3644
|
+
this.setPartHidden(this.contentNode, !visible);
|
|
3575
3645
|
}
|
|
3576
3646
|
disconnectedCallback() {
|
|
3577
3647
|
super.disconnectedCallback();
|
|
3648
|
+
this.exit?.dispose();
|
|
3649
|
+
this.exit = null;
|
|
3650
|
+
if (this.ctrl.service.state.get() !== "open") this.setPartHidden(this.contentNode, true);
|
|
3578
3651
|
this.config = null;
|
|
3579
3652
|
}
|
|
3580
3653
|
};
|
|
@@ -5325,6 +5398,7 @@ var XhImageViewerElement = class extends XhElement {
|
|
|
5325
5398
|
viewerScope = createScope(null, this.idGen);
|
|
5326
5399
|
config = null;
|
|
5327
5400
|
contentNode = null;
|
|
5401
|
+
exit = null;
|
|
5328
5402
|
backdropNode = null;
|
|
5329
5403
|
/** counter 的文本归属:首帧为空才代填,作者写过内容就不碰。 */
|
|
5330
5404
|
counterOwned = null;
|
|
@@ -5372,6 +5446,16 @@ var XhImageViewerElement = class extends XhElement {
|
|
|
5372
5446
|
idGenerator: this.idGen
|
|
5373
5447
|
});
|
|
5374
5448
|
}
|
|
5449
|
+
/** 退场闸门建一次;presence 不是响应式 cell,退场结束要显式排一次更新才轮得到收起。 */
|
|
5450
|
+
ensureExit() {
|
|
5451
|
+
this.ensureConfig();
|
|
5452
|
+
this.exit ??= createOverlayExit({
|
|
5453
|
+
config: this.config,
|
|
5454
|
+
open: this.ctrl.service.state.get() === "open",
|
|
5455
|
+
onExitComplete: () => this.requestUpdate()
|
|
5456
|
+
});
|
|
5457
|
+
return this.exit;
|
|
5458
|
+
}
|
|
5375
5459
|
registerLayer = () => {
|
|
5376
5460
|
this.ensureConfig();
|
|
5377
5461
|
return this.config.layerRegistry.register({
|
|
@@ -5425,13 +5509,20 @@ var XhImageViewerElement = class extends XhElement {
|
|
|
5425
5509
|
if (counter.textContent !== text) counter.textContent = text;
|
|
5426
5510
|
}
|
|
5427
5511
|
}
|
|
5512
|
+
const exit = this.ensureExit();
|
|
5513
|
+
exit.track(this.contentNode);
|
|
5514
|
+
exit.update(open);
|
|
5515
|
+
const visible = exit.visible;
|
|
5428
5516
|
const positioner = this.getPart("positioner");
|
|
5429
|
-
if (positioner) this.setPartHidden(positioner, !
|
|
5430
|
-
if (this.backdropNode) this.setPartHidden(this.backdropNode, !
|
|
5431
|
-
this.setPartHidden(this.contentNode, !
|
|
5517
|
+
if (positioner) this.setPartHidden(positioner, !visible);
|
|
5518
|
+
if (this.backdropNode) this.setPartHidden(this.backdropNode, !visible);
|
|
5519
|
+
this.setPartHidden(this.contentNode, !visible);
|
|
5432
5520
|
}
|
|
5433
5521
|
disconnectedCallback() {
|
|
5434
5522
|
super.disconnectedCallback();
|
|
5523
|
+
this.exit?.dispose();
|
|
5524
|
+
this.exit = null;
|
|
5525
|
+
if (this.ctrl.service.state.get() !== "open") this.setPartHidden(this.contentNode, true);
|
|
5435
5526
|
this.config = null;
|
|
5436
5527
|
}
|
|
5437
5528
|
};
|