@jskit-ai/http-web 0.2.50 → 0.2.51
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/package.json
CHANGED
|
@@ -50,8 +50,12 @@ questionnaire.
|
|
|
50
50
|
- View fields are two-line list items with the value first:
|
|
51
51
|
`<v-list-item :title="record.author" subtitle="Author" />`.
|
|
52
52
|
- Transport and validators come from the shared CRUD contract.
|
|
53
|
-
- Initial visible loading uses structure-matching skeletons;
|
|
54
|
-
|
|
53
|
+
- Initial visible loading uses structure-matching skeletons; a running command's
|
|
54
|
+
button is marked pending (`pending` on `ShellPageAction`, `v-pending` on
|
|
55
|
+
other buttons) with a stable pending label such as "Saving…", never a
|
|
56
|
+
spinner. A selection field's `loading` (below) is its own thin progress line,
|
|
57
|
+
not a spinner
|
|
58
|
+
([Components, state, and feedback](https://mobily-enterprises.github.io/jskit-ai/guide/framework/material-3#components-state-and-feedback)).
|
|
55
59
|
- Resource-load errors stay inside the screen with retry. Command success and
|
|
56
60
|
failure use JSKIT's shared toast/snackbar feedback path.
|
|
57
61
|
- URLs are route templates or route objects resolved through the screen runtime.
|
|
@@ -154,7 +158,9 @@ so a narrowing search does not blank a chosen value. Display never changes the
|
|
|
154
158
|
stored value. `searchable` renders an autocomplete; other props and slots pass
|
|
155
159
|
through to Vuetify. The lint rule `jskit/selection-field` reports a raw
|
|
156
160
|
selection whose items are not fixed, and a `SelectField` over loaded items
|
|
157
|
-
without `loading`.
|
|
161
|
+
without `loading`. Vuetify draws that `loading` as the field's own 2px
|
|
162
|
+
progress line along its underline: Material 3's built-in loading state, kept
|
|
163
|
+
by the no-spinner rule, never counted as a spinner.
|
|
158
164
|
|
|
159
165
|
```vue
|
|
160
166
|
<CrudAddEditScreen :screen="screen" v-bind="lookups">
|
|
@@ -210,7 +216,8 @@ relation's `labelKey`, and what `fields.serviceId.output.includeFields` names.
|
|
|
210
216
|
|
|
211
217
|
- route-local `fetch()` or duplicated request serializers
|
|
212
218
|
- copying shared screen chrome into every route
|
|
213
|
-
- spinner or circular-progress loading states
|
|
219
|
+
- spinner or circular-progress loading states (a field's or table's own
|
|
220
|
+
`loading` line is not one)
|
|
214
221
|
- transient in-page command-error banners that push the layout
|
|
215
222
|
- generator-branded CSS classes, cache keys, or placement ids
|
|
216
223
|
- comments or metadata reserving fields for a future authoring command
|
|
@@ -9,6 +9,7 @@ import { compileScript, parse } from "@vue/compiler-sfc";
|
|
|
9
9
|
import { createSSRApp, defineComponent, h } from "vue";
|
|
10
10
|
import { renderToString } from "vue/server-renderer";
|
|
11
11
|
import { createMemoryHistory, createRouter } from "vue-router";
|
|
12
|
+
import { findSpinnerMarkup } from "./support/spinnerMarkup.js";
|
|
12
13
|
|
|
13
14
|
const TEST_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
14
15
|
const PACKAGE_DIR = path.resolve(TEST_DIRECTORY, "..");
|
|
@@ -204,7 +205,10 @@ test("CRUD screen components own list/view/form chrome centrally", async () => {
|
|
|
204
205
|
bulkActionSource,
|
|
205
206
|
rowActionSource
|
|
206
207
|
].join("\n");
|
|
207
|
-
|
|
208
|
+
// No spinner, and no page-level progress bar: content loads under skeletons. A field's or table's own `loading`
|
|
209
|
+
// line is the built-in state the Material 3 rules keep, so `loading` props are not counted.
|
|
210
|
+
assert.deepEqual(findSpinnerMarkup(sharedSources), []);
|
|
211
|
+
assert.doesNotMatch(sharedSources, /v-progress-linear/u);
|
|
208
212
|
assert.doesNotMatch(sharedSources, /ui-generator|generated-ui/u);
|
|
209
213
|
assert.doesNotMatch(sharedSources, /@mdi\/js|mdi-|!important/u);
|
|
210
214
|
assert.match(listSource, /v-skeleton-loader/u);
|
|
@@ -16,6 +16,7 @@ import { defineTableResource } from "@jskit-ai/resource-core/shared/tableResourc
|
|
|
16
16
|
import { defineCrudContract } from "@jskit-ai/resource-crud-core/shared/crudContract";
|
|
17
17
|
import { useCrudAddEditScreen } from "../src/client/composables/useCrudAddEditScreen.js";
|
|
18
18
|
import { useCrudListScreen } from "../src/client/composables/useCrudListScreen.js";
|
|
19
|
+
import { findSpinnerMarkup } from "./support/spinnerMarkup.js";
|
|
19
20
|
|
|
20
21
|
const execFileAsync = promisify(execFile);
|
|
21
22
|
const patternRoot = path.resolve(
|
|
@@ -128,7 +129,9 @@ test("CRUD screen pattern is thin app-owned source over shared public screens",
|
|
|
128
129
|
assert.match(combinedSource, /useCrudAddEditScreen/u);
|
|
129
130
|
assert.match(combinedSource, /useCrudDeleteAction/u);
|
|
130
131
|
assert.doesNotMatch(combinedSource, /ui-generator|generated-ui|jskit:crud-ui|__JSKIT_/u);
|
|
131
|
-
|
|
132
|
+
// A lookup's `SelectField` `loading`, which the pattern's guide asks for, is the field's own progress line, not a spinner.
|
|
133
|
+
assert.deepEqual(findSpinnerMarkup(combinedSource), []);
|
|
134
|
+
assert.doesNotMatch(combinedSource, /v-progress-linear/u);
|
|
132
135
|
|
|
133
136
|
for (const file of files) {
|
|
134
137
|
const absolutePath = path.join(exampleRoot, file);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { findSpinnerMarkup } from "./support/spinnerMarkup.js";
|
|
4
|
+
|
|
5
|
+
test("a control's own loading line is not a spinner", () => {
|
|
6
|
+
const source = `
|
|
7
|
+
<SelectField v-model="form.serviceId" :items="services.items" :loading="services.loading" />
|
|
8
|
+
<v-autocomplete v-model="form.roomId" :items="rooms" :loading="roomsLoading" />
|
|
9
|
+
<v-combobox v-model="form.tags" :items="tags" loading />
|
|
10
|
+
<v-data-table :items="rows" :loading="isLoading" />
|
|
11
|
+
<v-btn v-pending="saving">{{ saving ? "Saving…" : "Save" }}</v-btn>
|
|
12
|
+
<BookSaveBar :loading="saving" />
|
|
13
|
+
`;
|
|
14
|
+
assert.deepEqual(findSpinnerMarkup(source), []);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("a circular indicator and a button's loading are spinners", () => {
|
|
18
|
+
const source = `
|
|
19
|
+
<v-progress-circular indeterminate />
|
|
20
|
+
<VProgressCircular />
|
|
21
|
+
<v-btn color="primary" :loading="saving">Save</v-btn>
|
|
22
|
+
<v-btn
|
|
23
|
+
@click="() => save(count > 0)"
|
|
24
|
+
loading
|
|
25
|
+
>Save</v-btn>
|
|
26
|
+
<ShellPageAction icon="$save" :loading="saving" />
|
|
27
|
+
`;
|
|
28
|
+
assert.deepEqual(findSpinnerMarkup(source), [
|
|
29
|
+
"<v-progress-circular",
|
|
30
|
+
"<VProgressCircular",
|
|
31
|
+
"<v-btn loading>",
|
|
32
|
+
"<v-btn loading>",
|
|
33
|
+
"<ShellPageAction loading>"
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The spinners a Vue template renders, for the source-contract tests that keep them out of shared screens.
|
|
2
|
+
// A `loading` prop is no spinner by itself: on a field (`SelectField`, `v-select`, `v-autocomplete`, `v-combobox`,
|
|
3
|
+
// `v-text-field`) or a `v-data-table`, Vuetify draws the control's own 2px progress line, the built-in loading state
|
|
4
|
+
// the Material 3 rules keep. A circular indicator is `v-progress-circular`, or `loading` on a button: `v-btn` and the
|
|
5
|
+
// components that hand `loading` to one (`v-fab`, `ShellPageAction`, `ShellPrimaryAction`).
|
|
6
|
+
const CIRCULAR_INDICATOR = /<(?:v-progress-circular|VProgressCircular)\b/gu;
|
|
7
|
+
// A button's opening tag; quoted attribute values may hold ">" (`@click="() => save()"`).
|
|
8
|
+
const BUTTON_TAG = /<(v-btn|VBtn|v-fab|VFab|ShellPageAction|ShellPrimaryAction)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/gu;
|
|
9
|
+
const LOADING_ATTRIBUTE = /\s(?::|v-bind:)?loading(?=[\s=/]|$)/u;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} source Vue template source.
|
|
13
|
+
* @returns {string[]} each circular indicator it renders, as the tag that draws it.
|
|
14
|
+
*/
|
|
15
|
+
export function findSpinnerMarkup(source) {
|
|
16
|
+
const found = [...source.matchAll(CIRCULAR_INDICATOR)].map((match) => match[0]);
|
|
17
|
+
for (const match of source.matchAll(BUTTON_TAG)) {
|
|
18
|
+
if (LOADING_ATTRIBUTE.test(match[2])) found.push(`<${match[1]} loading>`);
|
|
19
|
+
}
|
|
20
|
+
return found;
|
|
21
|
+
}
|