@fusion.dev/helix-core 0.110.5 → 0.111.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/custom-elements.json
CHANGED
|
@@ -1978,6 +1978,108 @@
|
|
|
1978
1978
|
}
|
|
1979
1979
|
]
|
|
1980
1980
|
},
|
|
1981
|
+
{
|
|
1982
|
+
"kind": "javascript-module",
|
|
1983
|
+
"path": "src/controllers/placement-controller/placement-controller.ts",
|
|
1984
|
+
"declarations": [
|
|
1985
|
+
{
|
|
1986
|
+
"kind": "class",
|
|
1987
|
+
"description": "Custom properties another element sets on this one, kept in its own shadow\nroot.\n\n**Nothing is written onto the page's element.** A marker a connector stands\non the map, or a card a board places, is the page's markup, and its `style`\nattribute is the page's too. Written there, a placement was markup the\nserver never sent, which a framework's hydration reports; and a page that\nset `style` on the element, a card's color, wiped the placement every time\nit rendered. Here the values are a\n`:host` rule in a sheet this element adopts, which inherit to everything the\nelement draws exactly as an inline style's did, and which no framework\nsees.\n\n**Rewritten only when a value changes**, since a map moving writes every\nmarker's place on every frame and most frames move some not at all.",
|
|
1988
|
+
"name": "PlacementController",
|
|
1989
|
+
"members": [
|
|
1990
|
+
{
|
|
1991
|
+
"kind": "field",
|
|
1992
|
+
"name": "values",
|
|
1993
|
+
"privacy": "private",
|
|
1994
|
+
"readonly": true,
|
|
1995
|
+
"default": "new Map<string, string>()"
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
"kind": "field",
|
|
1999
|
+
"name": "sheet",
|
|
2000
|
+
"type": {
|
|
2001
|
+
"text": "CSSStyleSheet | undefined"
|
|
2002
|
+
},
|
|
2003
|
+
"privacy": "private"
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"kind": "field",
|
|
2007
|
+
"name": "written",
|
|
2008
|
+
"type": {
|
|
2009
|
+
"text": "string | undefined"
|
|
2010
|
+
},
|
|
2011
|
+
"privacy": "private"
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
"kind": "method",
|
|
2015
|
+
"name": "set",
|
|
2016
|
+
"return": {
|
|
2017
|
+
"type": {
|
|
2018
|
+
"text": "void"
|
|
2019
|
+
}
|
|
2020
|
+
},
|
|
2021
|
+
"parameters": [
|
|
2022
|
+
{
|
|
2023
|
+
"name": "properties",
|
|
2024
|
+
"type": {
|
|
2025
|
+
"text": "Readonly<Record<string, string | undefined>>"
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
],
|
|
2029
|
+
"description": "Sets each property given, and takes away each one given as `undefined`."
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
"kind": "method",
|
|
2033
|
+
"name": "get",
|
|
2034
|
+
"return": {
|
|
2035
|
+
"type": {
|
|
2036
|
+
"text": "string | undefined"
|
|
2037
|
+
}
|
|
2038
|
+
},
|
|
2039
|
+
"parameters": [
|
|
2040
|
+
{
|
|
2041
|
+
"name": "name",
|
|
2042
|
+
"type": {
|
|
2043
|
+
"text": "string"
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
],
|
|
2047
|
+
"description": "What a property is set to here, or `undefined` where it is not."
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
"kind": "method",
|
|
2051
|
+
"name": "hostConnected",
|
|
2052
|
+
"return": {
|
|
2053
|
+
"type": {
|
|
2054
|
+
"text": "void"
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
},
|
|
2058
|
+
{
|
|
2059
|
+
"kind": "method",
|
|
2060
|
+
"name": "write",
|
|
2061
|
+
"privacy": "private",
|
|
2062
|
+
"return": {
|
|
2063
|
+
"type": {
|
|
2064
|
+
"text": "void"
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
],
|
|
2069
|
+
"helix": {}
|
|
2070
|
+
}
|
|
2071
|
+
],
|
|
2072
|
+
"exports": [
|
|
2073
|
+
{
|
|
2074
|
+
"kind": "js",
|
|
2075
|
+
"name": "PlacementController",
|
|
2076
|
+
"declaration": {
|
|
2077
|
+
"name": "PlacementController",
|
|
2078
|
+
"module": "src/controllers/placement-controller/placement-controller.ts"
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
]
|
|
2082
|
+
},
|
|
1981
2083
|
{
|
|
1982
2084
|
"kind": "javascript-module",
|
|
1983
2085
|
"path": "src/controllers/popover-controller/popover-controller.ts",
|
|
@@ -6040,6 +6142,14 @@
|
|
|
6040
6142
|
"module": "./controllers/paint-gate-controller/paint-gate-controller.js"
|
|
6041
6143
|
}
|
|
6042
6144
|
},
|
|
6145
|
+
{
|
|
6146
|
+
"kind": "js",
|
|
6147
|
+
"name": "PlacementController",
|
|
6148
|
+
"declaration": {
|
|
6149
|
+
"name": "PlacementController",
|
|
6150
|
+
"module": "./controllers/placement-controller/placement-controller.js"
|
|
6151
|
+
}
|
|
6152
|
+
},
|
|
6043
6153
|
{
|
|
6044
6154
|
"kind": "js",
|
|
6045
6155
|
"name": "PopoverController",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/** A host this can adopt a sheet into: one with a shadow root it renders. */
|
|
3
|
+
type Placed = ReactiveControllerHost & HTMLElement & {
|
|
4
|
+
readonly renderRoot?: Element | DocumentFragment;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Custom properties another element sets on this one, kept in its own shadow
|
|
8
|
+
* root.
|
|
9
|
+
*
|
|
10
|
+
* **Nothing is written onto the page's element.** A marker a connector stands
|
|
11
|
+
* on the map, or a card a board places, is the page's markup, and its `style`
|
|
12
|
+
* attribute is the page's too. Written there, a placement was markup the
|
|
13
|
+
* server never sent, which a framework's hydration reports; and a page that
|
|
14
|
+
* set `style` on the element, a card's color, wiped the placement every time
|
|
15
|
+
* it rendered. Here the values are a
|
|
16
|
+
* `:host` rule in a sheet this element adopts, which inherit to everything the
|
|
17
|
+
* element draws exactly as an inline style's did, and which no framework
|
|
18
|
+
* sees.
|
|
19
|
+
*
|
|
20
|
+
* **Rewritten only when a value changes**, since a map moving writes every
|
|
21
|
+
* marker's place on every frame and most frames move some not at all.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PlacementController implements ReactiveController {
|
|
24
|
+
private readonly host;
|
|
25
|
+
private readonly values;
|
|
26
|
+
private sheet;
|
|
27
|
+
private written;
|
|
28
|
+
constructor(host: Placed);
|
|
29
|
+
/** Sets each property given, and takes away each one given as `undefined`. */
|
|
30
|
+
set(properties: Readonly<Record<string, string | undefined>>): void;
|
|
31
|
+
/** What a property is set to here, or `undefined` where it is not. */
|
|
32
|
+
get(name: string): string | undefined;
|
|
33
|
+
hostConnected(): void;
|
|
34
|
+
private write;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export class PlacementController {
|
|
2
|
+
constructor(host) {
|
|
3
|
+
this.host = host;
|
|
4
|
+
this.values = new Map();
|
|
5
|
+
host.addController(this);
|
|
6
|
+
}
|
|
7
|
+
set(properties) {
|
|
8
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
this.values.delete(name);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.values.set(name, value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
this.write();
|
|
17
|
+
}
|
|
18
|
+
get(name) {
|
|
19
|
+
return this.values.get(name);
|
|
20
|
+
}
|
|
21
|
+
hostConnected() {
|
|
22
|
+
this.write();
|
|
23
|
+
}
|
|
24
|
+
write() {
|
|
25
|
+
const root = this.host.renderRoot;
|
|
26
|
+
if (!(typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (typeof CSSStyleSheet === 'undefined' || !('replaceSync' in CSSStyleSheet.prototype)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const text = `:host{${[...this.values].map(([name, value]) => `${name}:${value}`).join(';')}}`;
|
|
33
|
+
if (!this.sheet) {
|
|
34
|
+
this.sheet = new CSSStyleSheet();
|
|
35
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, this.sheet];
|
|
36
|
+
}
|
|
37
|
+
else if (!root.adoptedStyleSheets.includes(this.sheet)) {
|
|
38
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, this.sheet];
|
|
39
|
+
}
|
|
40
|
+
if (text !== this.written) {
|
|
41
|
+
this.sheet.replaceSync(text);
|
|
42
|
+
this.written = text;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { IndicatorController, type IndicatorOptions, } from './controllers/indic
|
|
|
14
14
|
export { KeyboardNavigationController, type KeyboardNavigationOptions, type NavigableItem, } from './controllers/keyboard-navigation-controller/keyboard-navigation-controller.js';
|
|
15
15
|
export { MediaSessionController, type SessionHandlers, SKIP_SECONDS, } from './controllers/media-session-controller/media-session-controller.js';
|
|
16
16
|
export { MAX_FRAME_STEP, PaintGateController, type PaintGateOptions, } from './controllers/paint-gate-controller/paint-gate-controller.js';
|
|
17
|
+
export { PlacementController } from './controllers/placement-controller/placement-controller.js';
|
|
17
18
|
export { PopoverController, type PopoverOptions, } from './controllers/popover-controller/popover-controller.js';
|
|
18
19
|
export { RemotePlaybackController, type RemoteReport, } from './controllers/remote-playback-controller/remote-playback-controller.js';
|
|
19
20
|
export { SourceController, type SourceHost, } from './controllers/source-controller/source-controller.js';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { IndicatorController, } from './controllers/indicator-controller/indicat
|
|
|
14
14
|
export { KeyboardNavigationController, } from './controllers/keyboard-navigation-controller/keyboard-navigation-controller.js';
|
|
15
15
|
export { MediaSessionController, SKIP_SECONDS, } from './controllers/media-session-controller/media-session-controller.js';
|
|
16
16
|
export { MAX_FRAME_STEP, PaintGateController, } from './controllers/paint-gate-controller/paint-gate-controller.js';
|
|
17
|
+
export { PlacementController } from './controllers/placement-controller/placement-controller.js';
|
|
17
18
|
export { PopoverController, } from './controllers/popover-controller/popover-controller.js';
|
|
18
19
|
export { RemotePlaybackController, } from './controllers/remote-playback-controller/remote-playback-controller.js';
|
|
19
20
|
export { SourceController, } from './controllers/source-controller/source-controller.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-core",
|
|
3
3
|
"description": "Helix element primitives: base classes, mixins, decorators, utilities.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.111.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/dom": "^1.8.0",
|
|
37
|
-
"@fusion.dev/helix-icons": "0.
|
|
37
|
+
"@fusion.dev/helix-icons": "0.111.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@fusion.dev/helix-cem": "0.
|
|
41
|
-
"@fusion.dev/helix-testing": "0.
|
|
40
|
+
"@fusion.dev/helix-cem": "0.111.0",
|
|
41
|
+
"@fusion.dev/helix-testing": "0.111.0",
|
|
42
42
|
"@lit-labs/ssr": "^4.1.0",
|
|
43
43
|
"lit": "^3.2.1"
|
|
44
44
|
},
|