@joystyk/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/NOTICE +36 -0
- package/README.md +33 -2
- package/dist/ad-slot.d.ts +129 -0
- package/dist/ad-slot.js +628 -0
- package/dist/ad-slot.js.map +1 -0
- package/dist/ad-wire.d.ts +96 -0
- package/dist/ad-wire.js +101 -0
- package/dist/ad-wire.js.map +1 -0
- package/dist/button.d.ts +40 -0
- package/dist/button.js +133 -0
- package/dist/button.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/slots.d.ts +38 -0
- package/dist/slots.js +154 -0
- package/dist/slots.js.map +1 -0
- package/dist/tokens.css +98 -0
- package/package.json +72 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @joystyk/ui
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Prepare the first compiled library release: ESM and API declarations for every public entry point, runtime assets, and checks against installed npm tarballs. Games and applications remain private.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joystyk contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Third-party material in the Joystyk library release
|
|
2
|
+
|
|
3
|
+
This notice preserves third-party attribution. Original Joystyk code in the 17
|
|
4
|
+
platform libraries under packages/ uses the MIT license in packages/LICENSE.
|
|
5
|
+
That choice does not license the private applications, games or other repository
|
|
6
|
+
material, and does not replace the third-party terms below.
|
|
7
|
+
|
|
8
|
+
@joystyk/contracts
|
|
9
|
+
------------------
|
|
10
|
+
Standard Schema v1 type definitions from @standard-schema/spec 1.1.0:
|
|
11
|
+
https://github.com/standard-schema/standard-schema
|
|
12
|
+
https://standardschema.dev
|
|
13
|
+
Copyright (c) 2024 Colin McDonnell. MIT License.
|
|
14
|
+
The complete license and source/change notes accompany the distributed
|
|
15
|
+
dist/standard-schema.d.ts definitions. Changes: individually exported declarations
|
|
16
|
+
and formatting; the declarations themselves are unchanged.
|
|
17
|
+
|
|
18
|
+
@joystyk/identity and @joystyk/content
|
|
19
|
+
-----------------------------------
|
|
20
|
+
Word blocklists derived from List of Dirty, Naughty, Obscene, and Otherwise Bad
|
|
21
|
+
Words, copyright Shutterstock, Inc. and contributors:
|
|
22
|
+
https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words
|
|
23
|
+
Licensed under Creative Commons Attribution 4.0 International:
|
|
24
|
+
https://creativecommons.org/licenses/by/4.0/
|
|
25
|
+
Identity uses the English list at commit
|
|
26
|
+
5faf2ba42d7b1c0977169ec3611df25a3c08eb13. Changes include reducing or dropping
|
|
27
|
+
phrases, dropping words with everyday meanings, substituting stems for inflections
|
|
28
|
+
and adding entries. Identity's README and content's lists/blocklist.txt retain
|
|
29
|
+
their source-specific provenance and changes.
|
|
30
|
+
|
|
31
|
+
@joystyk/content
|
|
32
|
+
---------------
|
|
33
|
+
SCOWL-derived common, vocabulary and ranked word lists use SCOWL 2020.12.07.
|
|
34
|
+
Their complete source licenses and attribution accompany the package in
|
|
35
|
+
lists/SCOWL-COPYRIGHT. Word-list transformations and build provenance are described
|
|
36
|
+
in the package README. Preserve that copyright file when redistributing the lists.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @joystyk/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared Gyral controls and design tokens. Import a component module once to register its custom element. The button wraps a native button and supports keyboard activation and a pressed state. Ad modules implement contextual slots and their validated wire formats.
|
|
4
|
+
|
|
5
|
+
## npm package
|
|
6
|
+
|
|
7
|
+
The first `0.1.0` release is being prepared; it has not been published. Once available:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @joystyk/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Node consumers require Node 24.15 or later. Browser entry points require a modern
|
|
14
|
+
browser and should be loaded in the browser. Tested with Gyral 0.3.1.
|
|
15
|
+
|
|
16
|
+
| Import | Format |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `@joystyk/ui` | ES module and TypeScript declarations |
|
|
19
|
+
| `@joystyk/ui/button` | ES module and TypeScript declarations |
|
|
20
|
+
| `@joystyk/ui/ad-slot` | ES module and TypeScript declarations |
|
|
21
|
+
| `@joystyk/ui/ad-wire` | ES module and TypeScript declarations |
|
|
22
|
+
| `@joystyk/ui/slots` | ES module and TypeScript declarations |
|
|
23
|
+
| `@joystyk/ui/tokens.css` | CSS asset |
|
|
24
|
+
|
|
25
|
+
Only the entries listed above are public API. Installed packages contain compiled ESM,
|
|
26
|
+
type declarations and runtime assets. Repository-relative links describe the Joystyk
|
|
27
|
+
workspace and are not needed to use the npm package.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import '@joystyk/ui/button';
|
|
31
|
+
import '@joystyk/ui/tokens.css';
|
|
32
|
+
|
|
33
|
+
// In a Gyral view: <jy-button toggle>Sound</jy-button>
|
|
34
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type Command, type PropsOf } from '@gyral/core';
|
|
2
|
+
import { type AdFill, type AdQuery, type CreativeFill, type HouseFill } from './ad-wire.js';
|
|
3
|
+
import { type SlotId, type SlotSurface } from './slots.js';
|
|
4
|
+
/** Whether the visitor sees ads. 'hide' arrives with ad-free entitlements in v2. */
|
|
5
|
+
export type AdEntitlement = 'show' | 'hide';
|
|
6
|
+
/** Where `<ad-slot>` learns whether to show ads. */
|
|
7
|
+
export interface AdEntitlementSource {
|
|
8
|
+
get(): AdEntitlement;
|
|
9
|
+
/** Calls `listener` on every change; returns how to stop. */
|
|
10
|
+
subscribe(listener: (entitlement: AdEntitlement) => void): () => void;
|
|
11
|
+
}
|
|
12
|
+
/** The v1 source: every visitor sees ads, so it never changes. */
|
|
13
|
+
export declare const alwaysShowAds: AdEntitlementSource;
|
|
14
|
+
/** The default entitlement driver: `alwaysShowAds`. */
|
|
15
|
+
export declare const adEntitlement: import("@gyral/core").Driver<undefined, AdEntitlement, unknown>;
|
|
16
|
+
/** Gives every `<ad-slot>` below `element` its entitlement from `source`. */
|
|
17
|
+
export declare const provideAdEntitlement: (element: Element, source: AdEntitlementSource) => (() => void);
|
|
18
|
+
/** `navigator.onLine` now and on every `online` / `offline` event. */
|
|
19
|
+
export declare const connectivity: import("@gyral/core").Driver<undefined, boolean, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Asks the ad endpoint for a slot's fill and parses the answer at the boundary. No cookies go
|
|
22
|
+
* with it. Fails on a network error, a non-2xx status or an answer that doesn't parse.
|
|
23
|
+
*/
|
|
24
|
+
export declare const adServer: import("@gyral/core").Driver<string, {
|
|
25
|
+
kind: "creative";
|
|
26
|
+
id: number;
|
|
27
|
+
image: {
|
|
28
|
+
src: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
alt: string;
|
|
33
|
+
headline: string;
|
|
34
|
+
href: string;
|
|
35
|
+
beacon: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "house";
|
|
38
|
+
headline: string;
|
|
39
|
+
text: string;
|
|
40
|
+
cta: string;
|
|
41
|
+
href: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "collapse";
|
|
44
|
+
}, string>;
|
|
45
|
+
/** Sends an impression beacon: a bodiless POST that outlives the page, without cookies. */
|
|
46
|
+
export declare const adBeacon: import("@gyral/core").Driver<string, void, string>;
|
|
47
|
+
/** Where the slot's fill stands. */
|
|
48
|
+
export type AdLoad =
|
|
49
|
+
/** Not near the viewport yet: nothing asked. */
|
|
50
|
+
{
|
|
51
|
+
readonly _tag: 'Waiting';
|
|
52
|
+
} | {
|
|
53
|
+
readonly _tag: 'Loading';
|
|
54
|
+
readonly url: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: 'Filled';
|
|
57
|
+
readonly url: string;
|
|
58
|
+
readonly fill: CreativeFill | HouseFill;
|
|
59
|
+
readonly seen: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Nothing to show, or something failed: the slot collapses. */
|
|
62
|
+
| {
|
|
63
|
+
readonly _tag: 'Empty';
|
|
64
|
+
readonly url: string;
|
|
65
|
+
};
|
|
66
|
+
export interface AdSlotState {
|
|
67
|
+
readonly entitlement: AdEntitlement;
|
|
68
|
+
/** What the connectivity driver last said; null until it first reports (assumed online). */
|
|
69
|
+
readonly online: boolean | null;
|
|
70
|
+
/** The box has come near the viewport once. */
|
|
71
|
+
readonly near: boolean;
|
|
72
|
+
readonly ad: AdLoad;
|
|
73
|
+
}
|
|
74
|
+
export type AdSlotMsg = {
|
|
75
|
+
readonly _tag: 'Entitled';
|
|
76
|
+
readonly entitlement: AdEntitlement;
|
|
77
|
+
} | {
|
|
78
|
+
readonly _tag: 'Connectivity';
|
|
79
|
+
readonly online: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** The box came within a screen's reach of the viewport. */
|
|
82
|
+
| {
|
|
83
|
+
readonly _tag: 'Near';
|
|
84
|
+
} | {
|
|
85
|
+
readonly _tag: 'Loaded';
|
|
86
|
+
readonly url: string;
|
|
87
|
+
readonly fill: AdFill;
|
|
88
|
+
} | {
|
|
89
|
+
readonly _tag: 'LoadFailed';
|
|
90
|
+
readonly url: string;
|
|
91
|
+
}
|
|
92
|
+
/** The creative's image loaded and is at least half on screen, or it failed to load. */
|
|
93
|
+
| {
|
|
94
|
+
readonly _tag: 'Image';
|
|
95
|
+
readonly status: 'seen' | 'broken';
|
|
96
|
+
};
|
|
97
|
+
/** What the slot shows: its reserved box (empty or filled), or nothing at all. Pure. */
|
|
98
|
+
export declare const slotPresentation: (s: AdSlotState) => "reserved" | "collapsed";
|
|
99
|
+
declare const props: {
|
|
100
|
+
/** The registry id (attribute `slot-id`; `slot` is taken by the platform). */
|
|
101
|
+
slotId: import("@gyral/core").Prop<SlotId>;
|
|
102
|
+
/** The kind of page the slot is on (attribute `page`). Default: the slot's first surface. */
|
|
103
|
+
page: import("@gyral/core").Prop<SlotSurface | undefined>;
|
|
104
|
+
/** The game the page or screen is about (attribute `game-id`). */
|
|
105
|
+
gameId: import("@gyral/core").Prop<string | undefined>;
|
|
106
|
+
/** The category the page is about (attribute `category`). */
|
|
107
|
+
category: import("@gyral/core").Prop<string | undefined>;
|
|
108
|
+
};
|
|
109
|
+
export type AdSlotProps = PropsOf<typeof props>;
|
|
110
|
+
/** The context the slot sends: what the page is about, never who is looking. */
|
|
111
|
+
export declare const queryOf: (p: AdSlotProps) => AdQuery;
|
|
112
|
+
/** Asks the endpoint for `url`'s fill; the latest request wins. */
|
|
113
|
+
export declare const requestFill: (url: string) => Command<AdSlotMsg>;
|
|
114
|
+
export declare const AdSlot: import("@gyral/core").GyralElementClass<AdSlotState, AdSlotMsg, PropsOf<{
|
|
115
|
+
/** The registry id (attribute `slot-id`; `slot` is taken by the platform). */
|
|
116
|
+
slotId: import("@gyral/core").Prop<SlotId>;
|
|
117
|
+
/** The kind of page the slot is on (attribute `page`). Default: the slot's first surface. */
|
|
118
|
+
page: import("@gyral/core").Prop<SlotSurface | undefined>;
|
|
119
|
+
/** The game the page or screen is about (attribute `game-id`). */
|
|
120
|
+
gameId: import("@gyral/core").Prop<string | undefined>;
|
|
121
|
+
/** The category the page is about (attribute `category`). */
|
|
122
|
+
category: import("@gyral/core").Prop<string | undefined>;
|
|
123
|
+
}>, never, "Near" | "Image">;
|
|
124
|
+
declare global {
|
|
125
|
+
interface HTMLElementTagNameMap {
|
|
126
|
+
'ad-slot': InstanceType<typeof AdSlot>;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export {};
|