@absoluteui/core 0.0.0-stage → 0.13.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ AbsoluteUI
2
+ Copyright 2026 Kasadara Technology Solutions Pvt Ltd
3
+
4
+ This product includes software developed by Kasadara Technology Solutions Pvt Ltd
5
+ (https://aui.kasadara.com/).
package/README.md CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # @absoluteui/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The foundation every AbsoluteUI component builds on, available to applications too: one validated configuration, exact date and time-zone values, recurrence rules, localized formatting, safe HTML, and a shared error model.
4
+
5
+ ## What's in the package
6
+
7
+ - **Configuration**: global and per-component settings (locale, time zone, theme, density, animation) with validation, live change notifications, and component defaults.
8
+ - **Dates and time zones**: plain dates, times, date-times, year-months, and quarters; instants and zoned date-times; time-zone conversion with daylight-saving gap and overlap handling.
9
+ - **Recurrence**: RFC 5545 recurrence rules: build, parse, serialize, expand to dates, and describe in words.
10
+ - **Internationalization**: translated messages with locale fallbacks, text direction, first day of the week, and number, currency, date, and time-zone formatting.
11
+ - **Sanitization**: an allow-list HTML sanitizer that works with Trusted Types.
12
+ - **Errors and diagnostics**: the `AbsoluteUIError` model with stable codes, and the diagnostics mode.
13
+ - **DOM helpers**: unique ids, typed event dispatch, disposable listener groups, and node release hooks.
14
+
15
+ ## Browser support
16
+
17
+ Chrome 116, Edge 116, Firefox 125, Safari (macOS) 17, Safari (iOS and iPadOS) 18.3, or later. Details: [Browser support](https://aui.kasadara.com/docs/quality/browser-support/).
18
+
19
+ ## Documentation
20
+
21
+ Full documentation: [aui.kasadara.com/docs/api/core/](https://aui.kasadara.com/docs/api/core/)
22
+
23
+ ## License
24
+
25
+ Licensed under the [Apache License 2.0](https://aui.kasadara.com/license/). Copyright (c) 2026 Kasadara Technology Solutions Pvt Ltd; see the LICENSE and NOTICE files in this package. AbsoluteUI is open source, Kasadara's contribution to the open-source community; the source is at https://github.com/kasadara-labs/AbsoluteUI. Report vulnerabilities as described in the [Security Policy](https://aui.kasadara.com/security/).
package/SECURITY.md ADDED
@@ -0,0 +1,102 @@
1
+ # Security Policy
2
+
3
+ **Effective date:** 24 November 2026
4
+
5
+ AbsoluteUI is licensed under the [Apache License 2.0](LICENSE). Security fixes are delivered through official AbsoluteUI releases. This policy describes how to report vulnerabilities and which versions receive fixes.
6
+
7
+ ---
8
+
9
+ ## Supported Versions
10
+
11
+ | Version | Security fixes | Bug fixes |
12
+ |---|---|---|
13
+ | Latest `0.x` minor (currently `0.13`, before `1.0`), latest patch | Yes | Yes |
14
+ | Older `0.x` minors and patches | No. Upgrade to the latest `0.x` minor. | No |
15
+ | Latest major (`1.x`), latest minor | Yes | Yes |
16
+ | Latest major (`1.x`), older minors | No. Upgrade to the latest minor. | No |
17
+ | Last `0.x` minor after `1.0` is released | Yes, for 12 months after the `1.0` release | No |
18
+ | Older majors | No | No |
19
+
20
+ End-of-support dates for each major version are announced at least 6 months in advance on https://aui.kasadara.com.
21
+
22
+ The current release line is `0.13`. Until `1.0`, security fixes ship as patch releases of the latest `0.x` minor; always use the latest one.
23
+
24
+ ## Reporting a Vulnerability
25
+
26
+ **Do not report security vulnerabilities through public issues, discussions, or social media.**
27
+
28
+ Report privately through either channel:
29
+
30
+ - **GitHub (preferred):** open a private vulnerability report at https://github.com/kasadara-labs/AbsoluteUI/security/advisories/new (the **Report a vulnerability** button on the repository's **Security** tab). Only you and the AbsoluteUI maintainers can see it, and we can work on the fix and the advisory with you there.
31
+ - **Email:** security@kasadara.com
32
+
33
+ The email contact is also published in `/.well-known/security.txt` on each AbsoluteUI website.
34
+
35
+ Include, where possible:
36
+
37
+ - affected package(s) and version(s);
38
+ - affected component(s);
39
+ - vulnerability type (for example XSS, CSP bypass, sanitizer bypass, or information exposure);
40
+ - steps to reproduce or a minimal proof of concept;
41
+ - browser(s) and version(s) used;
42
+ - impact assessment;
43
+ - any known workaround.
44
+
45
+ Do not include real personal data or production credentials in reports.
46
+
47
+ ## Response Process
48
+
49
+ | Stage | Target |
50
+ |---|---|
51
+ | Acknowledgement of report | Within 3 business days |
52
+ | Initial triage and severity assessment (CVSS v3.1 or later) | Within 10 business days |
53
+ | Status updates to reporter | At least every 14 days until resolution |
54
+ | Fix release: Critical/High | Target 30 days from triage |
55
+ | Fix release: Medium/Low | Next scheduled release |
56
+
57
+ Targets are objectives, not guarantees. See Section 7 (Disclaimer of Warranty) of the [license](LICENSE).
58
+
59
+ ## Coordinated Disclosure
60
+
61
+ - We ask reporters to keep vulnerability details confidential until a fixed release and advisory are published, or until 90 days after the report, whichever comes first, unless both parties agree otherwise.
62
+ - We will credit reporters in the advisory unless they request anonymity.
63
+ - We will request a CVE identifier for qualifying vulnerabilities through GitHub, which is a CVE Numbering Authority.
64
+
65
+ ## Security Advisories
66
+
67
+ Advisories are published as GitHub security advisories at https://github.com/kasadara-labs/AbsoluteUI/security/advisories and at https://aui.kasadara.com/advisory/. They include:
68
+
69
+ - affected packages and versions;
70
+ - fixed versions;
71
+ - CVSS severity and vector;
72
+ - description and impact;
73
+ - workarounds, where available;
74
+ - CVE identifier, where assigned;
75
+ - reporter credit.
76
+
77
+ ## Scope
78
+
79
+ **In scope:** the published packages `@absoluteui/core`, `@absoluteui/components`, `@absoluteui/theme`, `@absoluteui/icons`, `@absoluteui/utilities`, `@absoluteui/helpers`, and `@absoluteui/angular`, and the website https://aui.kasadara.com with its documentation (/docs/) and Theme Designer (/designer/) sections, also served at https://absoluteui.kasadara.com (the former addresses https://aui-docs.kasadara.com and https://aui-designer.kasadara.com only redirect to it).
80
+
81
+ **Out of scope:**
82
+
83
+ - vulnerabilities in consuming applications that do not originate in AbsoluteUI code;
84
+ - use of AbsoluteUI configurations explicitly documented as unsafe (for example consumer-allowlisted HTML elements or attributes; see the [security guide](https://aui.kasadara.com/docs/getting-started/security/));
85
+ - issues that only affect browsers outside the published supported-browser matrix;
86
+ - modified copies of AbsoluteUI, unless the issue is also present in an unmodified official release;
87
+ - findings from automated scanners without a demonstrated impact.
88
+
89
+ ## Safe Harbor
90
+
91
+ We will not pursue legal action against researchers who, in good faith:
92
+
93
+ - follow this policy;
94
+ - avoid privacy violations, data destruction, and service disruption;
95
+ - test only against their own installations and data;
96
+ - give us reasonable time to remediate before disclosure.
97
+
98
+ Analysis performed solely to identify and report a vulnerability under this policy is authorized for that purpose.
99
+
100
+ ## Contact
101
+
102
+ Kasadara Technology Solutions Pvt Ltd, 25, Avinashi Rd, TNHB Colony, Indira Nagar, Civil Aerodrome Post, Coimbatore, Tamil Nadu 641014, India. Security reports: security@kasadara.com. Other legal matters: legalops@kasadara.com.
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Configuration engine (SPEC section 6).
3
+ *
4
+ * Precedence (most specific wins, section 6.3):
5
+ * built-in default -> theme common -> theme component -> global common -> global component -> instance
6
+ */
7
+ import { type DiagnosticsMode } from '../errors.js';
8
+ import type { TimeZoneEngine } from '../timezone/engine.js';
9
+ import { type Guard } from './validators.js';
10
+ export type Density = 'compact' | 'comfortable' | 'spacious';
11
+ export type Direction = 'ltr' | 'rtl';
12
+ export type AnimationMode = 'none' | 'subtle';
13
+ export type Disambiguation = 'compatible' | 'earlier' | 'later' | 'reject';
14
+ /** Settings shared by all components (section 6.1). */
15
+ export interface CommonConfig {
16
+ locale: string;
17
+ timezone: string;
18
+ density: Density;
19
+ direction: Direction;
20
+ animation: AnimationMode;
21
+ theme: string;
22
+ disambiguation: Disambiguation;
23
+ diagnostics: DiagnosticsMode;
24
+ /** Optional authoritative offset resolver (section 8.7). `null` uses the built-in Intl engine. */
25
+ timeZoneEngine: TimeZoneEngine | null;
26
+ }
27
+ export type Mutability = 'dynamic' | 'init-only';
28
+ export interface OptionSpec<T> {
29
+ readonly default: T;
30
+ /** Expected contract, used in diagnostics. Must not describe received values. */
31
+ readonly expected: string;
32
+ readonly validate: Guard<T>;
33
+ /** `init-only` options cannot change on an existing instance (section 6.5). Default: `dynamic`. */
34
+ readonly mutability?: Mutability;
35
+ }
36
+ export type ConfigSchema<T> = {
37
+ readonly [K in keyof T]-?: OptionSpec<T[K]>;
38
+ };
39
+ /**
40
+ * Component configuration registry. Components augment this interface:
41
+ *
42
+ * ```ts
43
+ * declare module '@absoluteui/core' {
44
+ * interface ComponentConfigMap { dialog: DialogConfig }
45
+ * }
46
+ * ```
47
+ */
48
+ export interface ComponentConfigMap {
49
+ }
50
+ export type ComponentConfigInput = {
51
+ [K in keyof ComponentConfigMap]?: Partial<ComponentConfigMap[K]>;
52
+ };
53
+ /** Mode B (section 6.1): common and component-specific settings. */
54
+ export interface StructuredConfigInput {
55
+ common?: Partial<CommonConfig>;
56
+ components?: ComponentConfigInput;
57
+ }
58
+ /** Mode A (flat common settings) or Mode B (structured). */
59
+ export type GlobalConfigInput = Partial<CommonConfig> | StructuredConfigInput;
60
+ export declare const commonSchema: ConfigSchema<CommonConfig>;
61
+ /**
62
+ * Replace the global configuration layer (section 6.1). Validation is atomic:
63
+ * on error, the previous configuration remains active.
64
+ */
65
+ export declare function configureAbsoluteUI(input: GlobalConfigInput): void;
66
+ /** @internal Used by the theme runtime to supply theme defaults (section 6.3 layer 2). */
67
+ export declare function setThemeConfigDefaults(input: StructuredConfigInput): void;
68
+ /** Reset all configuration layers. Intended for tests and full application teardown. */
69
+ export declare function resetAbsoluteUIConfig(): void;
70
+ /** Subscribe to any global/theme configuration change. Returns an unsubscribe function. */
71
+ export declare function onConfigChange(listener: () => void): () => void;
72
+ /** Validated configuration layer returned by `normalizeConfig`. */
73
+ export interface NormalizedConfig {
74
+ readonly common: Partial<CommonConfig>;
75
+ readonly components: ComponentConfigInput;
76
+ }
77
+ /**
78
+ * Validate a configuration input (Mode A or B) without applying it. Throws the same
79
+ * errors as `configureAbsoluteUI`. Framework integrations use it for scoped configuration
80
+ * that must never touch the page-global layer (for example per-request server rendering).
81
+ */
82
+ export declare function normalizeConfig(input: GlobalConfigInput): NormalizedConfig;
83
+ /** Option names of a registered component configuration, or `undefined` when `name` is not registered. */
84
+ export declare function describeComponentConfig(name: string): {
85
+ readonly optionNames: readonly string[];
86
+ readonly inheritedOptionNames: readonly string[];
87
+ } | undefined;
88
+ /** Resolved common configuration. */
89
+ export declare function getCommonConfig(): Readonly<CommonConfig>;
90
+ export interface ComponentConfigHandle<R> {
91
+ readonly name: string;
92
+ /** All option names, including inherited common options (for metadata and tooling). */
93
+ readonly optionNames: readonly string[];
94
+ /** Inherited common option names. */
95
+ readonly inheritedOptionNames: readonly string[];
96
+ /** Resolve configuration for one instance. Throws AbsoluteUIError on invalid instance options. */
97
+ resolve(instance?: Partial<R>): Readonly<R>;
98
+ /** Throws if `next` changes an init-only option relative to `previous`. */
99
+ assertUpdatable(previous: Partial<R>, next: Partial<R>): void;
100
+ /** Notified when global or theme configuration changes. */
101
+ subscribe(listener: () => void): () => void;
102
+ }
103
+ /**
104
+ * Register a component's configuration schema. `inherits` lists common options
105
+ * the component honors; they can be overridden per component and per instance.
106
+ */
107
+ export declare function defineComponentConfig<T extends object, const I extends keyof CommonConfig = never>(name: string, schema: ConfigSchema<T>, inherits?: readonly I[]): ComponentConfigHandle<T & Pick<CommonConfig, I>>;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{configurationError as d,setDiagnosticsMode as k}from"../errors.js";import{isLocale as E,isRecord as g,isTimeZone as j,isNonEmptyString as S,nullable as L,oneOf as y}from"./validators.js";const _=e=>g(e)&&typeof e.getOffsetMs=="function"&&typeof e.isValidTimeZone=="function",f={locale:{default:"en-US",expected:"BCP 47 locale tag",validate:E},timezone:{default:"UTC",expected:"IANA timezone identifier",validate:j},density:{default:"comfortable",expected:'"compact" | "comfortable" | "spacious"',validate:y(["compact","comfortable","spacious"])},direction:{default:"ltr",expected:'"ltr" | "rtl"',validate:y(["ltr","rtl"])},animation:{default:"subtle",expected:'"none" | "subtle"',validate:y(["none","subtle"])},theme:{default:"absolute-default",expected:"non-empty theme name",validate:S},disambiguation:{default:"compatible",expected:'"compatible" | "earlier" | "later" | "reject"',validate:y(["compatible","earlier","later","reject"])},diagnostics:{default:"production",expected:'"production" | "development"',validate:y(["production","development"])},timeZoneEngine:{default:null,expected:"TimeZoneEngine object or null",validate:L(_)}},b=()=>({common:{},components:{}}),N=Symbol.for("absoluteui.core.instance");{const e=globalThis;e[N]&&T(d("CORE_DUPLICATE_INSTANCE","Multiple copies of @absoluteui/core are loaded; configuration will not be shared.",{remediation:"Deduplicate @absoluteui/* packages so every package resolves the same core instance."})),e[N]=!0}let l=b(),p=b();const v=new Map,x=new Set,I=new Set;function C(e,o,r,a){const t={};for(const[m,c]of Object.entries(e)){const i=o[m],n=`${r}.${m}`;if(i===void 0)throw d("CFG_UNKNOWN_OPTION","Unknown configuration option.",{property:n,...a===void 0?{}:{component:a},remediation:"Check the option name against the component documentation."});if(c!==void 0){if(!i.validate(c))throw d("CFG_INVALID_VALUE","Invalid configuration value.",{property:n,expected:i.expected,...a===void 0?{}:{component:a},remediation:"Provide a value matching the expected contract."});t[m]=c}}return t}function O(e){const o={...e.schema};for(const r of e.inherits)o[r]=f[r];return o}function R(e,o){if(!g(e))throw d("CFG_INVALID_ROOT","Configuration must be an object.",{property:o,expected:"object"});const r=Object.keys(e);if(r.includes("common")||r.includes("components")){const t=r.find(n=>n!=="common"&&n!=="components");if(t!==void 0)throw d("CFG_MIXED_MODES",'Flat common options cannot be mixed with "common"/"components".',{property:`${o}.${t}`,remediation:'Move common options under "common".'});const m=e.common??{},c=e.components??{};if(!g(m))throw d("CFG_INVALID_VALUE","Invalid configuration value.",{property:`${o}.common`,expected:"object"});if(!g(c))throw d("CFG_INVALID_VALUE","Invalid configuration value.",{property:`${o}.components`,expected:"object"});const i={common:C(m,f,`${o}.common`),components:{}};for(const[n,s]of Object.entries(c)){if(!g(s))throw d("CFG_INVALID_VALUE","Invalid configuration value.",{property:`${o}.components.${n}`,expected:"object"});const u=v.get(n);i.components[n]=u?C(s,O(u),`${o}.components.${n}`,n):{...s}}return i}return{common:C(e,f,o),components:{}}}function A(){x.clear();for(const e of[...I])try{e()}catch(o){T(o)}}function T(e){const o=globalThis.reportError;o?o(e):queueMicrotask(()=>{throw e})}function G(e){const o=R(e,"config");l=o,k(o.common.diagnostics??f.diagnostics.default),A()}function P(e){p=R(e,"theme"),A()}function $(){l=b(),p=b(),k("production"),A()}function D(e){return I.add(e),()=>I.delete(e)}function U(e){const o=R(e,"config");return{common:o.common,components:o.components}}function V(e){const o=v.get(e);if(o)return{optionNames:Object.freeze(Object.keys(O(o))),inheritedOptionNames:Object.freeze([...o.inherits])}}function F(){const e={};for(const o of Object.keys(f))e[o]=w(o,f[o].default,[p.common,l.common]);return Object.freeze(e)}function w(e,o,r){let a=o;for(const t of r)e in t&&(a=t[e]);return a}function Z(e,o,r=[]){if(v.has(e))throw d("CFG_DUPLICATE_COMPONENT","Component configuration registered twice.",{component:e,property:e});const a={schema:o,inherits:r};v.set(e,a);const t=O(a),m=()=>{if(!x.has(e)){for(const[c,i]of[["theme",p],["config",l]]){const n=i.components[e];n&&(i.components[e]=C(n,t,`${c}.components.${e}`,e))}x.add(e)}};return{name:e,optionNames:Object.freeze(Object.keys(t)),inheritedOptionNames:Object.freeze([...r]),resolve(c={}){m();const i=C(c,t,e,e),n={};for(const s of Object.keys(t)){const h=r.includes(s)?[p.common,p.components[e]??{},l.common,l.components[e]??{},i]:[p.components[e]??{},l.components[e]??{},i];n[s]=w(s,t[s]?.default,h)}return Object.freeze(n)},assertUpdatable(c,i){for(const[n,s]of Object.entries(t)){if(s.mutability!=="init-only")continue;const u=c[n],h=i[n];if(n in i&&!Object.is(u,h))throw d("CFG_INIT_ONLY","Option cannot change after initialization.",{component:e,property:`${e}.${n}`,remediation:"Recreate the component instance to change this option."})}},subscribe:D}}export{f as commonSchema,G as configureAbsoluteUI,Z as defineComponentConfig,V as describeComponentConfig,F as getCommonConfig,U as normalizeConfig,D as onConfigChange,$ as resetAbsoluteUIConfig,P as setThemeConfigDefaults};
@@ -0,0 +1,14 @@
1
+ /** Reusable option validators. Each returns a type guard and never inspects values beyond type/range checks. */
2
+ export type Guard<T> = (value: unknown) => value is T;
3
+ export declare const isBoolean: Guard<boolean>;
4
+ export declare const isString: Guard<string>;
5
+ export declare const isNonEmptyString: Guard<string>;
6
+ export declare function oneOf<const T extends readonly (string | number | boolean)[]>(values: T): Guard<T[number]>;
7
+ export declare function integerInRange(min: number, max: number): Guard<number>;
8
+ export declare function numberInRange(min: number, max: number): Guard<number>;
9
+ export declare function nullable<T>(guard: Guard<T>): Guard<T | null>;
10
+ /** Valid, canonicalizable BCP 47 locale tag. */
11
+ export declare const isLocale: Guard<string>;
12
+ /** IANA timezone identifier (or "UTC") supported by the host Intl implementation. */
13
+ export declare const isTimeZone: Guard<string>;
14
+ export declare function isRecord(v: unknown): v is Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ const o=n=>typeof n=="boolean",u=n=>typeof n=="string",i=n=>typeof n=="string"&&n.trim().length>0;function s(n){return r=>n.includes(r)}function a(n,r){return e=>typeof e=="number"&&Number.isInteger(e)&&e>=n&&e<=r}function l(n,r){return e=>typeof e=="number"&&Number.isFinite(e)&&e>=n&&e<=r}function g(n){return r=>r===null||n(r)}const c=n=>{if(typeof n!="string"||n.length===0)return!1;try{return Intl.getCanonicalLocales(n).length===1}catch{return!1}},t=new Map,b=n=>{if(typeof n!="string"||n.length===0||n.length>64)return!1;const r=t.get(n);if(r!==void 0)return r;let e;try{new Intl.DateTimeFormat("en-US",{timeZone:n}),e=!0}catch{e=!1}return t.set(n,e),e};function m(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export{a as integerInRange,o as isBoolean,c as isLocale,i as isNonEmptyString,m as isRecord,u as isString,b as isTimeZone,g as nullable,l as numberInRange,s as oneOf};
package/dist/dom.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /** Small DOM helpers shared by all packages. */
2
+ /** Unique, deterministic-per-page element id. */
3
+ export declare function createId(prefix?: string): string;
4
+ export interface EmitOptions {
5
+ cancelable?: boolean;
6
+ /**
7
+ * Default true. Lifecycle events (open/close/cancel) pass false, mirroring native
8
+ * `close`/`toggle`, so nested components' events never reach a container's listeners.
9
+ */
10
+ bubbles?: boolean;
11
+ }
12
+ /**
13
+ * Dispatch a standards-based CustomEvent from a host element (SPEC section 3.3).
14
+ * Returns false when a cancelable event was prevented.
15
+ */
16
+ export declare function emit(host: EventTarget, type: string, detail: unknown, options?: EmitOptions): boolean;
17
+ export type Disposer = () => void;
18
+ /** Collects cleanup callbacks and runs them once, in reverse order. */
19
+ export declare class DisposableGroup {
20
+ #private;
21
+ add(disposer: Disposer): void;
22
+ listen<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, handler: (event: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions): void;
23
+ listen<K extends keyof DocumentEventMap>(target: Document, type: K, handler: (event: DocumentEventMap[K]) => void, options?: AddEventListenerOptions): void;
24
+ listen<K extends keyof WindowEventMap>(target: Window, type: K, handler: (event: WindowEventMap[K]) => void, options?: AddEventListenerOptions): void;
25
+ get disposed(): boolean;
26
+ dispose(): void;
27
+ }
package/dist/dom.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ let i=0;function r(s="aui"){return i+=1,`${s}-${i.toString(36)}`}function d(s,e,t,n={}){const o=n.bubbles??!0;return s.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:o,composed:o,cancelable:n.cancelable??!1}))}class v{#t=[];#e=!1;add(e){if(this.#e){e();return}this.#t.push(e)}listen(e,t,n,o){e.addEventListener(t,n,o),this.add(()=>{e.removeEventListener(t,n,o)})}get disposed(){return this.#e}dispose(){if(this.#e)return;this.#e=!0;const e=this.#t.reverse();this.#t=[];for(const t of e)t()}}export{v as DisposableGroup,r as createId,d as emit};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Error model (SPEC section 27). Messages never include user-supplied values (section 14.4, section 6.4).
3
+ */
4
+ export type ErrorCategory = 'configuration' | 'validation' | 'runtime' | 'failure';
5
+ export type DiagnosticsMode = 'production' | 'development';
6
+ /** @internal Set by the configuration engine. */
7
+ export declare function setDiagnosticsMode(mode: DiagnosticsMode): void;
8
+ export declare function getDiagnosticsMode(): DiagnosticsMode;
9
+ export interface ErrorDetails {
10
+ /** Component name, e.g. "dialog". */
11
+ readonly component?: string;
12
+ /** Property path, e.g. "components.dialog.closeOnEscape". */
13
+ readonly property?: string;
14
+ /** Human-readable expected contract, e.g. "boolean". Never contains the received value. */
15
+ readonly expected?: string;
16
+ /** Remediation guidance shown in development diagnostics. */
17
+ readonly remediation?: string;
18
+ }
19
+ export declare class AbsoluteUIError extends Error {
20
+ readonly name = "AbsoluteUIError";
21
+ readonly category: ErrorCategory;
22
+ readonly code: string;
23
+ readonly details: ErrorDetails;
24
+ constructor(category: ErrorCategory, code: string, summary: string, details?: ErrorDetails);
25
+ }
26
+ export declare function configurationError(code: string, summary: string, details?: ErrorDetails): AbsoluteUIError;
27
+ export declare function validationError(code: string, summary: string, details?: ErrorDetails): AbsoluteUIError;
28
+ export declare function runtimeError(code: string, summary: string, details?: ErrorDetails): AbsoluteUIError;
package/dist/errors.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ let n="production";function d(e){n=e}function p(){return n}class i extends Error{name="AbsoluteUIError";category;code;details;constructor(o,r,t,s={}){super(a(r,t,s)),this.category=o,this.code=r,this.details=Object.freeze({...s})}}function a(e,o,r){const t=[`[AbsoluteUI ${e}] ${o}`];return r.property!==void 0&&t.push(`Property: ${r.property}.`),r.expected!==void 0&&t.push(`Expected: ${r.expected}.`),n==="development"&&(r.component!==void 0&&t.push(`Component: ${r.component}.`),r.remediation!==void 0&&t.push(`Fix: ${r.remediation}`)),t.join(" ")}function u(e,o,r){return new i("configuration",e,o,r)}function c(e,o,r){return new i("validation",e,o,r)}function g(e,o,r){return new i("runtime",e,o,r)}export{i as AbsoluteUIError,u as configurationError,p as getDiagnosticsMode,g as runtimeError,d as setDiagnosticsMode,c as validationError};
@@ -0,0 +1,37 @@
1
+ import { type Direction } from '../config/config.js';
2
+ import type { PlainDate, PlainDateTime, PlainTime, Instant, ZonedDateTime } from '../timezone/types.js';
3
+ export type MessageCatalog = Readonly<Record<string, string>>;
4
+ /**
5
+ * Register translated messages for a component and locale. Components register
6
+ * their English defaults under "en"; applications add or override other locales.
7
+ */
8
+ export declare function registerMessages(component: string, locale: string, messages: MessageCatalog): void;
9
+ /** Locale fallback chain, e.g. "pt-BR" -> ["pt-BR", "pt", "en"]. */
10
+ export declare function localeFallbacks(locale: string): string[];
11
+ /**
12
+ * Resolve a message. Placeholders use `{name}` and are replaced with the
13
+ * string form of `params[name]`. Missing keys raise a configuration error
14
+ * instead of silently rendering an unrelated fallback (section 6.4).
15
+ */
16
+ export declare function getMessage(component: string, key: string, params?: Readonly<Record<string, string | number>>, locale?: string): string;
17
+ /** Script direction for a locale. */
18
+ export declare function getLocaleDirection(locale: string): Direction;
19
+ /** Effective direction: explicit configuration wins over locale inference. */
20
+ export declare function getDirection(): Direction;
21
+ /** First day of week, ISO numbering (1 = Monday ... 7 = Sunday). */
22
+ export declare function getFirstDayOfWeek(locale?: string): number;
23
+ export declare function formatNumber(value: number, options?: Intl.NumberFormatOptions, locale?: string): string;
24
+ export declare function formatCurrency(value: number, currency: string, options?: Intl.NumberFormatOptions, locale?: string): string;
25
+ type DateOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone'>;
26
+ /** Format a date-only value. Rendered in UTC so the calendar date never shifts. */
27
+ export declare function formatPlainDate(value: PlainDate, options?: DateOptions, locale?: string): string;
28
+ export declare function formatPlainTime(value: PlainTime, options?: DateOptions, locale?: string): string;
29
+ export declare function formatPlainDateTime(value: PlainDateTime, options?: DateOptions, locale?: string): string;
30
+ /**
31
+ * Format an exact instant in an explicit timezone. Defaults to the configured
32
+ * timezone (UTC unless configured, section 8.1) - never the host machine's zone.
33
+ */
34
+ export declare function formatInstant(value: Instant | ZonedDateTime, options?: DateOptions, timeZone?: string, locale?: string): string;
35
+ /** Localized timezone display name, e.g. "India Standard Time". */
36
+ export declare function formatTimeZoneName(timeZone: string, style?: 'long' | 'short' | 'longOffset' | 'shortOffset', at?: number, locale?: string): string;
37
+ export {};
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{getWeekInfo as d}from"@absoluteui/helpers/date";import{getCommonConfig as o}from"../config/config.js";import{configurationError as p}from"../errors.js";import{fieldsToEpoch as c}from"../timezone/engine.js";const l=new Map;function N(t,e,n){let r=l.get(t);r||(r=new Map,l.set(t,r));const i=Intl.getCanonicalLocales(e)[0]??e;r.set(i,Object.freeze({...r.get(i)??{},...n}))}function T(t){const e=[],n=(Intl.getCanonicalLocales(t)[0]??t).split("-");for(;n.length;)e.push(n.join("-")),n.pop();return e.includes("en")||e.push("en"),e}function O(t,e,n={},r=o().locale){const i=l.get(t);let a;for(const m of T(r))if(a=i?.get(m)?.[e],a!==void 0)break;if(a===void 0)throw p("I18N_MISSING_MESSAGE","Missing localized message.",{component:t,property:`${t}.${e}`});return a.replace(/\{(\w+)\}/g,(m,u)=>{const g=n[u];return g===void 0?m:String(g)})}const y=new Set(["ar","arc","ckb","dv","fa","he","iw","ks","ku","ps","sd","syr","ug","ur","yi"]);function w(t){const e=new Intl.Locale(t),n=e.maximize().script;return n&&["Arab","Hebr","Thaa","Syrc","Nkoo","Adlm","Rohg"].includes(n)||y.has(e.language)?"rtl":"ltr"}function x(){return o().direction}function $(t=o().locale){return d(t).firstDay}const f=new Map;function s(t,e){let n=f.get(t);return n||(n=e(),f.set(t,n)),n}function D(t,e={},n=o().locale){return s(`n|${n}|${JSON.stringify(e)}`,()=>new Intl.NumberFormat(n,e)).format(t)}function C(t,e,n={},r=o().locale){return D(t,{...n,style:"currency",currency:e},r)}function F(t,e={dateStyle:"medium"},n=o().locale){const r=c(t.year,t.month,t.day,12);return s(`d|${n}|UTC|${JSON.stringify(e)}`,()=>new Intl.DateTimeFormat(n,{...e,timeZone:"UTC"})).format(r)}function M(t,e={timeStyle:"short"},n=o().locale){const r=c(1970,1,1,t.hour,t.minute,t.second,t.millisecond);return s(`d|${n}|UTC|${JSON.stringify(e)}`,()=>new Intl.DateTimeFormat(n,{...e,timeZone:"UTC"})).format(r)}function P(t,e={dateStyle:"medium",timeStyle:"short"},n=o().locale){const{date:r,time:i}=t,a=c(r.year,r.month,r.day,i.hour,i.minute,i.second,i.millisecond);return s(`d|${n}|UTC|${JSON.stringify(e)}`,()=>new Intl.DateTimeFormat(n,{...e,timeZone:"UTC"})).format(a)}function Z(t,e={dateStyle:"medium",timeStyle:"long"},n,r=o().locale){const i=n??(t.kind==="ZonedDateTime"?t.timeZone:o().timezone);return s(`d|${r}|${i}|${JSON.stringify(e)}`,()=>new Intl.DateTimeFormat(r,{...e,timeZone:i})).format(t.epochMilliseconds)}function L(t,e="long",n=Date.now(),r=o().locale){return s(`tz|${r}|${t}|${e}`,()=>new Intl.DateTimeFormat(r,{timeZone:t,timeZoneName:e})).formatToParts(n).find(a=>a.type==="timeZoneName")?.value??t}export{C as formatCurrency,Z as formatInstant,D as formatNumber,F as formatPlainDate,P as formatPlainDateTime,M as formatPlainTime,L as formatTimeZoneName,x as getDirection,$ as getFirstDayOfWeek,w as getLocaleDirection,O as getMessage,T as localeFallbacks,N as registerMessages};
@@ -0,0 +1,24 @@
1
+ export { AbsoluteUIError, configurationError, validationError, runtimeError, getDiagnosticsMode } from './errors.js';
2
+ export type { ErrorCategory, ErrorDetails, DiagnosticsMode } from './errors.js';
3
+ export { configureAbsoluteUI, resetAbsoluteUIConfig, setThemeConfigDefaults, onConfigChange, getCommonConfig, defineComponentConfig, commonSchema, normalizeConfig, describeComponentConfig, } from './config/config.js';
4
+ export type { CommonConfig, ComponentConfigMap, ComponentConfigInput, ComponentConfigHandle, ConfigSchema, OptionSpec, Mutability, GlobalConfigInput, StructuredConfigInput, Density, Direction, AnimationMode, Disambiguation, NormalizedConfig, } from './config/config.js';
5
+ export * as validators from './config/validators.js';
6
+ export type { Guard } from './config/validators.js';
7
+ export { intlTimeZoneEngine, fieldsToEpoch } from './timezone/engine.js';
8
+ export type { TimeZoneEngine } from './timezone/engine.js';
9
+ export * from './timezone/types.js';
10
+ export { getTimeZoneEngine, getPossibleInstants, getLocalTimeStatus, toInstant, toPlainDateTime, zonedDateTime, formatOffset, now, } from './timezone/convert.js';
11
+ export type { LocalTimeStatus } from './timezone/convert.js';
12
+ export { recurrenceRule, parseRecurrenceRule, recurrenceRuleToString, isRecurrenceRule } from './recurrence/rule.js';
13
+ export type { RecurrenceRule, RecurrenceRuleInit, RecurrenceFrequency, RecurrenceWeekday, RecurrenceUntil, RecurrenceDate, IsoWeekday, } from './recurrence/rule.js';
14
+ export { expandRecurrence } from './recurrence/expand.js';
15
+ export type { RecurrenceExpandOptions, RecurrenceOccurrence } from './recurrence/expand.js';
16
+ export { describeRecurrence } from './recurrence/describe.js';
17
+ export type { DescribeRecurrenceOptions } from './recurrence/describe.js';
18
+ export { registerMessages, getMessage, localeFallbacks, getLocaleDirection, getDirection, getFirstDayOfWeek, formatNumber, formatCurrency, formatPlainDate, formatPlainTime, formatPlainDateTime, formatInstant, formatTimeZoneName, } from './i18n/i18n.js';
19
+ export type { MessageCatalog } from './i18n/i18n.js';
20
+ export { sanitizeHtml, sanitizeHtmlToString, setSanitizedHtml, defaultSanitizePolicy } from './sanitize/sanitize.js';
21
+ export type { SanitizePolicy } from './sanitize/sanitize.js';
22
+ export { createId, emit, DisposableGroup } from './dom.js';
23
+ export type { Disposer, EmitOptions } from './dom.js';
24
+ export { onNodeRelease, releaseNode, releaseNodes } from './render.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{AbsoluteUIError as r,configurationError as t,validationError as n,runtimeError as i,getDiagnosticsMode as a}from"./errors.js";import{configureAbsoluteUI as s,resetAbsoluteUIConfig as c,setThemeConfigDefaults as f,onConfigChange as p,getCommonConfig as u,defineComponentConfig as l,commonSchema as g,normalizeConfig as d,describeComponentConfig as x}from"./config/config.js";import*as C from"./config/validators.js";import{intlTimeZoneEngine as R,fieldsToEpoch as D}from"./timezone/engine.js";export*from"./timezone/types.js";import{getTimeZoneEngine as z,getPossibleInstants as E,getLocalTimeStatus as I,toInstant as j,toPlainDateTime as S,zonedDateTime as M,formatOffset as O,now as P}from"./timezone/convert.js";import{recurrenceRule as h,parseRecurrenceRule as k,recurrenceRuleToString as v,isRecurrenceRule as A}from"./recurrence/rule.js";import{expandRecurrence as U}from"./recurrence/expand.js";import{describeRecurrence as F}from"./recurrence/describe.js";import{registerMessages as L,getMessage as W,localeFallbacks as q,getLocaleDirection as w,getDirection as B,getFirstDayOfWeek as J,formatNumber as K,formatCurrency as Q,formatPlainDate as V,formatPlainTime as X,formatPlainDateTime as Y,formatInstant as _,formatTimeZoneName as $}from"./i18n/i18n.js";import{sanitizeHtml as oe,sanitizeHtmlToString as re,setSanitizedHtml as te,defaultSanitizePolicy as ne}from"./sanitize/sanitize.js";import{createId as ae,emit as me,DisposableGroup as se}from"./dom.js";import{onNodeRelease as fe,releaseNode as pe,releaseNodes as ue}from"./render.js";export{r as AbsoluteUIError,se as DisposableGroup,g as commonSchema,t as configurationError,s as configureAbsoluteUI,ae as createId,ne as defaultSanitizePolicy,l as defineComponentConfig,x as describeComponentConfig,F as describeRecurrence,me as emit,U as expandRecurrence,D as fieldsToEpoch,Q as formatCurrency,_ as formatInstant,K as formatNumber,O as formatOffset,V as formatPlainDate,Y as formatPlainDateTime,X as formatPlainTime,$ as formatTimeZoneName,u as getCommonConfig,a as getDiagnosticsMode,B as getDirection,J as getFirstDayOfWeek,I as getLocalTimeStatus,w as getLocaleDirection,W as getMessage,E as getPossibleInstants,z as getTimeZoneEngine,R as intlTimeZoneEngine,A as isRecurrenceRule,q as localeFallbacks,d as normalizeConfig,P as now,p as onConfigChange,fe as onNodeRelease,k as parseRecurrenceRule,h as recurrenceRule,v as recurrenceRuleToString,L as registerMessages,pe as releaseNode,ue as releaseNodes,c as resetAbsoluteUIConfig,i as runtimeError,oe as sanitizeHtml,re as sanitizeHtmlToString,te as setSanitizedHtml,f as setThemeConfigDefaults,j as toInstant,S as toPlainDateTime,n as validationError,C as validators,M as zonedDateTime};
@@ -0,0 +1,11 @@
1
+ import { type PlainDate, type PlainDateTime } from '../timezone/types.js';
2
+ import type { RecurrenceRule } from './rule.js';
3
+ export interface DescribeRecurrenceOptions {
4
+ locale?: string;
5
+ /** Series start: makes defaults explicit (the start's weekday, day of month, or date). */
6
+ start?: PlainDate | PlainDateTime;
7
+ /** Timezone for an `until` instant. Default: the configured timezone. */
8
+ timeZone?: string;
9
+ }
10
+ /** Localized description of a rule, for summaries and accessible names. */
11
+ export declare function describeRecurrence(rule: RecurrenceRule, options?: DescribeRecurrenceOptions): string;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{getCommonConfig as k}from"../config/config.js";import{getMessage as m,registerMessages as M,formatNumber as r,formatPlainDate as h,formatPlainDateTime as p,formatInstant as w}from"../i18n/i18n.js";import{dayOfWeek as P,plainDate as d}from"../timezone/types.js";M("recurrence","en",{daily:"Every day",dailyN:"Every {n} days",weekly:"Every week",weeklyN:"Every {n} weeks",monthly:"Every month",monthlyN:"Every {n} months",yearly:"Every year",yearlyN:"Every {n} years",onDays:"{base} on {days}",onMonthDays:"{base} on day {days}",inMonths:"{base} in {months}",onDate:"{base} on {date}",weekdays:"Every weekday",nth1:"first",nth2:"second",nth3:"third",nth4:"fourth",nth5:"fifth",nthLast:"last",nthLast2:"second to last",nthOther:"number {n}",nthOtherLast:"number {n} from the end",nthDay:"the {nth} {day}",lastDay:"the last day",dayFromEnd:"day {n} from the end",setPos:"the {positions} of them",times:"{text}, {count} times",once:"{text}, once",until:"{text}, until {date}"});const f=(e,s)=>h(d(2024,1,e),{weekday:"long"},s),v=(e,s)=>h(d(2024,e,1),{month:"long"},s);function c(e,s){return new Intl.ListFormat(s,{type:"conjunction",style:"long"}).format(e)}function b(e,s){const t=e>0&&e<=5?`nth${String(e)}`:e===-1?"nthLast":e===-2?"nthLast2":null;return t?m("recurrence",t,{},s):m("recurrence",e>0?"nthOther":"nthOtherLast",{n:r(Math.abs(e),{},s)},s)}function E(e,s){const t=f(e.weekday,s);return e.nth===void 0?t:m("recurrence","nthDay",{nth:b(e.nth,s),day:t},s)}function N(e,s={}){const t=s.locale??k().locale,y=(a,o={})=>m("recurrence",a,o,t),i=s.start?s.start.kind==="PlainDate"?s.start:s.start.date:null,l=e.interval,g=r(l,{},t);let n=l===1?y(e.frequency):y(`${e.frequency}N`,{n:g});const D=e.byDay.every(a=>a.nth===void 0),u=e.byDay.map(a=>a.weekday).sort((a,o)=>a-o);if((e.frequency==="weekly"||e.frequency==="daily")&&l===1&&D&&u.join()==="1,2,3,4,5"&&e.bySetPos.length===0&&e.byMonth.length===0)n=y("weekdays");else if(e.frequency==="yearly"&&e.byMonth.length===1&&e.byMonthDay.length===1&&e.byDay.length===0&&(e.byMonthDay[0]??0)>0)n=y("onDate",{base:n,date:h(d(2024,e.byMonth[0]??1,e.byMonthDay[0]??1),{month:"long",day:"numeric"},t)});else{if(e.byDay.length>0)n=y("onDays",{base:n,days:c(e.byDay.map(a=>E(a,t)),t)});else if(e.byMonthDay.length>0){const a=e.byMonthDay.map(o=>o>0?r(o,{},t):o===-1?y("lastDay"):y("dayFromEnd",{n:r(-o,{},t)}));n=e.byMonthDay.every(o=>o>0)?y("onMonthDays",{base:n,days:c(a,t)}):y("onDays",{base:n,days:c(a,t)})}else i&&(e.frequency==="weekly"?n=y("onDays",{base:n,days:f(P(i),t)}):e.frequency==="monthly"?n=y("onMonthDays",{base:n,days:r(i.day,{},t)}):e.frequency==="yearly"&&e.byMonth.length===0&&(n=y("onDate",{base:n,date:h(d(2024,i.month,i.day),{month:"long",day:"numeric"},t)})));e.byMonth.length>0&&(n=y("inMonths",{base:n,months:c(e.byMonth.map(a=>v(a,t)),t)})),e.bySetPos.length>0&&(n=`${n} (${y("setPos",{positions:c(e.bySetPos.map(a=>b(a,t)),t)})})`)}if(e.count!==null)n=e.count===1?y("once",{text:n}):y("times",{text:n,count:r(e.count,{},t)});else if(e.until!==null){const a=e.until,o=a.kind==="PlainDate"?h(a,{dateStyle:"medium"},t):a.kind==="PlainDateTime"?p(a,{dateStyle:"medium",timeStyle:"short"},t):w(a,{dateStyle:"medium",timeStyle:"short"},s.timeZone,t);n=y("until",{text:n,date:o})}return n}export{N as describeRecurrence};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Recurrence expansion (RFC 5545 section 3.3.10 and section 3.8.5, for the supported subset).
3
+ *
4
+ * Occurrences are generated as wall-clock dates in the series timezone and keep the
5
+ * start's time of day; each is then resolved to an instant with the DST
6
+ * disambiguation policy (SPEC section 8.5). So a 09:00 series stays at 09:00 local
7
+ * across daylight-saving changes, and a start in a skipped hour moves forward by
8
+ * the gap (`compatible`, as RFC 5545 requires). Invalid dates (30 February, the
9
+ * 31st of a 30-day month) are skipped, never clamped.
10
+ *
11
+ * The recurrence set is: the start (always the first occurrence, counted by
12
+ * COUNT), the rule's occurrences, plus RDATE values, minus EXDATE values.
13
+ */
14
+ import { type Disambiguation } from '../config/config.js';
15
+ import { type Instant, type PlainDate, type PlainDateTime } from '../timezone/types.js';
16
+ import { type RecurrenceRule } from './rule.js';
17
+ export interface RecurrenceExpandOptions {
18
+ /** Timezone of the start's wall-clock time (timed series). Default: the configured timezone. */
19
+ timeZone?: string;
20
+ /** Only occurrences starting at or after this bound: an instant (timed series) or a date (all-day series). */
21
+ from?: Instant | PlainDate;
22
+ /** Only occurrences starting before this bound (exclusive), of the same kind as `from`. */
23
+ to?: Instant | PlainDate;
24
+ /** Maximum number of occurrences returned, 1..100000. Default 1000. */
25
+ limit?: number;
26
+ disambiguation?: Disambiguation;
27
+ }
28
+ export interface RecurrenceOccurrence {
29
+ /** Local start: a date (all-day series) or the wall-clock time in the series timezone. */
30
+ readonly start: PlainDate | PlainDateTime;
31
+ /** Exact start of a timed occurrence; null for all-day series. */
32
+ readonly instant: Instant | null;
33
+ }
34
+ /**
35
+ * Occurrences of a recurring series starting at `start` (a date for all-day
36
+ * series, or a wall-clock time in `timeZone`), in ascending order, within
37
+ * `from`/`to` and at most `limit`. Throws `RECURRENCE_EXPAND` for mismatched
38
+ * bound kinds or an invalid limit.
39
+ */
40
+ export declare function expandRecurrence(rule: RecurrenceRule, start: PlainDate | PlainDateTime, options?: RecurrenceExpandOptions): RecurrenceOccurrence[];
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{getCommonConfig as G}from"../config/config.js";import{validationError as tn}from"../errors.js";import{toInstant as U,toPlainDateTime as H}from"../timezone/convert.js";import{fieldsToEpoch as J}from"../timezone/engine.js";import{daysInMonth as S,plainDate as rn,plainDateTime as j}from"../timezone/types.js";import{dateKey as y}from"./rule.js";const L=864e5,an=5e4,p=(e,t,o)=>Math.floor(J(e,t,o)/L),I=e=>(e%7+7+3)%7+1;function R(e){const t=new Date(e*L);return[t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate()]}function x(e,t){throw tn("RECURRENCE_EXPAND","Invalid recurrence expansion input.",{property:`expandRecurrence.${e}`,expected:t})}function on(e,t){if(t.length===0)return e;const o=new Set;for(const a of t){const r=a>0?e[a-1]:e[e.length+a];r!==void 0&&o.add(r)}return[...o].sort((a,r)=>a-r)}function cn(e,t,o){const a=[];for(let r=e+(o-I(e)+7)%7;r<=t;r+=7)a.push(r);return a}function E(e,t,o){const a=new Set;for(const r of e.byDay){const c=cn(t,o,r.weekday);if(r.nth===void 0)for(const s of c)a.add(s);else{const s=r.nth>0?c[r.nth-1]:c[c.length+r.nth];s!==void 0&&a.add(s)}}return a}function A(e,t,o){const a=S(t,o),r=[];for(const c of e.byMonthDay){const s=c>0?c:a+c+1;s>=1&&s<=a&&r.push(p(t,o,s))}return r}function Q(e,t,o,a){const r=p(t,o,1),c=r+S(t,o)-1;if(e.byMonthDay.length>0){const s=A(e,t,o);if(e.byDay.length===0)return s;const P=E(e,r,c);return s.filter(f=>P.has(f))}return e.byDay.length>0?[...E(e,r,c)]:a<=S(t,o)?[r+a-1]:[]}function sn(e,t,o,a){if(e.byMonth.length>0)return e.byMonth.flatMap(s=>Q(e,t,s,a));const r=p(t,1,1),c=p(t,12,31);if(e.byMonthDay.length>0){const s=[];for(let f=1;f<=12;f++)s.push(...A(e,t,f));if(e.byDay.length===0)return s;const P=E(e,r,c);return s.filter(f=>P.has(f))}return e.byDay.length>0?[...E(e,r,c)]:a<=S(t,o)?[p(t,o,a)]:[]}function un(e,t){const[o,a,r]=R(t),c=e.interval,s=new Set(e.byMonth),P=d=>s.size===0||s.has(R(d)[1]),f=d=>on([...new Set(d)].sort((m,u)=>m-u),e.bySetPos);switch(e.frequency){case"daily":{const d=new Set(e.byDay.map(m=>m.weekday));return{periodStart:m=>t+m*c,candidates:m=>{const u=t+m*c;if(!P(u))return[];if(d.size>0&&!d.has(I(u)))return[];if(e.byMonthDay.length>0){const[l,h]=R(u);if(!A(e,l,h).includes(u))return[]}return[u]},skipTo:m=>Math.max(0,Math.floor((m-t)/c)-1)}}case"weekly":{const d=t-(I(t)-e.weekStart+7)%7,m=e.byDay.length>0?e.byDay.map(u=>u.weekday):[I(t)];return{periodStart:u=>d+7*u*c,candidates:u=>{const l=d+7*u*c,h=[];for(let D=0;D<7;D++)m.includes(I(l+D))&&P(l+D)&&h.push(l+D);return f(h)},skipTo:u=>Math.max(0,Math.floor((u-d)/(7*c))-1)}}case"monthly":{const d=o*12+(a-1),m=u=>{const l=d+u*c;return[Math.floor(l/12),l%12+1]};return{periodStart:u=>{const[l,h]=m(u);return p(l,h,1)},candidates:u=>{const[l,h]=m(u);return s.size>0&&!s.has(h)?[]:f(Q(e,l,h,r))},skipTo:u=>{const[l,h]=R(u);return Math.max(0,Math.floor((l*12+(h-1)-d)/c)-1)}}}case"yearly":return{periodStart:d=>p(o+d*c,1,1),candidates:d=>f(sn(e,o+d*c,a,r)),skipTo:d=>Math.max(0,Math.floor((R(d)[0]-o)/c)-1)}}}const C=e=>typeof e=="object"&&e!==null?e.kind:void 0;function pn(e,t,o={}){C(e)!=="RecurrenceRule"&&x("rule","RecurrenceRule");const a=C(t)==="PlainDate";!a&&C(t)!=="PlainDateTime"&&x("start","PlainDate | PlainDateTime");const r=o.limit??1e3;(!Number.isInteger(r)||r<1||r>1e5)&&x("limit","integer from 1 to 100000");const c=a?"PlainDate":"Instant";for(const n of["from","to"]){const i=o[n];i!==void 0&&C(i)!==c&&x(n,a?"PlainDate (all-day series)":"Instant (timed series)")}const s=o.timeZone??G().timezone,P=o.disambiguation??G().disambiguation,f=a?t:t.date,d=a?null:t.time,m=p(f.year,f.month,f.day),u=n=>{const[i,k,en]=R(n);return rn(i,k,en)},l=n=>{const i=u(n);if(!d)return Object.freeze({start:i,instant:null});const k=j(i,d);return Object.freeze({start:k,instant:U(k,s,P)})},h=n=>{if(a)return l(n.kind==="PlainDate"?p(n.year,n.month,n.day):p(n.date.year,n.date.month,n.date.day));const i=n.kind==="PlainDate"?j(n,d??void 0):n;return Object.freeze({start:i,instant:U(i,s,P)})},D=o.from,M=o.to,N=n=>{if(n.kind==="PlainDate")return p(n.year,n.month,n.day);const i=H(n,s).date;return p(i.year,i.month,i.day)},K=M===void 0?1/0:N(M)+1,W=n=>D===void 0?!0:n.instant?n.instant.epochMilliseconds>=D.epochMilliseconds:y(n.start)>=y(D),q=n=>M===void 0?!0:n.instant?n.instant.epochMilliseconds<M.epochMilliseconds:y(n.start)<y(M),b=e.until;let z=1/0;if(b){const n=b.kind==="PlainDate"?b:b.kind==="PlainDateTime"?b.date:H(b,s).date;z=p(n.year,n.month,n.day)+(b.kind==="Instant"?1:0)}const F=n=>{if(!b)return!0;if(b.kind==="Instant"){if(n.instant)return n.instant.epochMilliseconds<=b.epochMilliseconds;const k=n.start;return U(j(k),s,P).epochMilliseconds<=b.epochMilliseconds}const i=n.start.kind==="PlainDate"?n.start:n.start.date;return b.kind==="PlainDate"?y(i)<=y(b):n.start.kind==="PlainDate"?y(i)<=y(b.date):y(n.start)<=y(b)},V=new Set(e.exclusions.filter(n=>n.kind==="PlainDate").map(y)),X=new Set(e.exclusions.filter(n=>n.kind==="PlainDateTime").map(y)),Y=n=>{const i=n.start.kind==="PlainDate"?n.start:n.start.date;return V.has(y(i))?!0:n.start.kind==="PlainDate"?[...X].some(k=>k.startsWith(y(i))):X.has(y(n.start))},g=[],Z=n=>{W(n)&&q(n)&&!Y(n)&&g.push(n)};let T=1;const B=l(m);F(B)?Z(B):T=1/0;const v=un(e,m);let w=!(e.count!==null)&&D!==void 0?v.skipTo(N(D)-1):0;const nn=w+an,$=e.count??1/0;n:for(;w<nn&&T<$&&g.length<r;w++){const n=v.periodStart(w);if(n>K||n>z)break;for(const i of v.candidates(w)){if(i<=m)continue;if(i>K||i>z+1)break n;const k=l(i);if(!F(k)||(T++,Z(k),T>=$||g.length>=r))break n}}for(const n of e.inclusions){const i=h(n);W(i)&&q(i)&&!Y(i)&&g.push(i)}const O=n=>n.instant?n.instant.epochMilliseconds:J(n.start.year,n.start.month,n.start.day),_=new Map;for(const n of g)_.has(O(n))||_.set(O(n),n);return[..._.values()].sort((n,i)=>O(n)-O(i)).slice(0,r)}export{pn as expandRecurrence};
@@ -0,0 +1,69 @@
1
+ import { type Instant, type PlainDate, type PlainDateTime } from '../timezone/types.js';
2
+ export type RecurrenceFrequency = 'daily' | 'weekly' | 'monthly' | 'yearly';
3
+ /** ISO weekday: 1 = Monday ... 7 = Sunday. */
4
+ export type IsoWeekday = 1 | 2 | 3 | 4 | 5 | 6 | 7;
5
+ /** A BYDAY entry: every such weekday, or the nth (1..53 from the start, -1..-53 from the end). */
6
+ export interface RecurrenceWeekday {
7
+ readonly weekday: IsoWeekday;
8
+ /** Ordinal within the month (MONTHLY, or YEARLY with BYMONTH) or the year. Omitted: every such weekday. */
9
+ readonly nth?: number;
10
+ }
11
+ /** End of a series: a date (all-day series), a wall-clock time, or an exact instant. */
12
+ export type RecurrenceUntil = PlainDate | PlainDateTime | Instant;
13
+ /** A date (all-day series) or wall-clock start in the series timezone (EXDATE and RDATE values). */
14
+ export type RecurrenceDate = PlainDate | PlainDateTime;
15
+ export interface RecurrenceRule {
16
+ readonly kind: 'RecurrenceRule';
17
+ readonly frequency: RecurrenceFrequency;
18
+ /** Every nth period, >= 1. */
19
+ readonly interval: number;
20
+ /** Total occurrences including the start; null when unbounded or bounded by `until`. */
21
+ readonly count: number | null;
22
+ /** Last allowed start (inclusive); null when unbounded or bounded by `count`. */
23
+ readonly until: RecurrenceUntil | null;
24
+ readonly byDay: readonly RecurrenceWeekday[];
25
+ /** 1..31 or -1..-31 (from the end of the month). */
26
+ readonly byMonthDay: readonly number[];
27
+ /** 1..12 */
28
+ readonly byMonth: readonly number[];
29
+ /** Positions within each period's set, 1..366 or -1..-366. */
30
+ readonly bySetPos: readonly number[];
31
+ /** First day of the week for WEEKLY periods (WKST). Default 1 (Monday). */
32
+ readonly weekStart: IsoWeekday;
33
+ /** Cancelled occurrences (EXDATE), matched against occurrence starts. */
34
+ readonly exclusions: readonly RecurrenceDate[];
35
+ /** Extra occurrences (RDATE). */
36
+ readonly inclusions: readonly RecurrenceDate[];
37
+ }
38
+ export interface RecurrenceRuleInit {
39
+ frequency: RecurrenceFrequency;
40
+ interval?: number;
41
+ count?: number | null;
42
+ until?: RecurrenceUntil | null;
43
+ byDay?: readonly RecurrenceWeekday[];
44
+ byMonthDay?: readonly number[];
45
+ byMonth?: readonly number[];
46
+ bySetPos?: readonly number[];
47
+ weekStart?: IsoWeekday;
48
+ exclusions?: readonly RecurrenceDate[];
49
+ inclusions?: readonly RecurrenceDate[];
50
+ }
51
+ /** Create a validated, frozen recurrence rule (RFC 5545 constraints included). */
52
+ export declare function recurrenceRule(init: RecurrenceRuleInit): RecurrenceRule;
53
+ /** Sortable key of a date or wall-clock time (`YYYYMMDD` or `YYYYMMDDTHHMMSS`). */
54
+ export declare function dateKey(d: RecurrenceDate): string;
55
+ /**
56
+ * iCalendar text of a rule: an `RRULE:` line, then `EXDATE` and `RDATE` lines when
57
+ * present, separated by `\n`. Wall-clock EXDATE/RDATE values are floating local
58
+ * times (no `TZID`): they are read in the series timezone.
59
+ */
60
+ export declare function recurrenceRuleToString(rule: RecurrenceRule): string;
61
+ /**
62
+ * Parse iCalendar recurrence text: a bare rule value (`FREQ=WEEKLY;BYDAY=MO`), or
63
+ * lines (`\n` or `\r\n`) with one `RRULE:` and optional `EXDATE:`/`RDATE:` lines
64
+ * (floating local or `VALUE=DATE` values; `TZID` and UTC `Z` values are not
65
+ * supported there). `UNTIL` may be a date, a local time, or UTC (`Z`). Returns null
66
+ * for invalid or unsupported input.
67
+ */
68
+ export declare function parseRecurrenceRule(text: string): RecurrenceRule | null;
69
+ export declare function isRecurrenceRule(value: unknown): value is RecurrenceRule;
@@ -0,0 +1,3 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{validationError as q}from"../errors.js";import{instant as x,plainDate as E,plainDateTime as C,plainTime as L}from"../timezone/types.js";const S=["daily","weekly","monthly","yearly"],k=["MO","TU","WE","TH","FR","SA","SU"];function i(e,n){throw q("RECURRENCE_INVALID","Invalid recurrence rule.",{property:`recurrence.${e}`,expected:n})}const h=e=>typeof e=="number"&&Number.isInteger(e),T=e=>typeof e=="object"&&e!==null?e.kind:void 0,A=e=>T(e)==="PlainDate"||T(e)==="PlainDateTime";function w(e,n,t,r){if(e===void 0)return[];(!Array.isArray(e)||!e.every(o=>h(o)&&t(o)))&&i(n,r);const s=o=>o>0?o:1e3+o;return[...new Set(e)].sort((o,c)=>s(o)-s(c))}function W(e){(typeof e!="object"||e===null)&&i("init","RecurrenceRuleInit"),S.includes(e.frequency)||i("frequency",'"daily" | "weekly" | "monthly" | "yearly"');const n=e.interval??1;(!h(n)||n<1||n>1e4)&&i("interval","integer from 1 to 10000");const t=e.count??null;t!==null&&(!h(t)||t<1||t>1e5)&&i("count","integer from 1 to 100000, or null");const r=e.until??null;r!==null&&!(A(r)||T(r)==="Instant")&&i("until","PlainDate | PlainDateTime | Instant | null"),t!==null&&r!==null&&i("until","not combined with count (RFC 5545)");const s=e.byDay??[];Array.isArray(s)||i("byDay","RecurrenceWeekday[]");const o=new Set,c=[];for(const a of s){(typeof a!="object"||a===null)&&i("byDay","RecurrenceWeekday[]");const{weekday:d,nth:f}=a;(!h(d)||d<1||d>7)&&i("byDay.weekday","integer from 1 (Monday) to 7 (Sunday)"),f!==void 0&&(!h(f)||f===0||f<-53||f>53)&&i("byDay.nth","integer from 1 to 53 or -1 to -53"),f!==void 0&&e.frequency!=="monthly"&&e.frequency!=="yearly"&&i("byDay.nth","only with monthly or yearly frequency (RFC 5545)"),f!==void 0&&e.frequency==="monthly"&&Math.abs(f)>5&&i("byDay.nth","integer from 1 to 5 or -1 to -5 for monthly frequency");const g=`${String(f??0)}|${String(d)}`;o.has(g)||(o.add(g),c.push(Object.freeze(f===void 0?{weekday:d}:{weekday:d,nth:f})))}c.sort((a,d)=>(a.nth??0)-(d.nth??0)||a.weekday-d.weekday);const b=w(e.byMonthDay,"byMonthDay",a=>a!==0&&a>=-31&&a<=31,"integers from 1 to 31 or -1 to -31");b.length>0&&e.frequency==="weekly"&&i("byMonthDay","not with weekly frequency (RFC 5545)");const u=w(e.byMonth,"byMonth",a=>a>=1&&a<=12,"integers from 1 to 12"),D=w(e.bySetPos,"bySetPos",a=>a!==0&&a>=-366&&a<=366,"integers from 1 to 366 or -366 to -1");D.length>0&&c.length===0&&b.length===0&&u.length===0&&i("bySetPos","only with byDay, byMonthDay, or byMonth (RFC 5545)");const y=e.weekStart??1;(!h(y)||y<1||y>7)&&i("weekStart","integer from 1 (Monday) to 7 (Sunday)");const R=(a,d)=>{if(a===void 0)return[];(!Array.isArray(a)||!a.every(A))&&i(d,"(PlainDate | PlainDateTime)[]");const f=a;return new Set(f.map(m=>m.kind)).size>1&&i(d,"all PlainDate or all PlainDateTime"),[...new Map(f.map(m=>[p(m),m])).values()].sort((m,N)=>p(m)<p(N)?-1:1)},P=R(e.exclusions,"exclusions"),O=R(e.inclusions,"inclusions");return Object.freeze({kind:"RecurrenceRule",frequency:e.frequency,interval:n,count:t,until:r,byDay:Object.freeze(c),byMonthDay:Object.freeze(b),byMonth:Object.freeze(u),bySetPos:Object.freeze(D),weekStart:y,exclusions:Object.freeze(P),inclusions:Object.freeze(O)})}const l=(e,n=2)=>String(e).padStart(n,"0");function p(e){return e.kind==="PlainDate"?`${l(e.year,4)}${l(e.month)}${l(e.day)}`:`${l(e.date.year,4)}${l(e.date.month)}${l(e.date.day)}T${l(e.time.hour)}${l(e.time.minute)}${l(e.time.second)}`}function Y(e){if(e.kind==="Instant"){const n=new Date(e.epochMilliseconds);return`${l(n.getUTCFullYear(),4)}${l(n.getUTCMonth()+1)}${l(n.getUTCDate())}T${l(n.getUTCHours())}${l(n.getUTCMinutes())}${l(n.getUTCSeconds())}Z`}return p(e)}function M(e,n){const t=n[0]?.kind==="PlainDate";return`${e}${t?";VALUE=DATE":""}:${n.map(p).join(",")}`}function H(e){const n=[`FREQ=${e.frequency.toUpperCase()}`];e.interval!==1&&n.push(`INTERVAL=${String(e.interval)}`),e.count!==null&&n.push(`COUNT=${String(e.count)}`),e.until!==null&&n.push(`UNTIL=${Y(e.until)}`),e.byMonth.length&&n.push(`BYMONTH=${e.byMonth.join(",")}`),e.byMonthDay.length&&n.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`),e.byDay.length&&n.push(`BYDAY=${e.byDay.map(r=>`${r.nth===void 0?"":String(r.nth)}${k[r.weekday-1]??""}`).join(",")}`),e.bySetPos.length&&n.push(`BYSETPOS=${e.bySetPos.join(",")}`),e.weekStart!==1&&n.push(`WKST=${k[e.weekStart-1]??"MO"}`);const t=[`RRULE:${n.join(";")}`];return e.exclusions.length&&t.push(M("EXDATE",e.exclusions)),e.inclusions.length&&t.push(M("RDATE",e.inclusions)),t.join(`
3
+ `)}const j=/^(\d{4})(\d{2})(\d{2})$/,F=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z?)$/;function $(e,n){try{const t=j.exec(e);if(t)return E(Number(t[1]),Number(t[2]),Number(t[3]));const r=F.exec(e);if(!r)return null;const s=E(Number(r[1]),Number(r[2]),Number(r[3])),o=L(Number(r[4]),Number(r[5]),Number(r[6]));return r[7]==="Z"?n?x(Date.UTC(s.year,s.month-1,s.day,o.hour,o.minute,o.second)):null:C(s,o)}catch{return null}}const U=e=>/^[+-]?\d{1,6}$/.test(e)?Number(e):null;function I(e,n){const t=new Set;for(const r of e.split(";")){const s=r.indexOf("=");if(s<=0)return!1;const o=r.slice(0,s).toUpperCase(),c=r.slice(s+1).toUpperCase();if(t.has(o)||c==="")return!1;t.add(o);const b=c.split(",");switch(o){case"FREQ":{const u=c.toLowerCase();if(!S.includes(u))return!1;n.frequency=u;break}case"INTERVAL":case"COUNT":{const u=U(c);if(u===null)return!1;o==="INTERVAL"?n.interval=u:n.count=u;break}case"UNTIL":{const u=$(c,!0);if(!u)return!1;n.until=u;break}case"BYDAY":{const u=[];for(const D of b){const y=/^([+-]?\d{1,2})?(MO|TU|WE|TH|FR|SA|SU)$/.exec(D);if(!y)return!1;const R=k.indexOf(y[2])+1;u.push(y[1]===void 0?{weekday:R}:{weekday:R,nth:Number(y[1])})}n.byDay=u;break}case"BYMONTHDAY":case"BYMONTH":case"BYSETPOS":{const u=b.map(U);if(u.some(y=>y===null))return!1;const D=u;o==="BYMONTHDAY"?n.byMonthDay=D:o==="BYMONTH"?n.byMonth=D:n.bySetPos=D;break}case"WKST":{const u=k.indexOf(c);if(u<0)return!1;n.weekStart=u+1;break}default:return!1}}return n.frequency!==void 0}function V(e,n){const t=e.toUpperCase();if(t!==""&&t!==";VALUE=DATE"&&t!==";VALUE=DATE-TIME")return null;const r=[];for(const s of n.split(",")){const o=$(s.trim(),!1);if(!o||o.kind==="Instant"||t===";VALUE=DATE"&&o.kind!=="PlainDate"||t===";VALUE=DATE-TIME"&&o.kind!=="PlainDateTime")return null;r.push(o)}return r}function _(e){if(typeof e!="string")return null;const n=e.split(/\r?\n/).map(c=>c.trim()).filter(c=>c!=="");if(n.length===0)return null;const t={};let r=!1;const s=[],o=[];for(const c of n){const b=/^(RRULE|EXDATE|RDATE)((?:;[^:]*)?):(.+)$/i.exec(c);if(!b){if(n.length===1&&!r&&I(c,t)){r=!0;continue}return null}const u=(b[1]??"").toUpperCase(),D=b[2]??"",y=b[3]??"";if(u==="RRULE"){if(r||D!==""||!I(y,t))return null;r=!0}else{const R=V(D,y);if(!R)return null;(u==="EXDATE"?s:o).push(...R)}}if(!r||t.frequency===void 0)return null;try{return W({...t,exclusions:s,inclusions:o})}catch{return null}}function X(e){return T(e)==="RecurrenceRule"}export{p as dateKey,X as isRecurrenceRule,_ as parseRecurrenceRule,W as recurrenceRule,H as recurrenceRuleToString};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Render-slot release contract (docs/PLAN-R9-ANGULAR.md D8). Render hooks and content
3
+ * options hand consumer-owned nodes to a component. A framework integration that
4
+ * renders such a node from its own view (an Angular embedded view, a React root, ...)
5
+ * registers how to dispose of it with `onNodeRelease`; the component calls
6
+ * `releaseNode` when it no longer uses the node (it re-rendered, dropped the item, or
7
+ * was destroyed). Plain DOM consumers need neither: unregistered nodes are ignored.
8
+ * No framework concepts here: the callback is an opaque function.
9
+ */
10
+ /** Framework integrations: run `release` once when the component no longer uses `node`. Returns `node`. */
11
+ export declare function onNodeRelease<T extends Node>(node: T, release: () => void): T;
12
+ /**
13
+ * Components: a node returned by a render hook (or passed as content) is no longer used.
14
+ * Idempotent; strings, null, and unregistered nodes are ignored. A failing release
15
+ * callback is reported and never breaks the component.
16
+ */
17
+ export declare function releaseNode(node: Node | string | null | undefined): void;
18
+ /** Release every node in `nodes` (see `releaseNode`). */
19
+ export declare function releaseNodes(nodes: Iterable<Node | string | null | undefined>): void;
package/dist/render.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ const o=new WeakMap;function i(e,r){return o.set(e,r),e}function s(e){if(e==null||typeof e=="string")return;const r=o.get(e);if(r){o.delete(e);try{r()}catch(t){const n=globalThis.reportError;n?n(t):queueMicrotask(()=>{throw t})}}}function d(e){for(const r of e)s(r)}export{i as onNodeRelease,s as releaseNode,d as releaseNodes};
@@ -0,0 +1,57 @@
1
+ export interface SanitizePolicy {
2
+ /** Allowed elements mapped to their allowed attributes. Replaces the default map when provided. */
3
+ readonly elements?: Readonly<Record<string, readonly string[]>>;
4
+ /** Attributes allowed on every allowed element. */
5
+ readonly globalAttributes?: readonly string[];
6
+ /** Allowed URL schemes for URL attributes, without the trailing colon. */
7
+ readonly urlSchemes?: readonly string[];
8
+ /** Allow scheme-less (relative) URLs. Default: true. */
9
+ readonly allowRelativeUrls?: boolean;
10
+ /** Maximum accepted input length in characters. Default: 1,000,000. */
11
+ readonly maxLength?: number;
12
+ }
13
+ export declare const defaultSanitizePolicy: Readonly<{
14
+ elements: Readonly<{
15
+ p: never[];
16
+ br: never[];
17
+ hr: never[];
18
+ strong: never[];
19
+ b: never[];
20
+ em: never[];
21
+ i: never[];
22
+ u: never[];
23
+ s: never[];
24
+ sub: never[];
25
+ sup: never[];
26
+ mark: never[];
27
+ small: never[];
28
+ span: never[];
29
+ h1: never[];
30
+ h2: never[];
31
+ h3: never[];
32
+ h4: never[];
33
+ h5: never[];
34
+ h6: never[];
35
+ ul: never[];
36
+ ol: never[];
37
+ li: never[];
38
+ blockquote: string[];
39
+ pre: never[];
40
+ code: never[];
41
+ a: string[];
42
+ }>;
43
+ globalAttributes: readonly string[];
44
+ urlSchemes: readonly string[];
45
+ allowRelativeUrls: true;
46
+ maxLength: number;
47
+ }>;
48
+ /**
49
+ * Sanitize untrusted HTML into a DocumentFragment owned by `targetDocument`.
50
+ * Prefer this over string output: the result can be inserted with
51
+ * `element.replaceChildren(fragment)` without any HTML sink.
52
+ */
53
+ export declare function sanitizeHtml(html: string, policy?: SanitizePolicy, targetDocument?: Document): DocumentFragment;
54
+ /** Sanitize and serialize. Output is stable: sanitizing it again yields the same string. */
55
+ export declare function sanitizeHtmlToString(html: string, policy?: SanitizePolicy): string;
56
+ /** Replace an element's children with sanitized content. */
57
+ export declare function setSanitizedHtml(element: Element, html: string, policy?: SanitizePolicy): void;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{validationError as f}from"../errors.js";const h="http://www.w3.org/1999/xhtml",l=Object.freeze({elements:Object.freeze({p:[],br:[],hr:[],strong:[],b:[],em:[],i:[],u:[],s:[],sub:[],sup:[],mark:[],small:[],span:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],ul:[],ol:[],li:[],blockquote:["cite"],pre:[],code:[],a:["href","title"]}),globalAttributes:Object.freeze(["lang","dir"]),urlSchemes:Object.freeze(["http","https","mailto"]),allowRelativeUrls:!0,maxLength:1e6}),b=new Set(["script","style","template","iframe","frame","frameset","object","embed","applet","base","link","meta","noscript","noembed","noframes","param","svg","math","xmp","plaintext","listing"]),y=new Set(["title","textarea","select","option","form","button","input","img","video","audio","source","track","canvas","picture","dialog","portal","head"]),T=new Set(["style","srcdoc","formaction","action","xmlns","is"]),S=new Set(["href","src","cite","poster","background","longdesc","usemap","data"]),L=256;let c;function w(e){if(c===void 0){const t=globalThis.trustedTypes;c=t?t.createPolicy("absoluteui",{createHTML:n=>n}):null}return c?c.createHTML(e):e}function P(e){return{elements:e?.elements??l.elements,globalAttributes:e?.globalAttributes??l.globalAttributes,urlSchemes:(e?.urlSchemes??l.urlSchemes).map(t=>t.toLowerCase()),allowRelativeUrls:e?.allowRelativeUrls??l.allowRelativeUrls,maxLength:e?.maxLength??l.maxLength}}function R(e,t,n){const r=e.replace(/[\t\n\r]/g,"").replace(/^[\u0000- ]+|[\u0000- ]+$/g,""),i=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(r)?.[1];if(i===void 0){if(!n)return!1;try{return new URL(r,"https://absoluteui.invalid/").protocol==="https:"}catch{return!1}}if(!t.includes(i.toLowerCase()))return!1;try{return t.includes(new URL(r).protocol.slice(0,-1).toLowerCase())}catch{return!1}}function x(e,t,n,r){for(const i of Array.from(e.attributes)){const o=i.name.toLowerCase();i.namespaceURI===null&&(o.startsWith("on")||T.has(o)||!n.includes(o)&&!r.globalAttributes.includes(o)||S.has(o)&&!R(i.value,r.urlSchemes,r.allowRelativeUrls)||o==="dir"&&!["ltr","rtl","auto"].includes(i.value.toLowerCase())||t.setAttribute(o,i.value))}t.localName==="a"&&t.hasAttribute("target")&&t.setAttribute("rel","noopener noreferrer")}function d(e,t,n,r,i){if(!(i>L))for(const o of Array.from(e.childNodes)){if(o.nodeType===Node.TEXT_NODE){t.appendChild(n.createTextNode(o.nodeValue??""));continue}if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o,s=a.localName.toLowerCase();if(a.namespaceURI!==h||b.has(s))continue;const m=Object.hasOwn(r.elements,s)?r.elements[s]:void 0;if(m){const u=n.createElement(s);x(a,u,m,r),t.appendChild(u),d(a,u,n,r,i+1)}else y.has(s)||d(a,t,n,r,i+1)}}function p(e,t,n=document){const r=P(t);if(typeof e!="string")throw f("SAN_INVALID_INPUT","Sanitizer input must be a string.",{property:"html",expected:"string"});if(e.length>r.maxLength)throw f("SAN_INPUT_TOO_LARGE","Sanitizer input exceeds the maximum length.",{property:"html",expected:`at most ${r.maxLength} characters`});const i=g(e,r,n),o=n.createElement("div");return o.appendChild(i),g(o.innerHTML,r,n)}function g(e,t,n){const r=new DOMParser().parseFromString(w(`<body>${e}`),"text/html"),i=n.createDocumentFragment();return d(r.body,i,n,t,0),i}function v(e,t){const n=document.createElement("div");return n.appendChild(p(e,t)),n.innerHTML}function z(e,t,n){e.replaceChildren(p(t,n,e.ownerDocument))}export{l as defaultSanitizePolicy,p as sanitizeHtml,v as sanitizeHtmlToString,z as setSanitizedHtml};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Local <-> instant conversion with explicit DST disambiguation (SPEC section 8.5).
3
+ */
4
+ import { type Disambiguation } from '../config/config.js';
5
+ import { type TimeZoneEngine } from './engine.js';
6
+ import { type Instant, type PlainDateTime, type ZonedDateTime } from './types.js';
7
+ /** Active engine: configured resolver (section 8.7) or the built-in Intl engine. */
8
+ export declare function getTimeZoneEngine(): TimeZoneEngine;
9
+ export type LocalTimeStatus = 'exact' | 'ambiguous' | 'nonexistent';
10
+ /**
11
+ * All instants at which the wall-clock time occurs in the zone:
12
+ * one (exact), two (ambiguous, clock fell back) or none (nonexistent, clock sprang forward).
13
+ */
14
+ export declare function getPossibleInstants(value: PlainDateTime, timeZone: string, engine?: TimeZoneEngine): Instant[];
15
+ export declare function getLocalTimeStatus(value: PlainDateTime, timeZone: string, engine?: TimeZoneEngine): LocalTimeStatus;
16
+ /**
17
+ * Convert a wall-clock time in a zone to an exact instant.
18
+ *
19
+ * | Case | compatible | earlier | later | reject |
20
+ * |---|---|---|---|---|
21
+ * | ambiguous | earlier instant | earlier instant | later instant | error |
22
+ * | nonexistent | shift forward by gap | shift backward by gap | shift forward by gap | error |
23
+ */
24
+ export declare function toInstant(value: PlainDateTime, timeZone: string, disambiguation?: Disambiguation, engine?: TimeZoneEngine): Instant;
25
+ /** Wall-clock time of an instant in a zone. */
26
+ export declare function toPlainDateTime(value: Instant | ZonedDateTime, timeZone?: string, engine?: TimeZoneEngine): PlainDateTime;
27
+ export declare function zonedDateTime(value: Instant, timeZone: string, engine?: TimeZoneEngine): ZonedDateTime;
28
+ /** Offset string such as "+05:30" for an instant in a zone. */
29
+ export declare function formatOffset(value: Instant, timeZone: string, engine?: TimeZoneEngine): string;
30
+ /** Current instant. Isolated for testability; components never read the host timezone. */
31
+ export declare function now(): Instant;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{getCommonConfig as f}from"../config/config.js";import{configurationError as D,validationError as g}from"../errors.js";import{fieldsToEpoch as M,intlTimeZoneEngine as E}from"./engine.js";import{instant as l,plainDate as Z,plainDateTime as x,plainTime as I}from"./types.js";const m=864e5;function c(){return f().timeZoneEngine??E}function T(n,e){if(!n.isValidTimeZone(e))throw D("TZ_INVALID_ZONE","Unsupported timezone identifier.",{property:"timeZone",expected:"IANA timezone identifier"})}function p(n){const{date:e,time:t}=n;return M(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond)}function d(n,e,t=c()){T(t,e);const o=p(n),i=new Set([t.getOffsetMs(o-m,e),t.getOffsetMs(o+m,e)]),s=new Set;for(const a of i){const r=o-a;t.getOffsetMs(r,e)===a&&s.add(r)}return[...s].sort((a,r)=>a-r).map(l)}function C(n,e,t){const o=d(n,e,t).length;return o===1?"exact":o>1?"ambiguous":"nonexistent"}function U(n,e,t=f().disambiguation,o=c()){const i=d(n,e,o),[s,a]=i;if(s&&!a)return s;if(s&&a){if(t==="reject")throw g("TZ_AMBIGUOUS_TIME","The local time is ambiguous in the selected timezone.",{property:"value",remediation:"Choose an explicit disambiguation or a different time."});return t==="later"?a:s}if(t==="reject")throw g("TZ_NONEXISTENT_TIME","The local time does not exist in the selected timezone.",{property:"value",remediation:"Choose a time outside the daylight-saving gap."});const r=p(n),u=o.getOffsetMs(r-m,e),h=o.getOffsetMs(r+m,e);return l(t==="earlier"?r-h:r-u)}function _(n,e,t=c()){const o=e??(n.kind==="ZonedDateTime"?n.timeZone:f().timezone);T(t,o);const i=new Date(n.epochMilliseconds+t.getOffsetMs(n.epochMilliseconds,o));return x(Z(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate()),I(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()))}function w(n,e,t=c()){return T(t,e),Object.freeze({kind:"ZonedDateTime",epochMilliseconds:n.epochMilliseconds,timeZone:e})}function z(n,e,t=c()){const o=Math.round(t.getOffsetMs(n.epochMilliseconds,e)/6e4),i=o<0?"-":"+",s=Math.abs(o);return`${i}${String(Math.floor(s/60)).padStart(2,"0")}:${String(s%60).padStart(2,"0")}`}function P(){return l(Date.now())}export{z as formatOffset,C as getLocalTimeStatus,d as getPossibleInstants,c as getTimeZoneEngine,P as now,U as toInstant,_ as toPlainDateTime,w as zonedDateTime};
@@ -0,0 +1,8 @@
1
+ export interface TimeZoneEngine {
2
+ /** Offset (local - UTC) in milliseconds for the given instant in the given zone. */
3
+ getOffsetMs(epochMilliseconds: number, timeZone: string): number;
4
+ isValidTimeZone(timeZone: string): boolean;
5
+ }
6
+ /** UTC epoch milliseconds for wall-clock fields, correct for years 0-99 and negative years. */
7
+ export declare function fieldsToEpoch(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number;
8
+ export declare const intlTimeZoneEngine: TimeZoneEngine;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{isValidTimeZone as f,offsetAt as l}from"@absoluteui/helpers/timezone";function T(e,n,o,t=0,r=0,s=0,m=0){const i=new Date(0);return i.setUTCFullYear(e,n-1,o),i.setUTCHours(t,r,s,m),i.getTime()}const g={getOffsetMs:(e,n)=>l(e,n),isValidTimeZone:e=>f(e)};export{T as fieldsToEpoch,g as intlTimeZoneEngine};
@@ -0,0 +1,104 @@
1
+ export interface PlainDate {
2
+ readonly kind: 'PlainDate';
3
+ readonly year: number;
4
+ /** 1-12 */
5
+ readonly month: number;
6
+ /** 1-31 */
7
+ readonly day: number;
8
+ }
9
+ export interface PlainTime {
10
+ readonly kind: 'PlainTime';
11
+ readonly hour: number;
12
+ readonly minute: number;
13
+ readonly second: number;
14
+ readonly millisecond: number;
15
+ }
16
+ export interface PlainDateTime {
17
+ readonly kind: 'PlainDateTime';
18
+ readonly date: PlainDate;
19
+ readonly time: PlainTime;
20
+ }
21
+ /** An exact point on the UTC timeline. */
22
+ export interface Instant {
23
+ readonly kind: 'Instant';
24
+ readonly epochMilliseconds: number;
25
+ }
26
+ /** An exact instant observed in a specific IANA timezone. */
27
+ export interface ZonedDateTime {
28
+ readonly kind: 'ZonedDateTime';
29
+ readonly epochMilliseconds: number;
30
+ readonly timeZone: string;
31
+ }
32
+ /** A fixed-length duration in milliseconds (not a calendar duration such as "1 month"). */
33
+ export interface Duration {
34
+ readonly kind: 'Duration';
35
+ readonly milliseconds: number;
36
+ }
37
+ /** Inclusive range of comparable values. */
38
+ export interface Range<T> {
39
+ readonly start: T;
40
+ readonly end: T;
41
+ }
42
+ export declare function isLeapYear(year: number): boolean;
43
+ export declare function daysInMonth(year: number, month: number): number;
44
+ export declare function plainDate(year: number, month: number, day: number): PlainDate;
45
+ export declare function plainTime(hour: number, minute?: number, second?: number, millisecond?: number): PlainTime;
46
+ export declare function plainDateTime(date: PlainDate, time?: PlainTime): PlainDateTime;
47
+ export declare function instant(epochMilliseconds: number): Instant;
48
+ export declare function duration(milliseconds: number): Duration;
49
+ export declare function comparePlainDate(a: PlainDate, b: PlainDate): -1 | 0 | 1;
50
+ export declare function plainDatesEqual(a: PlainDate | null, b: PlainDate | null): boolean;
51
+ /** ISO weekday: 1 = Monday ... 7 = Sunday. */
52
+ export declare function dayOfWeek(date: PlainDate): number;
53
+ export declare function addDays(date: PlainDate, days: number): PlainDate;
54
+ /** Adds calendar months, clamping the day to the target month's length. */
55
+ export declare function addMonths(date: PlainDate, months: number): PlainDate;
56
+ export declare function plainDateToString(date: PlainDate): string;
57
+ export declare function plainTimeToString(time: PlainTime): string;
58
+ /** Strict ISO 8601 calendar date (`YYYY-MM-DD`). Returns null when invalid. */
59
+ export declare function parsePlainDate(text: string): PlainDate | null;
60
+ /** Strict ISO 8601 time (`HH:MM[:SS[.sss]]`). Returns null when invalid. */
61
+ export declare function parsePlainTime(text: string): PlainTime | null;
62
+ /** Strict ISO 8601 instant; requires `Z` or an explicit offset. Returns null when invalid. */
63
+ export declare function parseInstant(text: string): Instant | null;
64
+ export declare function instantToString(value: Instant): string;
65
+ /** A calendar month without a day (ISO 8601 `YYYY-MM`). */
66
+ export interface PlainYearMonth {
67
+ readonly kind: 'PlainYearMonth';
68
+ readonly year: number;
69
+ /** 1-12 */
70
+ readonly month: number;
71
+ }
72
+ /** A calendar quarter (`YYYY-Qn`): Q1 is January to March, Q4 October to December. */
73
+ export interface PlainYearQuarter {
74
+ readonly kind: 'PlainYearQuarter';
75
+ readonly year: number;
76
+ /** 1-4 */
77
+ readonly quarter: number;
78
+ }
79
+ export declare function plainYearMonth(year: number, month: number): PlainYearMonth;
80
+ export declare function plainYearQuarter(year: number, quarter: number): PlainYearQuarter;
81
+ export declare function comparePlainYearMonth(a: PlainYearMonth, b: PlainYearMonth): -1 | 0 | 1;
82
+ export declare function comparePlainYearQuarter(a: PlainYearQuarter, b: PlainYearQuarter): -1 | 0 | 1;
83
+ /** ISO 8601 `YYYY-MM`. */
84
+ export declare function plainYearMonthToString(value: PlainYearMonth): string;
85
+ /** `YYYY-Qn` (the ISO 8601-2 quarter notation used by most reporting tools). */
86
+ export declare function plainYearQuarterToString(value: PlainYearQuarter): string;
87
+ /** Strict ISO 8601 year and month (`YYYY-MM`). Returns null when invalid. */
88
+ export declare function parsePlainYearMonth(text: string): PlainYearMonth | null;
89
+ /** Strict `YYYY-Qn`. Returns null when invalid. */
90
+ export declare function parsePlainYearQuarter(text: string): PlainYearQuarter | null;
91
+ /**
92
+ * ISO 8601 duration of a fixed-length `Duration`, in hours, minutes, and seconds
93
+ * (`PT1H30M`, `PT36H`, `PT0.25S`, `PT0S`). Days are never emitted, because an ISO
94
+ * day is a calendar day that is not always 24 hours long. Negative durations use
95
+ * the ISO 8601-2 leading minus (`-PT5M`).
96
+ */
97
+ export declare function durationToString(value: Duration): string;
98
+ /**
99
+ * Strict ISO 8601 duration with day, hour, minute, and second designators
100
+ * (`P1DT2H`, `PT90M`, `PT1.5S`), as a fixed-length `Duration`. A day counts as
101
+ * exactly 24 hours. Years, months, and weeks are calendar units and are rejected,
102
+ * as are empty designators (`P`, `PT`). Returns null when invalid.
103
+ */
104
+ export declare function parseDuration(text: string): Duration | null;
@@ -0,0 +1,2 @@
1
+ /*! AbsoluteUI @absoluteui/core v0.13.2 | (c) Kasadara Technology Solutions Pvt Ltd | Apache-2.0 | https://aui.kasadara.com/license/ */
2
+ import{addDays as P,addMonths as T,daysInMonth as D,isLeapYear as x,isoWeekday as g}from"@absoluteui/helpers/date";import{isHelperError as $}from"@absoluteui/helpers/error";import{validationError as c}from"../errors.js";function Z(n){return x(n)}function M(n,e){return D(n,e)}function y(n){try{return n()}catch(e){throw $(e)?c("DT_OUT_OF_RANGE","Date/time field out of range.",{property:"date",expected:`year within +/-${String(d)}`}):e}}const d=275759;function i(n,e,r,t){if(!Number.isInteger(n)||n<e||n>r)throw c("DT_OUT_OF_RANGE","Date/time field out of range.",{property:t,expected:`integer ${e}..${r}`})}function Y(n,e,r){return i(n,-d,d,"year"),i(e,1,12,"month"),i(r,1,M(n,e),"day"),Object.freeze({kind:"PlainDate",year:n,month:e,day:r})}function h(n,e=0,r=0,t=0){return i(n,0,23,"hour"),i(e,0,59,"minute"),i(r,0,59,"second"),i(t,0,999,"millisecond"),Object.freeze({kind:"PlainTime",hour:n,minute:e,second:r,millisecond:t})}function q(n,e=h(0)){return Object.freeze({kind:"PlainDateTime",date:n,time:e})}function _(n){if(!Number.isFinite(n)||Math.abs(n)>864e13)throw c("DT_OUT_OF_RANGE","Instant out of range.",{property:"epochMilliseconds",expected:"finite number within +/-8.64e15"});return Object.freeze({kind:"Instant",epochMilliseconds:n})}function N(n){if(!Number.isFinite(n))throw c("DT_OUT_OF_RANGE","Duration out of range.",{property:"milliseconds",expected:"finite number"});return Object.freeze({kind:"Duration",milliseconds:n})}function E(n,e){const r=n.year*1e4+n.month*100+n.day,t=e.year*1e4+e.month*100+e.day;return r<t?-1:r>t?1:0}function G(n,e){return n===null||e===null?n===e:E(n,e)===0}function W(n){return g(n)}function C(n,e){return y(()=>P(n,Math.trunc(e)))}function L(n,e){return y(()=>T(n,Math.trunc(e)))}const o=(n,e=2)=>String(Math.abs(n)).padStart(e,"0");function b(n){return n>=0&&n<=9999?o(n,4):`${n<0?"-":"+"}${o(n,6)}`}function X(n){return`${b(n.year)}-${o(n.month)}-${o(n.day)}`}function B(n){const e=`${o(n.hour)}:${o(n.minute)}:${o(n.second)}`;return n.millisecond?`${e}.${o(n.millisecond,3)}`:e}const I=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,O=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;function S(n){const e=I.exec(n);if(!e)return null;const r=Number(e[1]);if(e[1]==="-000000")return null;try{return Y(r,Number(e[2]),Number(e[3]))}catch{return null}}function R(n){const e=O.exec(n);if(!e)return null;try{return h(Number(e[1]),Number(e[2]),Number(e[3]??0),Number((e[4]??"0").padEnd(3,"0")))}catch{return null}}const k=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})$/;function J(n){const e=k.exec(n);if(!e)return null;const r=S(`${e[1]??""}-${e[2]??""}-${e[3]??""}`),t=R(`${e[4]??""}:${e[5]??""}:${e[6]??"00"}${e[7]?`.${e[7]}`:""}`);if(!r||!t)return null;const a=e[8]??"Z";let u=0;if(a!=="Z"){const s=a.startsWith("-")?-1:1,[f,p]=a.slice(1).split(":").map(Number);if(f===void 0||p===void 0||f>23||p>59)return null;u=s*(f*36e5+p*6e4)}const l=new Date(0);return l.setUTCFullYear(r.year,r.month-1,r.day),l.setUTCHours(t.hour,t.minute,t.second,t.millisecond),_(l.getTime()-u)}function K(n){return new Date(n.epochMilliseconds).toISOString()}function Q(n,e){return i(n,-d,d,"year"),i(e,1,12,"month"),Object.freeze({kind:"PlainYearMonth",year:n,month:e})}function A(n,e){return i(n,-d,d,"year"),i(e,1,4,"quarter"),Object.freeze({kind:"PlainYearQuarter",year:n,quarter:e})}function V(n,e){const r=n.year*12+n.month,t=e.year*12+e.month;return r<t?-1:r>t?1:0}function v(n,e){const r=n.year*4+n.quarter,t=e.year*4+e.quarter;return r<t?-1:r>t?1:0}function nn(n){return`${b(n.year)}-${o(n.month)}`}function en(n){return`${b(n.year)}-Q${String(n.quarter)}`}const w=/^([+-]\d{6}|\d{4})-(\d{2})$/,U=/^([+-]\d{6}|\d{4})-Q([1-4])$/;function rn(n){const e=w.exec(n);if(!e||e[1]==="-000000")return null;try{return Q(Number(e[1]),Number(e[2]))}catch{return null}}function tn(n){const e=U.exec(n);if(!e||e[1]==="-000000")return null;try{return A(Number(e[1]),Number(e[2]))}catch{return null}}const m=36e5,z=/^(-)?P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)(?:[.,](\d{1,3}))?S)?)?$/;function an(n){const e=Math.round(n.milliseconds);let r=Math.abs(e);const t=Math.floor(r/m);r-=t*m;const a=Math.floor(r/6e4);r-=a*6e4;const u=Math.floor(r/1e3),l=r-u*1e3;let s="";return t&&(s+=`${String(t)}H`),a&&(s+=`${String(a)}M`),(u||l||s==="")&&(s+=`${String(u)}${l?`.${o(l,3).replace(/0+$/,"")}`:""}S`),`${e<0?"-":""}PT${s}`}function on(n){const e=z.exec(n);if(!e||n.endsWith("T")||!/\d/.test(n))return null;const r=u=>Number(e[u]??0),t=Number((e[6]??"0").padEnd(3,"0")),a=r(2)*24*m+r(3)*m+r(4)*6e4+r(5)*1e3+t;return Number.isSafeInteger(a)?N(e[1]&&a!==0?-a:a):null}export{C as addDays,L as addMonths,E as comparePlainDate,V as comparePlainYearMonth,v as comparePlainYearQuarter,W as dayOfWeek,M as daysInMonth,N as duration,an as durationToString,_ as instant,K as instantToString,Z as isLeapYear,on as parseDuration,J as parseInstant,S as parsePlainDate,R as parsePlainTime,rn as parsePlainYearMonth,tn as parsePlainYearQuarter,Y as plainDate,q as plainDateTime,X as plainDateToString,G as plainDatesEqual,h as plainTime,B as plainTimeToString,Q as plainYearMonth,nn as plainYearMonthToString,A as plainYearQuarter,en as plainYearQuarterToString};
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@absoluteui/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.13.2",
4
+ "description": "AbsoluteUI core: configuration, diagnostics, i18n, timezone, and sanitization engines.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://aui.kasadara.com/docs/api/core/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kasadara-labs/AbsoluteUI.git",
11
+ "directory": "packages/core"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "registry": "https://registry.npmjs.org/"
16
+ },
17
+ "sideEffects": [
18
+ "**/*.css"
19
+ ],
20
+ "files": [
21
+ "dist",
22
+ "LICENSE",
23
+ "NOTICE",
24
+ "SECURITY.md",
25
+ "metadata"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "dependencies": {
35
+ "@absoluteui/helpers": "0.13.2"
36
+ }
37
+ }