@mythicalos/ui-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.md +89 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/logic/button.d.ts +10 -0
- package/dist/logic/button.js +12 -0
- package/dist/logic/dialog.d.ts +9 -0
- package/dist/logic/dialog.js +12 -0
- package/dist/logic/gauge.d.ts +13 -0
- package/dist/logic/gauge.js +18 -0
- package/dist/logic/poll.d.ts +72 -0
- package/dist/logic/poll.js +80 -0
- package/dist/logic/toast.d.ts +20 -0
- package/dist/logic/toast.js +14 -0
- package/dist/logic/tone.d.ts +8 -0
- package/dist/logic/tone.js +19 -0
- package/package.json +61 -0
- package/src/select/mythical-select.d.ts +115 -0
- package/src/select/mythical-select.js +1279 -0
- package/src/select/register.js +4 -0
- package/styles.css +302 -0
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mythicalos/ui-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "mythicalOS framework-agnostic UI core — the pure logic (class derivation, poll scheduling, dialog/toast/gauge helpers), the token-driven component stylesheet, and the <mythical-select> form-associated web component. Zero framework runtime; the Preact and React bindings derive identical output from this package. Apache-2.0.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/mythicalOS/mythical-ui.git",
|
|
13
|
+
"directory": "packages/ui-core"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/mythicalOS/mythical-ui#packages",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./logic": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./styles.css": "./styles.css",
|
|
26
|
+
"./select": {
|
|
27
|
+
"types": "./src/select/mythical-select.d.ts",
|
|
28
|
+
"default": "./src/select/register.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"styles.css",
|
|
34
|
+
"src/select",
|
|
35
|
+
"README.md",
|
|
36
|
+
"NOTICE"
|
|
37
|
+
],
|
|
38
|
+
"sideEffects": [
|
|
39
|
+
"*.css",
|
|
40
|
+
"./src/select/register.js",
|
|
41
|
+
"./src/select/mythical-select.js"
|
|
42
|
+
],
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@mythicalos/tokens": "^0.5.11"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@mythicalos/tokens": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.build.json",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test:select": "playwright test",
|
|
55
|
+
"prepublishOnly": "bun run build && bun test && bun run typecheck"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@playwright/test": "^1.61.1",
|
|
59
|
+
"typescript": "^5"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* Hand-written type declarations for mythical-select.js.
|
|
2
|
+
*
|
|
3
|
+
* The module has NO named exports. Importing it registers the custom elements
|
|
4
|
+
* as a side effect:
|
|
5
|
+
*
|
|
6
|
+
* import '@mythicalos/ui-core/select';
|
|
7
|
+
* // defines <mythical-select>, <mythical-option>, <mythical-optgroup>
|
|
8
|
+
*
|
|
9
|
+
* The element class is therefore not importable; at runtime it is reachable
|
|
10
|
+
* only through the registry:
|
|
11
|
+
*
|
|
12
|
+
* const Ctor = customElements.get('mythical-select') as
|
|
13
|
+
* MythicalSelectElementConstructor | undefined;
|
|
14
|
+
*
|
|
15
|
+
* The names below are ambient INTERFACES (types only — no global constructor
|
|
16
|
+
* values exist; `new MythicalSelectElement()` is deliberately a type error).
|
|
17
|
+
* Construct via `document.createElement` or markup, or `new` the constructor
|
|
18
|
+
* obtained from `customElements.get()` typed as the *Constructor interface.
|
|
19
|
+
*
|
|
20
|
+
* Attributes: name · value · disabled · required · variant="chip" (compact
|
|
21
|
+
* policy-chip look). Form association is automatic.
|
|
22
|
+
* Events: 'input' and 'change' (plain Events, bubbling + composed) fire on
|
|
23
|
+
* user commits only — programmatic value/selectedIndex writes fire
|
|
24
|
+
* nothing, like native <select>.
|
|
25
|
+
* Not supported (use a native <select>): multiple, size (listbox mode).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
declare global {
|
|
29
|
+
|
|
30
|
+
/** Immutable snapshot of one option, as returned by `options` / `item(i)`. */
|
|
31
|
+
interface MythicalSelectOption {
|
|
32
|
+
/** Canonical value — falls back to the whitespace-collapsed text, like native. */
|
|
33
|
+
readonly value: string;
|
|
34
|
+
readonly text: string;
|
|
35
|
+
/** Display text — the `label` attribute when present, otherwise `text`. */
|
|
36
|
+
readonly label: string;
|
|
37
|
+
readonly disabled: boolean;
|
|
38
|
+
/** True when this option is the CURRENTLY selected one (at snapshot time),
|
|
39
|
+
* not the adoption-time `[selected]` default. */
|
|
40
|
+
readonly selected: boolean;
|
|
41
|
+
/** The `label` of the owning optgroup, or null when ungrouped. */
|
|
42
|
+
readonly group: string | null;
|
|
43
|
+
readonly index: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `<mythical-select>` — form-associated, native-parity styled single select.
|
|
48
|
+
* Register by importing the module; construct via `document.createElement`
|
|
49
|
+
* or markup, not `new` (no global constructor value exists — see
|
|
50
|
+
* `MythicalSelectElementConstructor`).
|
|
51
|
+
*/
|
|
52
|
+
interface MythicalSelectElement extends HTMLElement {
|
|
53
|
+
/** Always 'select-one', like a native single select. */
|
|
54
|
+
readonly type: 'select-one';
|
|
55
|
+
|
|
56
|
+
/** Current value ('' when nothing is selected). Programmatic writes fire no events. */
|
|
57
|
+
value: string;
|
|
58
|
+
/** Index of the selected option, -1 for none. Programmatic writes fire no events. */
|
|
59
|
+
selectedIndex: number;
|
|
60
|
+
/** Snapshot array of the current options (not live, unlike native HTMLOptionsCollection). */
|
|
61
|
+
readonly options: ReadonlyArray<MythicalSelectOption>;
|
|
62
|
+
/** Snapshot of the option at `index`, or null when out of range. */
|
|
63
|
+
item(index: number): MythicalSelectOption | null;
|
|
64
|
+
/** Number of options. */
|
|
65
|
+
readonly length: number;
|
|
66
|
+
|
|
67
|
+
/** Reflects the `name` attribute (form submission key). */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Reflects the `disabled` attribute. */
|
|
70
|
+
disabled: boolean;
|
|
71
|
+
/** Reflects the `required` attribute. */
|
|
72
|
+
required: boolean;
|
|
73
|
+
|
|
74
|
+
/** Owning form, via ElementInternals. */
|
|
75
|
+
readonly form: HTMLFormElement | null;
|
|
76
|
+
/** Associated `<label>` elements, via ElementInternals. */
|
|
77
|
+
readonly labels: NodeListOf<HTMLLabelElement>;
|
|
78
|
+
|
|
79
|
+
readonly validity: ValidityState;
|
|
80
|
+
readonly validationMessage: string;
|
|
81
|
+
readonly willValidate: boolean;
|
|
82
|
+
checkValidity(): boolean;
|
|
83
|
+
reportValidity(): boolean;
|
|
84
|
+
setCustomValidity(message: string): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `<mythical-option>` — inert data carrier child of `<mythical-select>`.
|
|
88
|
+
* Attributes: value · disabled · selected · label (overrides display text);
|
|
89
|
+
* option text is its text content (whitespace-collapsed, like native). */
|
|
90
|
+
interface MythicalOptionElement extends HTMLElement {}
|
|
91
|
+
|
|
92
|
+
/** `<mythical-optgroup>` — inert option-group wrapper.
|
|
93
|
+
* Attributes: label · disabled. */
|
|
94
|
+
interface MythicalOptgroupElement extends HTMLElement {}
|
|
95
|
+
|
|
96
|
+
/** Constructor type for `<mythical-select>` — reachable at runtime ONLY through
|
|
97
|
+
* the registry: `customElements.get('mythical-select') as
|
|
98
|
+
* MythicalSelectElementConstructor | undefined`. */
|
|
99
|
+
interface MythicalSelectElementConstructor { new (): MythicalSelectElement }
|
|
100
|
+
|
|
101
|
+
/** Constructor type for `<mythical-option>` — via `customElements.get('mythical-option')`. */
|
|
102
|
+
interface MythicalOptionElementConstructor { new (): MythicalOptionElement }
|
|
103
|
+
|
|
104
|
+
/** Constructor type for `<mythical-optgroup>` — via `customElements.get('mythical-optgroup')`. */
|
|
105
|
+
interface MythicalOptgroupElementConstructor { new (): MythicalOptgroupElement }
|
|
106
|
+
|
|
107
|
+
interface HTMLElementTagNameMap {
|
|
108
|
+
'mythical-select': MythicalSelectElement;
|
|
109
|
+
'mythical-option': MythicalOptionElement;
|
|
110
|
+
'mythical-optgroup': MythicalOptgroupElement;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export {};
|