@popcorn245/cornfield-components 0.50.0 → 0.51.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/README.md CHANGED
@@ -1,13 +1,17 @@
1
1
  # @popcorn245/cornfield-components
2
2
 
3
- [cornfield](https://github.com/popcorn245/CornField)'s interface as web components: `<corn-map>` today, more to follow. Built with StencilRS, as ES modules, with type declarations and a `tokens.css`.
3
+ [cornfield](https://github.com/popcorn245/CornField)'s interface as web components: `<corn-review>` (a proposal on the map, with Approve and Send back, in one tag), `<corn-map>` and `<corn-scope>` today, more to follow. Built with StencilRS, as ES modules, with type declarations and a `tokens.css`.
4
4
 
5
5
  ```sh
6
6
  npm install @popcorn245/cornfield-components
7
7
  ```
8
8
 
9
9
  ```js
10
- import '@popcorn245/cornfield-components/corn-map'; // registers <corn-map>; or '@popcorn245/cornfield-components' for all of them
10
+ import '@popcorn245/cornfield-components/corn-review'; // registers <corn-review>; or '@popcorn245/cornfield-components' for all of them
11
+ ```
12
+
13
+ ```html
14
+ <corn-review src="https://map.example.com" proposal="0042-retire-the-old-export"></corn-review>
11
15
  ```
12
16
 
13
17
  The package carries cornfield's own version number: `0.48.0` of the package is the build of cornfield `0.48.0`, the one its server serves at `/cornfield/components/`. A page that does not use a bundler can load the same files from the server with one `<script type="module">` line.
@@ -0,0 +1,122 @@
1
+ import { n as e, r as t, t as n } from "./runtime-DFu6W5g-.js";
2
+ import { t as r } from "./map-B6AeKeiu.js";
3
+ import { a as i, t as a } from "./engine-ClfnAsgM.js";
4
+ // \0stencil-css:/home/runner/work/CornField/CornField/explorer/pieces/map-stage?tag=corn-map&encapsulation=shadow&__ext=css
5
+ var o = () => "[data-corn=map-stage]{background:var(--corn-ground-image), var(--corn-ground);width:100%;height:100%;min-height:16rem;display:block;position:relative;overflow:hidden}[data-corn=map-canvas]{cursor:grab;touch-action:none;width:100%;height:100%;display:block;position:absolute;inset:0}[data-corn=map-canvas]:active{cursor:grabbing}[data-corn=map-canvas]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1)}[data-corn=label-canvas]{pointer-events:none;width:100%;height:100%;position:absolute;inset:0}[data-corn=map-overlay]{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.hx-sr-only{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;overflow:hidden;position:absolute!important}", s = () => "[data-corn=source-status]{z-index:2;box-sizing:border-box;align-items:center;gap:var(--corn-space-3);width:min(26rem, calc(100% - var(--corn-space-6) * 2));padding:var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-lg);background:var(--corn-surface-1);color:var(--corn-text-2);box-shadow:var(--corn-shadow);text-align:center;font-family:var(--corn-font);font-size:var(--corn-text-md);flex-direction:column;line-height:1.5;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[data-corn=source-status][hidden]{display:none}[data-corn=source-status]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-status][data-corn-state=running]{box-shadow:none;color:var(--corn-text-3);background:0 0;border-color:#0000;padding:0}[data-corn=source-status][data-corn-state=running] [data-corn=source-title]{font-size:var(--corn-text-md);color:var(--corn-text-3);font-weight:400}[data-corn=source-status][data-corn-state=failure] [data-corn=source-title]{color:var(--corn-bad)}[data-corn=source-status][data-corn-state=waiting] [data-corn=source-title]{color:var(--corn-accent-text)}[data-corn=source-title],[data-corn=source-text]{margin:0}[data-corn=source-title]{font-size:var(--corn-text-lg);color:var(--corn-text);font-weight:600}[data-corn=source-text]{overflow-wrap:anywhere;user-select:text}[data-corn=source-origin]{font-family:var(--corn-mono);color:var(--corn-warn);overflow-wrap:anywhere;user-select:all}[data-corn=source-sign-in],[data-corn=source-retry]{box-sizing:border-box;min-height:max(var(--corn-control-height), 2.75rem);padding:0 var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius);background:var(--corn-surface-2);color:var(--corn-text);font-family:inherit;font-size:inherit;cursor:pointer;justify-content:center;align-items:center;text-decoration:none;display:inline-flex}[data-corn=source-sign-in]{border-color:var(--corn-accent);background:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}[data-corn=source-sign-in]:hover{background:var(--corn-accent-hover)}[data-corn=source-retry]:hover{background:var(--corn-surface-3)}[data-corn=source-sign-in]:focus-visible,[data-corn=source-retry]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-notice]{z-index:2;box-sizing:border-box;padding:var(--corn-space-3) var(--corn-space-6);background:var(--corn-surface-1);border-top:var(--corn-border) solid var(--corn-line-soft);color:var(--corn-text-2);font-family:var(--corn-font);font-size:var(--corn-text-sm);text-align:center;overflow-wrap:anywhere;margin:0;position:absolute;bottom:0;left:0;right:0}[data-corn=source-notice][hidden]{display:none}", c = () => ":host{contain:layout;min-width:0;color:var(--corn-text);font-family:var(--corn-font);display:block;position:relative}:host([hidden]){display:none!important}", l = class extends n {
6
+ constructor(t) {
7
+ super(), t !== !1 && this.__registerHost(), this.__attachShadow(), this.cornSelect = e(this, "cornSelect", 7), this.cornReady = e(this, "cornReady", 7), this.cornAuth = e(this, "cornAuth", 7), this.cornError = e(this, "cornError", 7);
8
+ }
9
+ get el() {
10
+ return this;
11
+ }
12
+ topology;
13
+ node;
14
+ view = "map";
15
+ theme;
16
+ renderer = "auto";
17
+ src;
18
+ useTheme = !1;
19
+ cornSelect;
20
+ cornReady;
21
+ cornAuth;
22
+ cornError;
23
+ piece = null;
24
+ scope = null;
25
+ loaded = !1;
26
+ changes = {};
27
+ connectedCallback() {
28
+ this.loaded && this.mountPiece();
29
+ }
30
+ componentDidLoad() {
31
+ this.loaded = !0, this.mountPiece();
32
+ }
33
+ disconnectedCallback() {
34
+ this.unmountPiece();
35
+ }
36
+ unmountPiece() {
37
+ this.piece && this.piece.destroy(), this.piece = null, this.scope && this.scope.leave(), this.scope = null;
38
+ }
39
+ remount() {
40
+ this.unmountPiece(), this.loaded && this.el.isConnected && this.mountPiece();
41
+ }
42
+ mountPiece() {
43
+ !this.piece && this.el.shadowRoot && (this.changes = {}, this.scope = i(this.el, () => this.remount()), this.piece = r(this.el.shadowRoot, this.scope.inst, {
44
+ topology: this.topology,
45
+ view: this.view,
46
+ node: this.node,
47
+ theme: this.theme,
48
+ renderer: this.renderer,
49
+ tokens: a,
50
+ src: this.src,
51
+ useTheme: this.useTheme,
52
+ version: "0.51.0",
53
+ pageUrl: () => typeof location > "u" ? "" : location.href,
54
+ onAuth: (e) => this.cornAuth.emit(e),
55
+ onError: (e) => this.cornError.emit(e),
56
+ onSelect: (e) => {
57
+ this.node = e.kind === "node" ? e.id : null, delete this.changes.node, this.cornSelect.emit(e);
58
+ },
59
+ onReady: () => this.cornReady.emit()
60
+ }));
61
+ }
62
+ componentDidRender() {
63
+ let e = this.changes;
64
+ this.changes = {}, this.piece && Object.keys(e).length && this.piece.update(e);
65
+ }
66
+ changed(e, t, n) {
67
+ this.changes[n] = e;
68
+ }
69
+ addressChanged() {
70
+ this.piece && this.scope && !this.scope.inst && this.remount();
71
+ }
72
+ async fit() {
73
+ this.piece && this.piece.fit();
74
+ }
75
+ async focusNode(e) {
76
+ this.piece && this.piece.focusNode(e);
77
+ }
78
+ async refresh() {
79
+ this.piece && this.piece.refresh();
80
+ }
81
+ static get watchers() {
82
+ return {
83
+ topology: [{ changed: 0 }],
84
+ view: [{ changed: 0 }],
85
+ node: [{ changed: 0 }],
86
+ theme: [{ changed: 0 }],
87
+ renderer: [{ changed: 0 }],
88
+ src: [{ addressChanged: 0 }],
89
+ useTheme: [{ addressChanged: 0 }]
90
+ };
91
+ }
92
+ static get style() {
93
+ return o() + s() + c();
94
+ }
95
+ };
96
+ t(l, [
97
+ 513,
98
+ "corn-map",
99
+ {
100
+ topology: [16],
101
+ node: [1537],
102
+ view: [1],
103
+ theme: [513],
104
+ renderer: [1],
105
+ src: [1],
106
+ useTheme: [4, "use-theme"],
107
+ fit: [64],
108
+ focusNode: [64],
109
+ refresh: [64]
110
+ },
111
+ void 0,
112
+ {
113
+ topology: [{ changed: 0 }],
114
+ view: [{ changed: 0 }],
115
+ node: [{ changed: 0 }],
116
+ theme: [{ changed: 0 }],
117
+ renderer: [{ changed: 0 }],
118
+ src: [{ addressChanged: 0 }],
119
+ useTheme: [{ addressChanged: 0 }]
120
+ }
121
+ ]);
122
+ export { l as t };