uncial-cms 2.0.0 → 2.0.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 +21 -0
- package/dist/github/adapter.js +61 -2
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +4 -1
- package/dist/svelte/EditorPage.svelte +3 -2
- package/dist/svelte/styles.d.ts +4 -4
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David A. Flood
|
|
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/dist/github/adapter.js
CHANGED
|
@@ -75,17 +75,76 @@ class GitHubAdapter {
|
|
|
75
75
|
.filter((entry) => entry.type === 'file' || entry.type === 'dir')
|
|
76
76
|
.map((entry) => ({ path: entry.path, type: entry.type }));
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Both of GitHub's two answers to "how did this commit fare", because a repo
|
|
80
|
+
* may use either.
|
|
81
|
+
*
|
|
82
|
+
* ⚠ The combined Status API aggregates the *Status* API alone, and GitHub
|
|
83
|
+
* Actions writes **check runs**, not statuses. A repository built by Actions
|
|
84
|
+
* — which is every Pages site deployed from a workflow — therefore has
|
|
85
|
+
* `state: "pending"` and an empty `statuses` array on that endpoint for
|
|
86
|
+
* ever, and a poll that trusted it would sit at "building…" through a deploy
|
|
87
|
+
* that has already succeeded. So an empty `statuses` is read as *no signal*
|
|
88
|
+
* rather than as pending, and the check runs are asked as well.
|
|
89
|
+
*/
|
|
78
90
|
async commitStatus(commitSha) {
|
|
79
|
-
const
|
|
91
|
+
const sha = encodeURIComponent(commitSha);
|
|
92
|
+
const base = `${GITHUB_API_URL}/repos/${this.#config.repo}/commits/${sha}`;
|
|
93
|
+
const [fromStatuses, fromChecks] = await Promise.all([
|
|
94
|
+
this.#statusApiSignal(`${base}/status`),
|
|
95
|
+
this.#checkRunSignal(`${base}/check-runs`)
|
|
96
|
+
]);
|
|
97
|
+
const signals = [fromStatuses, fromChecks].filter((signal) => signal !== 'unknown');
|
|
98
|
+
if (signals.includes('failure'))
|
|
99
|
+
return 'failure';
|
|
100
|
+
if (signals.includes('pending'))
|
|
101
|
+
return 'pending';
|
|
102
|
+
return signals.includes('success') ? 'success' : 'unknown';
|
|
103
|
+
}
|
|
104
|
+
async #statusApiSignal(url) {
|
|
105
|
+
const response = await this.#request(url);
|
|
80
106
|
if (!response.ok)
|
|
81
107
|
return 'unknown';
|
|
82
|
-
const { state } = (await response.json());
|
|
108
|
+
const { state, statuses } = (await response.json());
|
|
109
|
+
if ((statuses ?? []).length === 0)
|
|
110
|
+
return 'unknown';
|
|
83
111
|
if (state === 'pending' || state === 'success')
|
|
84
112
|
return state;
|
|
85
113
|
if (state === 'failure' || state === 'error')
|
|
86
114
|
return 'failure';
|
|
87
115
|
return 'unknown';
|
|
88
116
|
}
|
|
117
|
+
async #checkRunSignal(url) {
|
|
118
|
+
const response = await this.#request(url);
|
|
119
|
+
if (!response.ok)
|
|
120
|
+
return 'unknown';
|
|
121
|
+
const { check_runs: runs } = (await response.json());
|
|
122
|
+
if (!runs || runs.length === 0)
|
|
123
|
+
return 'unknown';
|
|
124
|
+
let pending = false;
|
|
125
|
+
let success = false;
|
|
126
|
+
for (const run of runs) {
|
|
127
|
+
if (run.status !== 'completed') {
|
|
128
|
+
pending = true;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
switch (run.conclusion) {
|
|
132
|
+
case 'success':
|
|
133
|
+
case 'neutral':
|
|
134
|
+
case 'skipped':
|
|
135
|
+
success = true;
|
|
136
|
+
break;
|
|
137
|
+
// A run superseded by a later one says nothing about this commit.
|
|
138
|
+
case 'stale':
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
return 'failure';
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (pending)
|
|
145
|
+
return 'pending';
|
|
146
|
+
return success ? 'success' : 'unknown';
|
|
147
|
+
}
|
|
89
148
|
#contentsUrl(path) {
|
|
90
149
|
return `${GITHUB_API_URL}/repos/${this.#config.repo}/contents/${encodeRepoPath(path)}`;
|
|
91
150
|
}
|
package/dist/mount.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'uncial/web-components';
|
|
2
|
-
import 'uncial/styles/chrome';
|
|
2
|
+
import 'uncial/styles/chrome.css';
|
|
3
3
|
import type { UncialEditorElement } from 'uncial/web-components';
|
|
4
4
|
import type { SessionProvider, UncialCmsSiteConfig } from './types.js';
|
|
5
5
|
export interface MountEditorPageOptions {
|
package/dist/mount.js
CHANGED
|
@@ -2,7 +2,10 @@ import 'uncial/web-components';
|
|
|
2
2
|
// The editor's own chrome: tokens, shell layout and controls. The host page's
|
|
3
3
|
// stylesheets are mirrored in below for prose parity, but they style the
|
|
4
4
|
// document, not the toolbar and panels around it — nothing else loads these.
|
|
5
|
-
|
|
5
|
+
// The extension matters: Vite's dep optimizer only hands a stylesheet to its
|
|
6
|
+
// CSS pipeline when the specifier itself ends in .css; a bare subpath gets
|
|
7
|
+
// bundled by esbuild into a sidecar file the host never loads.
|
|
8
|
+
import 'uncial/styles/chrome.css';
|
|
6
9
|
import {} from './editor-controller.js';
|
|
7
10
|
import { createEditorSession, defaultSessionProvider } from './editor-session.js';
|
|
8
11
|
import { UNCIAL_CMS_RUNTIME_SENTINEL } from './sentinel.js';
|
|
@@ -87,8 +87,9 @@
|
|
|
87
87
|
// subpath: this file is inside the package.
|
|
88
88
|
import('../editor-session.js'),
|
|
89
89
|
// The editor's chrome — tokens, shell layout and controls. Loaded here
|
|
90
|
-
// so the host never has to know the component has a stylesheet.
|
|
91
|
-
|
|
90
|
+
// so the host never has to know the component has a stylesheet. The
|
|
91
|
+
// .css extension keeps Vite's dep optimizer from swallowing it.
|
|
92
|
+
import('uncial/styles/chrome.css')
|
|
92
93
|
]).then(([editor, session]) => {
|
|
93
94
|
if (cancelled) return;
|
|
94
95
|
Editor = editor.Editor;
|
package/dist/svelte/styles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `uncial/styles/chrome` is a stylesheet, imported for its effect. Vite
|
|
2
|
-
// it; TypeScript needs telling it exists. Ships with the package so a
|
|
3
|
-
// type-checking this component resolves it too.
|
|
4
|
-
declare module 'uncial/styles/chrome';
|
|
1
|
+
// `uncial/styles/chrome.css` is a stylesheet, imported for its effect. Vite
|
|
2
|
+
// resolves it; TypeScript needs telling it exists. Ships with the package so a
|
|
3
|
+
// consumer type-checking this component resolves it too.
|
|
4
|
+
declare module 'uncial/styles/chrome.css';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uncial-cms",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@sveltejs/kit": "^2.0.0",
|
|
66
66
|
"svelte": "^5.0.0",
|
|
67
|
-
"uncial": "^2.0.
|
|
67
|
+
"uncial": "^2.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"@sveltejs/kit": {
|