@trebired/frontend 0.3.0
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 +30 -0
- package/LICENSE +661 -0
- package/README.md +212 -0
- package/dist/actions/buttons.d.ts +8 -0
- package/dist/actions/buttons.d.ts.map +1 -0
- package/dist/actions/buttons.js +116 -0
- package/dist/actions/buttons.js.map +1 -0
- package/dist/actions/components/index.d.ts +26 -0
- package/dist/actions/components/index.d.ts.map +1 -0
- package/dist/actions/components/index.js +25 -0
- package/dist/actions/components/index.js.map +1 -0
- package/dist/actions/confetti.d.ts +12 -0
- package/dist/actions/confetti.d.ts.map +1 -0
- package/dist/actions/confetti.js +36 -0
- package/dist/actions/confetti.js.map +1 -0
- package/dist/actions/forms.d.ts +12 -0
- package/dist/actions/forms.d.ts.map +1 -0
- package/dist/actions/forms.js +159 -0
- package/dist/actions/forms.js.map +1 -0
- package/dist/actions/index.d.ts +8 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +7 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/request.d.ts +13 -0
- package/dist/actions/request.d.ts.map +1 -0
- package/dist/actions/request.js +83 -0
- package/dist/actions/request.js.map +1 -0
- package/dist/actions/response.d.ts +18 -0
- package/dist/actions/response.d.ts.map +1 -0
- package/dist/actions/response.js +104 -0
- package/dist/actions/response.js.map +1 -0
- package/dist/actions/styles/index.scss +42 -0
- package/dist/actions/triggers.d.ts +24 -0
- package/dist/actions/triggers.d.ts.map +1 -0
- package/dist/actions/triggers.js +107 -0
- package/dist/actions/triggers.js.map +1 -0
- package/dist/actions/types.d.ts +63 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +2 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +11 -0
- package/dist/components/index.js.map +1 -0
- package/dist/dom/index.d.ts +26 -0
- package/dist/dom/index.d.ts.map +1 -0
- package/dist/dom/index.js +164 -0
- package/dist/dom/index.js.map +1 -0
- package/dist/flash/components/index.d.ts +28 -0
- package/dist/flash/components/index.d.ts.map +1 -0
- package/dist/flash/components/index.js +27 -0
- package/dist/flash/components/index.js.map +1 -0
- package/dist/flash/dialogs.d.ts +6 -0
- package/dist/flash/dialogs.d.ts.map +1 -0
- package/dist/flash/dialogs.js +120 -0
- package/dist/flash/dialogs.js.map +1 -0
- package/dist/flash/duration.d.ts +8 -0
- package/dist/flash/duration.d.ts.map +1 -0
- package/dist/flash/duration.js +20 -0
- package/dist/flash/duration.js.map +1 -0
- package/dist/flash/elements.d.ts +14 -0
- package/dist/flash/elements.d.ts.map +1 -0
- package/dist/flash/elements.js +67 -0
- package/dist/flash/elements.js.map +1 -0
- package/dist/flash/index.d.ts +8 -0
- package/dist/flash/index.d.ts.map +1 -0
- package/dist/flash/index.js +18 -0
- package/dist/flash/index.js.map +1 -0
- package/dist/flash/stack.d.ts +6 -0
- package/dist/flash/stack.d.ts.map +1 -0
- package/dist/flash/stack.js +56 -0
- package/dist/flash/stack.js.map +1 -0
- package/dist/flash/styles/index.scss +118 -0
- package/dist/flash/toast.d.ts +24 -0
- package/dist/flash/toast.d.ts.map +1 -0
- package/dist/flash/toast.js +67 -0
- package/dist/flash/toast.js.map +1 -0
- package/dist/flash/types.d.ts +29 -0
- package/dist/flash/types.d.ts.map +1 -0
- package/dist/flash/types.js +2 -0
- package/dist/flash/types.js.map +1 -0
- package/dist/http/index.d.ts +30 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +104 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/components/index.d.ts +16 -0
- package/dist/inputs/components/index.d.ts.map +1 -0
- package/dist/inputs/components/index.js +112 -0
- package/dist/inputs/components/index.js.map +1 -0
- package/dist/inputs/index.d.ts +17 -0
- package/dist/inputs/index.d.ts.map +1 -0
- package/dist/inputs/index.js +54 -0
- package/dist/inputs/index.js.map +1 -0
- package/dist/inputs/styles/cropper.scss +244 -0
- package/dist/inputs/styles/field.scss +15 -0
- package/dist/inputs/styles/index.scss +3 -0
- package/dist/inputs/styles/upload.scss +125 -0
- package/dist/inputs/upload/config.d.ts +57 -0
- package/dist/inputs/upload/config.d.ts.map +1 -0
- package/dist/inputs/upload/config.js +61 -0
- package/dist/inputs/upload/config.js.map +1 -0
- package/dist/inputs/upload/crop-session.d.ts +6 -0
- package/dist/inputs/upload/crop-session.d.ts.map +1 -0
- package/dist/inputs/upload/crop-session.js +204 -0
- package/dist/inputs/upload/crop-session.js.map +1 -0
- package/dist/inputs/upload/crop.d.ts +20 -0
- package/dist/inputs/upload/crop.d.ts.map +1 -0
- package/dist/inputs/upload/crop.js +124 -0
- package/dist/inputs/upload/crop.js.map +1 -0
- package/dist/inputs/upload/dom.d.ts +19 -0
- package/dist/inputs/upload/dom.d.ts.map +1 -0
- package/dist/inputs/upload/dom.js +74 -0
- package/dist/inputs/upload/dom.js.map +1 -0
- package/dist/inputs/upload/drop.d.ts +10 -0
- package/dist/inputs/upload/drop.d.ts.map +1 -0
- package/dist/inputs/upload/drop.js +92 -0
- package/dist/inputs/upload/drop.js.map +1 -0
- package/dist/inputs/upload/files.d.ts +14 -0
- package/dist/inputs/upload/files.d.ts.map +1 -0
- package/dist/inputs/upload/files.js +82 -0
- package/dist/inputs/upload/files.js.map +1 -0
- package/dist/inputs/upload/manager.d.ts +36 -0
- package/dist/inputs/upload/manager.d.ts.map +1 -0
- package/dist/inputs/upload/manager.js +236 -0
- package/dist/inputs/upload/manager.js.map +1 -0
- package/dist/inputs/upload/markup.d.ts +30 -0
- package/dist/inputs/upload/markup.d.ts.map +1 -0
- package/dist/inputs/upload/markup.js +118 -0
- package/dist/inputs/upload/markup.js.map +1 -0
- package/dist/inputs/upload/model.d.ts +41 -0
- package/dist/inputs/upload/model.d.ts.map +1 -0
- package/dist/inputs/upload/model.js +76 -0
- package/dist/inputs/upload/model.js.map +1 -0
- package/dist/inputs/upload/state.d.ts +16 -0
- package/dist/inputs/upload/state.d.ts.map +1 -0
- package/dist/inputs/upload/state.js +181 -0
- package/dist/inputs/upload/state.js.map +1 -0
- package/dist/inputs/upload/text.d.ts +7 -0
- package/dist/inputs/upload/text.d.ts.map +1 -0
- package/dist/inputs/upload/text.js +29 -0
- package/dist/inputs/upload/text.js.map +1 -0
- package/dist/inputs/upload/types.d.ts +86 -0
- package/dist/inputs/upload/types.d.ts.map +1 -0
- package/dist/inputs/upload/types.js +2 -0
- package/dist/inputs/upload/types.js.map +1 -0
- package/dist/layer/components/index.d.ts +12 -0
- package/dist/layer/components/index.d.ts.map +1 -0
- package/dist/layer/components/index.js +12 -0
- package/dist/layer/components/index.js.map +1 -0
- package/dist/layer/index.d.ts +22 -0
- package/dist/layer/index.d.ts.map +1 -0
- package/dist/layer/index.js +159 -0
- package/dist/layer/index.js.map +1 -0
- package/dist/layer/styles/index.scss +6 -0
- package/dist/live/components/index.d.ts +15 -0
- package/dist/live/components/index.d.ts.map +1 -0
- package/dist/live/components/index.js +12 -0
- package/dist/live/components/index.js.map +1 -0
- package/dist/live/index.d.ts +29 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +103 -0
- package/dist/live/index.js.map +1 -0
- package/dist/logging/index.d.ts +17 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +68 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/modal/components/index.d.ts +18 -0
- package/dist/modal/components/index.d.ts.map +1 -0
- package/dist/modal/components/index.js +20 -0
- package/dist/modal/components/index.js.map +1 -0
- package/dist/modal/index.d.ts +24 -0
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal/index.js +184 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/modal/styles/index.scss +50 -0
- package/dist/popover/components/index.d.ts +14 -0
- package/dist/popover/components/index.d.ts.map +1 -0
- package/dist/popover/components/index.js +16 -0
- package/dist/popover/components/index.js.map +1 -0
- package/dist/popover/index.d.ts +16 -0
- package/dist/popover/index.d.ts.map +1 -0
- package/dist/popover/index.js +140 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/styles/index.scss +24 -0
- package/dist/progress/components/index.d.ts +10 -0
- package/dist/progress/components/index.d.ts.map +1 -0
- package/dist/progress/components/index.js +14 -0
- package/dist/progress/components/index.js.map +1 -0
- package/dist/progress/index.d.ts +18 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +89 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/styles/index.scss +16 -0
- package/dist/react/index.d.ts +17 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +47 -0
- package/dist/react/index.js.map +1 -0
- package/dist/src/actions/buttons.d.ts +8 -0
- package/dist/src/actions/buttons.d.ts.map +1 -0
- package/dist/src/actions/buttons.js +116 -0
- package/dist/src/actions/buttons.js.map +1 -0
- package/dist/src/actions/components/index.d.ts +26 -0
- package/dist/src/actions/components/index.d.ts.map +1 -0
- package/dist/src/actions/components/index.js +25 -0
- package/dist/src/actions/components/index.js.map +1 -0
- package/dist/src/actions/confetti.d.ts +12 -0
- package/dist/src/actions/confetti.d.ts.map +1 -0
- package/dist/src/actions/confetti.js +36 -0
- package/dist/src/actions/confetti.js.map +1 -0
- package/dist/src/actions/forms.d.ts +12 -0
- package/dist/src/actions/forms.d.ts.map +1 -0
- package/dist/src/actions/forms.js +159 -0
- package/dist/src/actions/forms.js.map +1 -0
- package/dist/src/actions/index.d.ts +8 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +7 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/request.d.ts +13 -0
- package/dist/src/actions/request.d.ts.map +1 -0
- package/dist/src/actions/request.js +83 -0
- package/dist/src/actions/request.js.map +1 -0
- package/dist/src/actions/response.d.ts +18 -0
- package/dist/src/actions/response.d.ts.map +1 -0
- package/dist/src/actions/response.js +104 -0
- package/dist/src/actions/response.js.map +1 -0
- package/dist/src/actions/triggers.d.ts +24 -0
- package/dist/src/actions/triggers.d.ts.map +1 -0
- package/dist/src/actions/triggers.js +107 -0
- package/dist/src/actions/triggers.js.map +1 -0
- package/dist/src/actions/types.d.ts +63 -0
- package/dist/src/actions/types.d.ts.map +1 -0
- package/dist/src/actions/types.js +2 -0
- package/dist/src/actions/types.js.map +1 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +11 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/dom/index.d.ts +26 -0
- package/dist/src/dom/index.d.ts.map +1 -0
- package/dist/src/dom/index.js +164 -0
- package/dist/src/dom/index.js.map +1 -0
- package/dist/src/flash/components/index.d.ts +28 -0
- package/dist/src/flash/components/index.d.ts.map +1 -0
- package/dist/src/flash/components/index.js +27 -0
- package/dist/src/flash/components/index.js.map +1 -0
- package/dist/src/flash/dialogs.d.ts +6 -0
- package/dist/src/flash/dialogs.d.ts.map +1 -0
- package/dist/src/flash/dialogs.js +120 -0
- package/dist/src/flash/dialogs.js.map +1 -0
- package/dist/src/flash/duration.d.ts +8 -0
- package/dist/src/flash/duration.d.ts.map +1 -0
- package/dist/src/flash/duration.js +20 -0
- package/dist/src/flash/duration.js.map +1 -0
- package/dist/src/flash/elements.d.ts +14 -0
- package/dist/src/flash/elements.d.ts.map +1 -0
- package/dist/src/flash/elements.js +67 -0
- package/dist/src/flash/elements.js.map +1 -0
- package/dist/src/flash/index.d.ts +8 -0
- package/dist/src/flash/index.d.ts.map +1 -0
- package/dist/src/flash/index.js +18 -0
- package/dist/src/flash/index.js.map +1 -0
- package/dist/src/flash/stack.d.ts +6 -0
- package/dist/src/flash/stack.d.ts.map +1 -0
- package/dist/src/flash/stack.js +56 -0
- package/dist/src/flash/stack.js.map +1 -0
- package/dist/src/flash/toast.d.ts +24 -0
- package/dist/src/flash/toast.d.ts.map +1 -0
- package/dist/src/flash/toast.js +67 -0
- package/dist/src/flash/toast.js.map +1 -0
- package/dist/src/flash/types.d.ts +29 -0
- package/dist/src/flash/types.d.ts.map +1 -0
- package/dist/src/flash/types.js +2 -0
- package/dist/src/flash/types.js.map +1 -0
- package/dist/src/http/index.d.ts +30 -0
- package/dist/src/http/index.d.ts.map +1 -0
- package/dist/src/http/index.js +104 -0
- package/dist/src/http/index.js.map +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +104 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/inputs/components/index.d.ts +16 -0
- package/dist/src/inputs/components/index.d.ts.map +1 -0
- package/dist/src/inputs/components/index.js +112 -0
- package/dist/src/inputs/components/index.js.map +1 -0
- package/dist/src/inputs/index.d.ts +17 -0
- package/dist/src/inputs/index.d.ts.map +1 -0
- package/dist/src/inputs/index.js +54 -0
- package/dist/src/inputs/index.js.map +1 -0
- package/dist/src/inputs/upload/config.d.ts +57 -0
- package/dist/src/inputs/upload/config.d.ts.map +1 -0
- package/dist/src/inputs/upload/config.js +61 -0
- package/dist/src/inputs/upload/config.js.map +1 -0
- package/dist/src/inputs/upload/crop-session.d.ts +6 -0
- package/dist/src/inputs/upload/crop-session.d.ts.map +1 -0
- package/dist/src/inputs/upload/crop-session.js +204 -0
- package/dist/src/inputs/upload/crop-session.js.map +1 -0
- package/dist/src/inputs/upload/crop.d.ts +20 -0
- package/dist/src/inputs/upload/crop.d.ts.map +1 -0
- package/dist/src/inputs/upload/crop.js +124 -0
- package/dist/src/inputs/upload/crop.js.map +1 -0
- package/dist/src/inputs/upload/dom.d.ts +19 -0
- package/dist/src/inputs/upload/dom.d.ts.map +1 -0
- package/dist/src/inputs/upload/dom.js +74 -0
- package/dist/src/inputs/upload/dom.js.map +1 -0
- package/dist/src/inputs/upload/drop.d.ts +10 -0
- package/dist/src/inputs/upload/drop.d.ts.map +1 -0
- package/dist/src/inputs/upload/drop.js +92 -0
- package/dist/src/inputs/upload/drop.js.map +1 -0
- package/dist/src/inputs/upload/files.d.ts +14 -0
- package/dist/src/inputs/upload/files.d.ts.map +1 -0
- package/dist/src/inputs/upload/files.js +82 -0
- package/dist/src/inputs/upload/files.js.map +1 -0
- package/dist/src/inputs/upload/manager.d.ts +36 -0
- package/dist/src/inputs/upload/manager.d.ts.map +1 -0
- package/dist/src/inputs/upload/manager.js +236 -0
- package/dist/src/inputs/upload/manager.js.map +1 -0
- package/dist/src/inputs/upload/markup.d.ts +30 -0
- package/dist/src/inputs/upload/markup.d.ts.map +1 -0
- package/dist/src/inputs/upload/markup.js +118 -0
- package/dist/src/inputs/upload/markup.js.map +1 -0
- package/dist/src/inputs/upload/model.d.ts +41 -0
- package/dist/src/inputs/upload/model.d.ts.map +1 -0
- package/dist/src/inputs/upload/model.js +76 -0
- package/dist/src/inputs/upload/model.js.map +1 -0
- package/dist/src/inputs/upload/state.d.ts +16 -0
- package/dist/src/inputs/upload/state.d.ts.map +1 -0
- package/dist/src/inputs/upload/state.js +181 -0
- package/dist/src/inputs/upload/state.js.map +1 -0
- package/dist/src/inputs/upload/text.d.ts +7 -0
- package/dist/src/inputs/upload/text.d.ts.map +1 -0
- package/dist/src/inputs/upload/text.js +29 -0
- package/dist/src/inputs/upload/text.js.map +1 -0
- package/dist/src/inputs/upload/types.d.ts +86 -0
- package/dist/src/inputs/upload/types.d.ts.map +1 -0
- package/dist/src/inputs/upload/types.js +2 -0
- package/dist/src/inputs/upload/types.js.map +1 -0
- package/dist/src/layer/components/index.d.ts +12 -0
- package/dist/src/layer/components/index.d.ts.map +1 -0
- package/dist/src/layer/components/index.js +12 -0
- package/dist/src/layer/components/index.js.map +1 -0
- package/dist/src/layer/index.d.ts +22 -0
- package/dist/src/layer/index.d.ts.map +1 -0
- package/dist/src/layer/index.js +159 -0
- package/dist/src/layer/index.js.map +1 -0
- package/dist/src/live/components/index.d.ts +15 -0
- package/dist/src/live/components/index.d.ts.map +1 -0
- package/dist/src/live/components/index.js +12 -0
- package/dist/src/live/components/index.js.map +1 -0
- package/dist/src/live/index.d.ts +29 -0
- package/dist/src/live/index.d.ts.map +1 -0
- package/dist/src/live/index.js +103 -0
- package/dist/src/live/index.js.map +1 -0
- package/dist/src/logging/index.d.ts +17 -0
- package/dist/src/logging/index.d.ts.map +1 -0
- package/dist/src/logging/index.js +68 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/modal/components/index.d.ts +18 -0
- package/dist/src/modal/components/index.d.ts.map +1 -0
- package/dist/src/modal/components/index.js +20 -0
- package/dist/src/modal/components/index.js.map +1 -0
- package/dist/src/modal/index.d.ts +24 -0
- package/dist/src/modal/index.d.ts.map +1 -0
- package/dist/src/modal/index.js +184 -0
- package/dist/src/modal/index.js.map +1 -0
- package/dist/src/popover/components/index.d.ts +14 -0
- package/dist/src/popover/components/index.d.ts.map +1 -0
- package/dist/src/popover/components/index.js +16 -0
- package/dist/src/popover/components/index.js.map +1 -0
- package/dist/src/popover/index.d.ts +16 -0
- package/dist/src/popover/index.d.ts.map +1 -0
- package/dist/src/popover/index.js +140 -0
- package/dist/src/popover/index.js.map +1 -0
- package/dist/src/progress/components/index.d.ts +10 -0
- package/dist/src/progress/components/index.d.ts.map +1 -0
- package/dist/src/progress/components/index.js +14 -0
- package/dist/src/progress/components/index.js.map +1 -0
- package/dist/src/progress/index.d.ts +18 -0
- package/dist/src/progress/index.d.ts.map +1 -0
- package/dist/src/progress/index.js +89 -0
- package/dist/src/progress/index.js.map +1 -0
- package/dist/src/react/index.d.ts +17 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/index.js +47 -0
- package/dist/src/react/index.js.map +1 -0
- package/dist/src/styles/index.d.ts +3 -0
- package/dist/src/styles/index.d.ts.map +1 -0
- package/dist/src/styles/index.js +14 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/theme/components/index.d.ts +14 -0
- package/dist/src/theme/components/index.d.ts.map +1 -0
- package/dist/src/theme/components/index.js +13 -0
- package/dist/src/theme/components/index.js.map +1 -0
- package/dist/src/theme/index.d.ts +26 -0
- package/dist/src/theme/index.d.ts.map +1 -0
- package/dist/src/theme/index.js +119 -0
- package/dist/src/theme/index.js.map +1 -0
- package/dist/src/tooltip/components/index.d.ts +17 -0
- package/dist/src/tooltip/components/index.d.ts.map +1 -0
- package/dist/src/tooltip/components/index.js +20 -0
- package/dist/src/tooltip/components/index.js.map +1 -0
- package/dist/src/tooltip/index.d.ts +10 -0
- package/dist/src/tooltip/index.d.ts.map +1 -0
- package/dist/src/tooltip/index.js +171 -0
- package/dist/src/tooltip/index.js.map +1 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +14 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/tokens.scss +22 -0
- package/dist/styles/utils.scss +220 -0
- package/dist/theme/components/index.d.ts +14 -0
- package/dist/theme/components/index.d.ts.map +1 -0
- package/dist/theme/components/index.js +13 -0
- package/dist/theme/components/index.js.map +1 -0
- package/dist/theme/index.d.ts +26 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +119 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/tooltip/components/index.d.ts +17 -0
- package/dist/tooltip/components/index.d.ts.map +1 -0
- package/dist/tooltip/components/index.js +20 -0
- package/dist/tooltip/components/index.js.map +1 -0
- package/dist/tooltip/index.d.ts +10 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/tooltip/index.js +171 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/tooltip/styles/index.scss +17 -0
- package/package.json +232 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../components/index.js";
|
|
3
|
+
function LayerRoot(props) {
|
|
4
|
+
const { children, className, id = "tbf_layer_root", ...rest } = props;
|
|
5
|
+
return (_jsx("div", { ...rest, className: classNames("tbf-layer-root", className), "data-tbf-layer-root": "", id: id, children: children }));
|
|
6
|
+
}
|
|
7
|
+
function PortalElement(props) {
|
|
8
|
+
const { children, className, z, ...rest } = props;
|
|
9
|
+
return (_jsx("div", { ...rest, className: classNames("tbf-portal", className), "data-tbf-portal": "", "data-tbf-z": z, children: children }));
|
|
10
|
+
}
|
|
11
|
+
export { LayerRoot, PortalElement };
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layer/components/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAU3C,SAAS,SAAS,CAAC,KAAqB;IACtC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtE,OAAO,CACL,iBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,yBAC9B,EAAE,EACtB,EAAE,EAAE,EAAE,YAEL,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAClD,OAAO,CACL,iBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,qBAC9B,EAAE,gBACN,CAAC,YAEZ,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type BindRoot } from "../dom/index.d.ts";
|
|
2
|
+
declare const LAYER_ROOT_ID = "tbf_layer_root";
|
|
3
|
+
declare const Z_INDEX_STEP = 10;
|
|
4
|
+
type ZIndexOptions = {
|
|
5
|
+
ahead?: Element | number | string | null;
|
|
6
|
+
behind?: Element | number | string | null;
|
|
7
|
+
fallback?: number;
|
|
8
|
+
};
|
|
9
|
+
declare function ensureLayerRoot(): HTMLElement;
|
|
10
|
+
declare function portalElement(element: HTMLElement | null): HTMLElement;
|
|
11
|
+
declare function moveLayerElementToTop(element: HTMLElement | null): HTMLElement;
|
|
12
|
+
declare function stackZIndex(base?: number, depth?: number): number;
|
|
13
|
+
declare function resolveElementZIndex(element: HTMLElement | null, fallback?: any): any;
|
|
14
|
+
declare function resolveZIndexSpec(element: HTMLElement | null, options?: ZIndexOptions): any;
|
|
15
|
+
declare function applyZIndex(element: HTMLElement | null, options?: ZIndexOptions): any;
|
|
16
|
+
declare function promoteZIndex(element: HTMLElement | null, options?: ZIndexOptions): number;
|
|
17
|
+
declare function clearZIndex(element: HTMLElement | null): void;
|
|
18
|
+
declare function bindPortals(root?: BindRoot): void;
|
|
19
|
+
declare function elementBySafeId(id: string): Element;
|
|
20
|
+
export { LAYER_ROOT_ID, Z_INDEX_STEP, applyZIndex, bindPortals, clearZIndex, elementBySafeId, ensureLayerRoot, moveLayerElementToTop, portalElement, promoteZIndex, resolveElementZIndex, resolveZIndexSpec, stackZIndex, };
|
|
21
|
+
export type { ZIndexOptions };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,QAAA,MAAM,aAAa,mBAAmB,CAAC;AACvC,QAAA,MAAM,YAAY,KAAK,CAAC;AAGxB,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iBAAS,eAAe,gBAWvB;AAED,iBAAS,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,eAMjD;AAED,iBAAS,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,eAIzD;AAOD,iBAAS,WAAW,CAAC,IAAI,SAAI,EAAE,KAAK,SAAI,UAIvC;AAYD,iBAAS,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,QAAQ,MAAO,OAMzE;AA8BD,iBAAS,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,OAAO,GAAE,aAAkB,OAWlF;AAED,iBAAS,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,OAAO,GAAE,aAAkB,OAO5E;AAgBD,iBAAS,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,OAAO,GAAE,aAAkB,UAS9E;AAED,iBAAS,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,QAK/C;AAED,iBAAS,WAAW,CAAC,IAAI,GAAE,QAAmB,QAI7C;AAED,iBAAS,eAAe,CAAC,EAAE,EAAE,MAAM,WAElC;AAED,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,GACZ,CAAC;AACF,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { cssEscape, queryAll } from "../dom/index.js";
|
|
2
|
+
const LAYER_ROOT_ID = "tbf_layer_root";
|
|
3
|
+
const Z_INDEX_STEP = 10;
|
|
4
|
+
const resolvedZIndexElements = new Set();
|
|
5
|
+
function ensureLayerRoot() {
|
|
6
|
+
if (typeof document === "undefined")
|
|
7
|
+
return null;
|
|
8
|
+
const existing = document.getElementById(LAYER_ROOT_ID);
|
|
9
|
+
if (existing instanceof HTMLElement)
|
|
10
|
+
return existing;
|
|
11
|
+
const root = document.createElement("div");
|
|
12
|
+
root.id = LAYER_ROOT_ID;
|
|
13
|
+
root.className = "tbf-layer-root";
|
|
14
|
+
root.setAttribute("data-tbf-layer-root", "");
|
|
15
|
+
document.body.appendChild(root);
|
|
16
|
+
return root;
|
|
17
|
+
}
|
|
18
|
+
function portalElement(element) {
|
|
19
|
+
if (!element)
|
|
20
|
+
return null;
|
|
21
|
+
const root = ensureLayerRoot();
|
|
22
|
+
if (!root || element === root)
|
|
23
|
+
return root;
|
|
24
|
+
if (element.parentNode !== root)
|
|
25
|
+
root.appendChild(element);
|
|
26
|
+
return root;
|
|
27
|
+
}
|
|
28
|
+
function moveLayerElementToTop(element) {
|
|
29
|
+
const root = portalElement(element);
|
|
30
|
+
if (root && element && element.parentNode === root)
|
|
31
|
+
root.appendChild(element);
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
function parseNumber(value) {
|
|
35
|
+
const parsed = Number.parseInt(String(value || "").trim(), 10);
|
|
36
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
37
|
+
}
|
|
38
|
+
function stackZIndex(base = 0, depth = 0) {
|
|
39
|
+
const safeBase = Number.isFinite(base) ? Number(base) : 0;
|
|
40
|
+
const safeDepth = Number.isFinite(depth) ? Number(depth) : 0;
|
|
41
|
+
return safeBase + safeDepth * Z_INDEX_STEP;
|
|
42
|
+
}
|
|
43
|
+
function readComputedZIndex(element) {
|
|
44
|
+
if (!element || typeof window === "undefined")
|
|
45
|
+
return null;
|
|
46
|
+
let raw = "";
|
|
47
|
+
try {
|
|
48
|
+
raw = window.getComputedStyle(element).zIndex;
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
51
|
+
if (!raw || raw === "auto")
|
|
52
|
+
return null;
|
|
53
|
+
return parseNumber(raw);
|
|
54
|
+
}
|
|
55
|
+
function resolveElementZIndex(element, fallback = null) {
|
|
56
|
+
if (!element)
|
|
57
|
+
return fallback;
|
|
58
|
+
const direct = readComputedZIndex(element);
|
|
59
|
+
if (direct !== null)
|
|
60
|
+
return direct;
|
|
61
|
+
const attrValue = parseNumber(element.getAttribute("data-tbf-z-resolved"));
|
|
62
|
+
return attrValue === null ? fallback : attrValue;
|
|
63
|
+
}
|
|
64
|
+
function findReferenceElement(value, current) {
|
|
65
|
+
const token = String(value || "").trim();
|
|
66
|
+
if (!token || typeof document === "undefined")
|
|
67
|
+
return null;
|
|
68
|
+
if (/^(self|this)$/iu.test(token))
|
|
69
|
+
return current;
|
|
70
|
+
if (token.startsWith("#"))
|
|
71
|
+
return document.getElementById(token.slice(1));
|
|
72
|
+
if (token.startsWith("[data-")) {
|
|
73
|
+
try {
|
|
74
|
+
const element = document.querySelector(token);
|
|
75
|
+
return element instanceof HTMLElement ? element : null;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return document.getElementById(token);
|
|
82
|
+
}
|
|
83
|
+
function resolveReferenceValue(value, current, fallback = null) {
|
|
84
|
+
if (value instanceof HTMLElement)
|
|
85
|
+
return resolveElementZIndex(value, fallback);
|
|
86
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
87
|
+
return value;
|
|
88
|
+
const numeric = parseNumber(value);
|
|
89
|
+
if (numeric !== null)
|
|
90
|
+
return numeric;
|
|
91
|
+
return resolveElementZIndex(findReferenceElement(value, current), fallback);
|
|
92
|
+
}
|
|
93
|
+
function resolveZIndexSpec(element, options = {}) {
|
|
94
|
+
const fallback = Number.isFinite(options.fallback) ? Number(options.fallback) : 0;
|
|
95
|
+
const behind = resolveReferenceValue(options.behind, element, fallback);
|
|
96
|
+
if (behind !== null)
|
|
97
|
+
return behind - Z_INDEX_STEP;
|
|
98
|
+
const ahead = resolveReferenceValue(options.ahead, element, fallback);
|
|
99
|
+
if (ahead !== null)
|
|
100
|
+
return ahead + Z_INDEX_STEP;
|
|
101
|
+
const rawSpec = String(element?.getAttribute("data-tbf-z") || "").trim();
|
|
102
|
+
const direct = parseNumber(rawSpec);
|
|
103
|
+
if (direct !== null)
|
|
104
|
+
return direct;
|
|
105
|
+
const reference = rawSpec ? resolveReferenceValue(rawSpec, element, fallback) : null;
|
|
106
|
+
return reference !== null ? reference : fallback;
|
|
107
|
+
}
|
|
108
|
+
function applyZIndex(element, options = {}) {
|
|
109
|
+
if (!element)
|
|
110
|
+
return null;
|
|
111
|
+
const value = resolveZIndexSpec(element, options);
|
|
112
|
+
element.style.zIndex = String(value);
|
|
113
|
+
element.setAttribute("data-tbf-z-resolved", String(value));
|
|
114
|
+
resolvedZIndexElements.add(element);
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
function highestResolvedZIndex(current, fallback = null) {
|
|
118
|
+
let max = fallback;
|
|
119
|
+
for (const element of Array.from(resolvedZIndexElements)) {
|
|
120
|
+
if (!element.isConnected) {
|
|
121
|
+
resolvedZIndexElements.delete(element);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (current && (element === current || element.contains(current)))
|
|
125
|
+
continue;
|
|
126
|
+
const value = resolveElementZIndex(element, null);
|
|
127
|
+
if (value !== null)
|
|
128
|
+
max = max === null ? value : Math.max(max, value);
|
|
129
|
+
}
|
|
130
|
+
return max;
|
|
131
|
+
}
|
|
132
|
+
function promoteZIndex(element, options = {}) {
|
|
133
|
+
if (!element)
|
|
134
|
+
return null;
|
|
135
|
+
const fallback = Number.isFinite(options.fallback) ? Number(options.fallback) : 0;
|
|
136
|
+
const max = highestResolvedZIndex(element, fallback);
|
|
137
|
+
const value = max === null ? fallback : Math.max(fallback, max + Z_INDEX_STEP);
|
|
138
|
+
element.style.zIndex = String(value);
|
|
139
|
+
element.setAttribute("data-tbf-z-resolved", String(value));
|
|
140
|
+
resolvedZIndexElements.add(element);
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
function clearZIndex(element) {
|
|
144
|
+
if (!element)
|
|
145
|
+
return;
|
|
146
|
+
element.style.removeProperty("z-index");
|
|
147
|
+
element.removeAttribute("data-tbf-z-resolved");
|
|
148
|
+
resolvedZIndexElements.delete(element);
|
|
149
|
+
}
|
|
150
|
+
function bindPortals(root = document) {
|
|
151
|
+
queryAll(root, "[data-tbf-portal]").forEach((element) => {
|
|
152
|
+
portalElement(element);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function elementBySafeId(id) {
|
|
156
|
+
return document.querySelector(`#${cssEscape(id)}`);
|
|
157
|
+
}
|
|
158
|
+
export { LAYER_ROOT_ID, Z_INDEX_STEP, applyZIndex, bindPortals, clearZIndex, elementBySafeId, ensureLayerRoot, moveLayerElementToTop, portalElement, promoteZIndex, resolveElementZIndex, resolveZIndexSpec, stackZIndex, };
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,eAAe,CAAC;AAEnE,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAe,CAAC;AAQtD,SAAS,eAAe;IACtB,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IACxD,IAAI,QAAQ,YAAY,WAAW;QAAE,OAAO,QAAQ,CAAC;IAErD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC;IACxB,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC;IAClC,IAAI,CAAC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CAAC;IAC3D,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,OAA2B;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACxC,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC/C,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,WAAW,CAAC,OAAiB,QAAQ;IAC5C,QAAQ,CAAc,IAAI,EAAE,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnE,aAAa,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,EAAU;IACjC,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
type LiveRegionProps = HTMLAttributes<HTMLElement> & {
|
|
3
|
+
as?: "div" | "main" | "section";
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
region: string;
|
|
6
|
+
skip?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type LiveRefreshButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
url?: string;
|
|
10
|
+
};
|
|
11
|
+
declare function LiveRegion(props: LiveRegionProps): import("react").JSX.Element;
|
|
12
|
+
declare function LiveRefreshButton(props: LiveRefreshButtonProps): import("react").JSX.Element;
|
|
13
|
+
export { LiveRefreshButton, LiveRegion };
|
|
14
|
+
export type { LiveRefreshButtonProps, LiveRegionProps };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/live/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7E,KAAK,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACnD,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,sBAAsB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,+BAYzC;AAED,iBAAS,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAavD;AAED,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AACzC,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames, dataBool } from "../../components/index.js";
|
|
3
|
+
function LiveRegion(props) {
|
|
4
|
+
const { as: Tag = "section", children, className, region, skip, ...rest } = props;
|
|
5
|
+
return (_jsx(Tag, { ...rest, className: classNames("tbf-live-region", className), "data-tbf-live-region": region, "data-tbf-live-skip": dataBool(skip), children: children }));
|
|
6
|
+
}
|
|
7
|
+
function LiveRefreshButton(props) {
|
|
8
|
+
const { children, className, type = "button", url, ...rest } = props;
|
|
9
|
+
return (_jsx("button", { ...rest, className: classNames("tbf-button", className), "data-tbf-live-refresh": "", "data-tbf-live-url": url, type: type, children: children }));
|
|
10
|
+
}
|
|
11
|
+
export { LiveRefreshButton, LiveRegion };
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/live/components/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAarD,SAAS,UAAU,CAAC,KAAsB;IACxC,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAClF,OAAO,CACL,KAAC,GAAG,OACE,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,0BAC7B,MAAM,wBACR,QAAQ,CAAC,IAAI,CAAC,YAEjC,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAA6B;IACtD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrE,OAAO,CACL,oBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,2BACxB,EAAE,uBACL,GAAG,EACtB,IAAI,EAAE,IAAI,YAET,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type BindRoot } from "../dom/index.d.ts";
|
|
2
|
+
type LiveSkipAdapter = {
|
|
3
|
+
shouldSkip?: (element: Element) => boolean;
|
|
4
|
+
};
|
|
5
|
+
type LiveOptions = {
|
|
6
|
+
bind?: (root: BindRoot) => void;
|
|
7
|
+
contentSelector?: string;
|
|
8
|
+
skip?: LiveSkipAdapter;
|
|
9
|
+
};
|
|
10
|
+
declare const LIVE_REGION_SELECTOR = "[data-tbf-live-region]";
|
|
11
|
+
declare const LIVE_REFRESH_SELECTOR = "[data-tbf-live-refresh]";
|
|
12
|
+
declare function shouldSkipLiveElement(element: Element, options?: LiveOptions): boolean;
|
|
13
|
+
declare function captureFormState(root: ParentNode): Map<string, {
|
|
14
|
+
checked: boolean;
|
|
15
|
+
value: string;
|
|
16
|
+
}>;
|
|
17
|
+
declare function restoreFormState(root: ParentNode, state: Map<string, {
|
|
18
|
+
checked: boolean;
|
|
19
|
+
value: string;
|
|
20
|
+
}>): void;
|
|
21
|
+
declare function rehydrate(root?: BindRoot, options?: LiveOptions): void;
|
|
22
|
+
declare function replaceLiveRegions(doc: Document, options?: LiveOptions): boolean;
|
|
23
|
+
declare function refreshLive(options?: LiveOptions & {
|
|
24
|
+
url?: string;
|
|
25
|
+
}): Promise<boolean>;
|
|
26
|
+
declare function bindLiveRefresh(root?: BindRoot, options?: LiveOptions): void;
|
|
27
|
+
export { LIVE_REFRESH_SELECTOR, LIVE_REGION_SELECTOR, bindLiveRefresh, captureFormState, refreshLive, rehydrate, replaceLiveRegions, restoreFormState, shouldSkipLiveElement, };
|
|
28
|
+
export type { LiveOptions, LiveSkipAdapter };
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/live/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAExD,KAAK,eAAe,GAAG;IACrB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;CAC5C,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC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
let inflight = false;
|
|
5
|
+
function shouldSkipLiveElement(element, options = {}) {
|
|
6
|
+
if (element.hasAttribute("data-tbf-live-skip"))
|
|
7
|
+
return true;
|
|
8
|
+
return options.skip?.shouldSkip?.(element) === true;
|
|
9
|
+
}
|
|
10
|
+
function captureFormState(root) {
|
|
11
|
+
const state = new Map();
|
|
12
|
+
root.querySelectorAll("input,select,textarea").forEach((element) => {
|
|
13
|
+
const key = element.name || element.id;
|
|
14
|
+
if (!key)
|
|
15
|
+
return;
|
|
16
|
+
state.set(key, {
|
|
17
|
+
checked: element instanceof HTMLInputElement ? element.checked : false,
|
|
18
|
+
value: element.value,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
function restoreFormState(root, state) {
|
|
24
|
+
root.querySelectorAll("input,select,textarea").forEach((element) => {
|
|
25
|
+
const snapshot = state.get(element.name || element.id);
|
|
26
|
+
if (!snapshot)
|
|
27
|
+
return;
|
|
28
|
+
element.value = snapshot.value;
|
|
29
|
+
if (element instanceof HTMLInputElement)
|
|
30
|
+
element.checked = snapshot.checked;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function liveRegionKey(element) {
|
|
34
|
+
return (element.getAttribute("data-tbf-live-region") ||
|
|
35
|
+
element.id ||
|
|
36
|
+
element.getAttribute("data-tbf-live-key") ||
|
|
37
|
+
"").trim();
|
|
38
|
+
}
|
|
39
|
+
function findMatchingRegion(doc, current) {
|
|
40
|
+
const key = liveRegionKey(current);
|
|
41
|
+
if (!key)
|
|
42
|
+
return null;
|
|
43
|
+
const byId = doc.getElementById(key);
|
|
44
|
+
if (byId)
|
|
45
|
+
return byId;
|
|
46
|
+
return doc.querySelector(`[data-tbf-live-region="${CSS.escape(key)}"]`);
|
|
47
|
+
}
|
|
48
|
+
function rehydrate(root = document, options = {}) {
|
|
49
|
+
options.bind?.(root);
|
|
50
|
+
document.dispatchEvent(new CustomEvent("tbf:rehydrate", { detail: { root } }));
|
|
51
|
+
}
|
|
52
|
+
function replaceLiveRegions(doc, options = {}) {
|
|
53
|
+
let changed = false;
|
|
54
|
+
queryAll(document, LIVE_REGION_SELECTOR).forEach((current) => {
|
|
55
|
+
if (shouldSkipLiveElement(current, options))
|
|
56
|
+
return;
|
|
57
|
+
const next = findMatchingRegion(doc, current);
|
|
58
|
+
if (!(next instanceof HTMLElement))
|
|
59
|
+
return;
|
|
60
|
+
const state = captureFormState(current);
|
|
61
|
+
current.replaceChildren(...Array.from(next.childNodes).map((node) => {
|
|
62
|
+
return document.importNode(node, true);
|
|
63
|
+
}));
|
|
64
|
+
restoreFormState(current, state);
|
|
65
|
+
rehydrate(current, options);
|
|
66
|
+
changed = true;
|
|
67
|
+
});
|
|
68
|
+
return changed;
|
|
69
|
+
}
|
|
70
|
+
async function refreshLive(options = {}) {
|
|
71
|
+
if (inflight || typeof window === "undefined")
|
|
72
|
+
return false;
|
|
73
|
+
inflight = true;
|
|
74
|
+
const url = options.url || window.location.href;
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(url, {
|
|
77
|
+
credentials: "same-origin",
|
|
78
|
+
headers: { Accept: "text/html", "X-Requested-With": "tbf-live" },
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok)
|
|
81
|
+
return false;
|
|
82
|
+
const html = await response.text();
|
|
83
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
84
|
+
return replaceLiveRegions(doc, options);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
inflight = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function bindLiveRefresh(root = document, options = {}) {
|
|
91
|
+
queryAll(root, LIVE_REFRESH_SELECTOR).forEach((trigger) => {
|
|
92
|
+
if (trigger.hasAttribute("data-tbf-live-bound"))
|
|
93
|
+
return;
|
|
94
|
+
trigger.setAttribute("data-tbf-live-bound", "true");
|
|
95
|
+
trigger.addEventListener("click", (event) => {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
const url = trigger.getAttribute("data-tbf-live-url") || undefined;
|
|
98
|
+
void refreshLive({ ...options, url });
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export { LIVE_REFRESH_SELECTOR, LIVE_REGION_SELECTOR, bindLiveRefresh, captureFormState, refreshLive, rehydrate, replaceLiveRegions, restoreFormState, shouldSkipLiveElement, };
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/live/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,eAAe,CAAC;AAWxD,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AACxD,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB,SAAS,qBAAqB,CAAC,OAAgB,EAAE,UAAuB,EAAE;IACxE,IAAI,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5D,OAAO,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AACtD,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAgB;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAA+C,CAAC;IACrE,IAAI,CAAC,gBAAgB,CACnB,uBAAuB,CACxB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACb,OAAO,EAAE,OAAO,YAAY,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;YACtE,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IAC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|
|
1
|
+
import { type LoggerAdapterDefaultLogger, type LoggerAdapterLogger, type LoggerAdapterWriter, type NormalizedLoggerAdapter } from "@package/logger-adapter/browser";
|
|
2
|
+
type FrontendLoggingOptions = {
|
|
3
|
+
defaultLogger?: LoggerAdapterDefaultLogger | false;
|
|
4
|
+
frontend_quiet?: boolean;
|
|
5
|
+
logger?: LoggerAdapterLogger;
|
|
6
|
+
loggerAdapter?: LoggerAdapterWriter;
|
|
7
|
+
quiet?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type FrontendLogger = NormalizedLoggerAdapter;
|
|
10
|
+
declare const FRONTEND_PACKAGE_SOURCE: string;
|
|
11
|
+
declare const FRONTEND_LOG_GROUP: string;
|
|
12
|
+
declare function isFrontendQuiet(options?: FrontendLoggingOptions): boolean;
|
|
13
|
+
declare function toFrontendLogGroup(group: string): string;
|
|
14
|
+
declare function resolveFrontendLogger(options?: FrontendLoggingOptions): FrontendLogger;
|
|
15
|
+
export { FRONTEND_LOG_GROUP, FRONTEND_PACKAGE_SOURCE, isFrontendQuiet, resolveFrontendLogger, toFrontendLogGroup, };
|
|
16
|
+
export type { FrontendLogger, FrontendLoggingOptions };
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AAEzC,KAAK,sBAAsB,GAAG;IAC5B,aAAa,CAAC,EAAE,0BAA0B,GAAG,KAAK,CAAC;IACnD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,cAAc,GAAG,uBAAuB,CAAC;AAG9C,QAAA,MAAM,uBAAuB,QAAmC,CAAC;AACjE,QAAA,MAAM,kBAAkB,QAAkC,CAAC;AAe3D,iBAAS,eAAe,CAAC,OAAO,GAAE,sBAA2B,WAI5D;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,UAOxC;AAWD,iBAAS,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,cAAc,CAuBnF;AAED,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GACnB,CAAC;AACF,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { resolveLogger, } from "@package/logger-adapter/browser";
|
|
2
|
+
const ORGANIZATION_NAME = String.fromCharCode(116, 114, 101, 98, 105, 114, 101, 100);
|
|
3
|
+
const FRONTEND_PACKAGE_SOURCE = `@${ORGANIZATION_NAME}/frontend`;
|
|
4
|
+
const FRONTEND_LOG_GROUP = `${ORGANIZATION_NAME}.frontend`;
|
|
5
|
+
function readGlobalQuiet() {
|
|
6
|
+
const global = globalThis;
|
|
7
|
+
if (typeof global.frontend_quiet === "boolean")
|
|
8
|
+
return global.frontend_quiet;
|
|
9
|
+
const attr = typeof document === "undefined"
|
|
10
|
+
? ""
|
|
11
|
+
: document.documentElement.getAttribute("data-tbf-frontend-quiet");
|
|
12
|
+
if (attr === "true" || attr === "1")
|
|
13
|
+
return true;
|
|
14
|
+
if (attr === "false" || attr === "0")
|
|
15
|
+
return false;
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
function isFrontendQuiet(options = {}) {
|
|
19
|
+
if (typeof options.frontend_quiet === "boolean")
|
|
20
|
+
return options.frontend_quiet;
|
|
21
|
+
if (typeof options.quiet === "boolean")
|
|
22
|
+
return options.quiet;
|
|
23
|
+
return readGlobalQuiet();
|
|
24
|
+
}
|
|
25
|
+
function toFrontendLogGroup(group) {
|
|
26
|
+
const normalized = String(group || "").trim();
|
|
27
|
+
if (!normalized)
|
|
28
|
+
return FRONTEND_LOG_GROUP;
|
|
29
|
+
if (normalized === FRONTEND_LOG_GROUP || normalized.startsWith(`${FRONTEND_LOG_GROUP}.`)) {
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
return `${FRONTEND_LOG_GROUP}.${normalized}`;
|
|
33
|
+
}
|
|
34
|
+
function quietLogger() {
|
|
35
|
+
return {
|
|
36
|
+
error() { },
|
|
37
|
+
fail() { },
|
|
38
|
+
info() { },
|
|
39
|
+
warn() { },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function resolveFrontendLogger(options = {}) {
|
|
43
|
+
if (isFrontendQuiet(options))
|
|
44
|
+
return quietLogger();
|
|
45
|
+
const logger = resolveLogger({
|
|
46
|
+
adapter: options.loggerAdapter,
|
|
47
|
+
defaultLogger: options.defaultLogger,
|
|
48
|
+
fallback: "console",
|
|
49
|
+
logger: options.logger,
|
|
50
|
+
source: FRONTEND_PACKAGE_SOURCE,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
error(group, message, metadata) {
|
|
54
|
+
logger.error(toFrontendLogGroup(group), message, metadata);
|
|
55
|
+
},
|
|
56
|
+
fail(group, message, metadata) {
|
|
57
|
+
logger.fail(toFrontendLogGroup(group), message, metadata);
|
|
58
|
+
},
|
|
59
|
+
info(group, message, metadata) {
|
|
60
|
+
logger.info(toFrontendLogGroup(group), message, metadata);
|
|
61
|
+
},
|
|
62
|
+
warn(group, message, metadata) {
|
|
63
|
+
logger.warn(toFrontendLogGroup(group), message, metadata);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export { FRONTEND_LOG_GROUP, FRONTEND_PACKAGE_SOURCE, isFrontendQuiet, resolveFrontendLogger, toFrontendLogGroup, };
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
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EAAE,QAAQ;YAC3B,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
type ModalRootProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
labelledBy?: string;
|
|
5
|
+
};
|
|
6
|
+
type ModalContentProps = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type ModalOpenButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
controls: string;
|
|
11
|
+
};
|
|
12
|
+
declare function ModalRoot(props: ModalRootProps): import("react").JSX.Element;
|
|
13
|
+
declare function ModalContent(props: ModalContentProps): import("react").JSX.Element;
|
|
14
|
+
declare function ModalOpenButton(props: ModalOpenButtonProps): import("react").JSX.Element;
|
|
15
|
+
declare function ModalCloseButton(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
16
|
+
export { ModalCloseButton, ModalContent, ModalOpenButton, ModalRoot };
|
|
17
|
+
export type { ModalContentProps, ModalOpenButtonProps, ModalRootProps };
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modal/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,SAAS,EACV,MAAM,OAAO,CAAC;AAGf,KAAK,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,oBAAoB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACpE,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,+BAcvC;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAW7C;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAanD;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,+BAYvE;AAED,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../components/index.js";
|
|
3
|
+
function ModalRoot(props) {
|
|
4
|
+
const { children, className, labelledBy, role = "dialog", ...rest } = props;
|
|
5
|
+
return (_jsx("div", { ...rest, className: classNames("tbf-modal", className), "data-tbf-modal": "", role: role, "aria-hidden": "true", "aria-labelledby": labelledBy, children: children }));
|
|
6
|
+
}
|
|
7
|
+
function ModalContent(props) {
|
|
8
|
+
const { children, className, ...rest } = props;
|
|
9
|
+
return (_jsx("div", { ...rest, className: classNames("tbf-modal__content", className), "data-tbf-modal-content": "", children: children }));
|
|
10
|
+
}
|
|
11
|
+
function ModalOpenButton(props) {
|
|
12
|
+
const { children, className, controls, type = "button", ...rest } = props;
|
|
13
|
+
return (_jsx("button", { ...rest, className: classNames("tbf-button", className), "data-tbf-modal-open": "", "aria-controls": controls, type: type, children: children }));
|
|
14
|
+
}
|
|
15
|
+
function ModalCloseButton(props) {
|
|
16
|
+
const { children = "Close", className, type = "button", ...rest } = props;
|
|
17
|
+
return (_jsx("button", { ...rest, className: classNames("tbf-button", className), "data-tbf-modal-close": "", type: type, children: children }));
|
|
18
|
+
}
|
|
19
|
+
export { ModalCloseButton, ModalContent, ModalOpenButton, ModalRoot };
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modal/components/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe3C,SAAS,SAAS,CAAC,KAAqB;IACtC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC5E,OAAO,CACL,iBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,oBAC9B,EAAE,EACjB,IAAI,EAAE,IAAI,iBACE,MAAM,qBACD,UAAU,YAE1B,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAwB;IAC5C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC/C,OAAO,CACL,iBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,4BAC/B,EAAE,YAExB,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAA2B;IAClD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC1E,OAAO,CACL,oBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,yBAC1B,EAAE,mBACP,QAAQ,EACvB,IAAI,EAAE,IAAI,YAET,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAA8C;IACtE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC1E,OAAO,CACL,oBACM,IAAI,EACR,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,0BACzB,EAAE,EACvB,IAAI,EAAE,IAAI,YAET,QAAQ,GACF,CACV,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type BindRoot } from "../dom/index.d.ts";
|
|
2
|
+
declare const MODAL_SELECTOR = "[data-tbf-modal]";
|
|
3
|
+
declare const MODAL_CONTENT_SELECTOR = "[data-tbf-modal-content]";
|
|
4
|
+
declare const MODAL_CLOSE_SELECTOR = "[data-tbf-modal-close]";
|
|
5
|
+
declare const MODAL_TRIGGER_SELECTOR = "[data-tbf-modal-open][aria-controls]";
|
|
6
|
+
declare const FOCUSABLE_SELECTOR: string;
|
|
7
|
+
type ModalEntry = {
|
|
8
|
+
modal: HTMLElement;
|
|
9
|
+
trigger: HTMLElement | null;
|
|
10
|
+
};
|
|
11
|
+
declare function prepareModal(modal: HTMLElement): void;
|
|
12
|
+
declare function openModal(modalOrSelector: HTMLElement | string, trigger?: HTMLElement | null): HTMLElement;
|
|
13
|
+
declare function closeModal(modalOrSelector?: HTMLElement | string | null): boolean;
|
|
14
|
+
declare function closeAllModals(): void;
|
|
15
|
+
declare function bindModalTrigger(trigger: HTMLElement | null, root?: BindRoot): HTMLElement;
|
|
16
|
+
declare function bindModals(root?: BindRoot): void;
|
|
17
|
+
declare function createModal(options: {
|
|
18
|
+
content?: Node | string;
|
|
19
|
+
id: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
}): HTMLDivElement;
|
|
22
|
+
export { FOCUSABLE_SELECTOR, MODAL_CLOSE_SELECTOR, MODAL_CONTENT_SELECTOR, MODAL_SELECTOR, MODAL_TRIGGER_SELECTOR, bindModalTrigger, bindModals, closeAllModals, closeModal, createModal, openModal, prepareModal, };
|
|
23
|
+
export type { ModalEntry };
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AASvB,QAAA,MAAM,cAAc,qBAAqB,CAAC;AAC1C,QAAA,MAAM,sBAAsB,6BAA6B,CAAC;AAC1D,QAAA,MAAM,oBAAoB,2BAA2B,CAAC;AACtD,QAAA,MAAM,sBAAsB,yCAAyC,CAAC;AACtE,QAAA,MAAM,kBAAkB,QAOb,CAAC;AAEZ,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B,CAAC;AAeF,iBAAS,YAAY,CAAC,KAAK,EAAE,WAAW,QAOvC;AAgCD,iBAAS,SAAS,CAAC,eAAe,EAAE,WAAW,GAAG,MAAM,EAAE,OAAO,GAAE,WAAW,GAAG,IAAW,eAuB3F;AAED,iBAAS,UAAU,CAAC,eAAe,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,WAoBhE;AAED,iBAAS,cAAc,SAItB;AAED,iBAAS,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,GAAE,QAAmB,eAgB/E;AAED,iBAAS,UAAU,CAAC,IAAI,GAAE,QAAmB,QAK5C;AAeD,iBAAS,WAAW,CAAC,OAAO,EAAE;IAC5B,OAAO,CAAC,EAAE,IAAI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