dotquilt 0.0.0-stage → 0.1.1
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/README.md +64 -2
- package/dist/animations.d.ts +105 -0
- package/dist/animations.js +107 -0
- package/dist/catalog-styles.d.ts +4 -0
- package/dist/catalog-styles.js +12 -0
- package/dist/chart-animations.d.ts +36 -0
- package/dist/chart-animations.js +25 -0
- package/dist/chart-styles.d.ts +3 -0
- package/dist/chart-styles.js +23 -0
- package/dist/chart.css +4 -0
- package/dist/chart.d.ts +73 -0
- package/dist/chart.js +80 -0
- package/dist/circle.css +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +9 -0
- package/dist/internal/binding.d.ts +13 -0
- package/dist/internal/binding.js +21 -0
- package/dist/internal/capture.d.ts +4 -0
- package/dist/internal/capture.js +13 -0
- package/dist/internal/chart-appearance.d.ts +12 -0
- package/dist/internal/chart-appearance.js +2 -0
- package/dist/internal/chart-definitions.d.ts +19 -0
- package/dist/internal/chart-definitions.js +149 -0
- package/dist/internal/chart-factory.d.ts +12 -0
- package/dist/internal/chart-factory.js +31 -0
- package/dist/internal/chart-field.d.ts +22 -0
- package/dist/internal/chart-field.js +74 -0
- package/dist/internal/chart-idle.d.ts +3 -0
- package/dist/internal/chart-idle.js +96 -0
- package/dist/internal/chart-math.d.ts +8 -0
- package/dist/internal/chart-math.js +19 -0
- package/dist/internal/chart-participant.d.ts +8 -0
- package/dist/internal/chart-participant.js +4 -0
- package/dist/internal/chart-projection.d.ts +11 -0
- package/dist/internal/chart-projection.js +69 -0
- package/dist/internal/content-box.d.ts +11 -0
- package/dist/internal/content-box.js +36 -0
- package/dist/internal/coordinated-handoff.d.ts +4 -0
- package/dist/internal/coordinated-handoff.js +158 -0
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +20 -0
- package/dist/internal/defaults.d.ts +11 -0
- package/dist/internal/defaults.js +11 -0
- package/dist/internal/dense/managed-painter.d.ts +4 -0
- package/dist/internal/dense/managed-painter.js +361 -0
- package/dist/internal/dense/runner.d.ts +2 -0
- package/dist/internal/dense/runner.js +5 -0
- package/dist/internal/dense-loader.d.ts +83 -0
- package/dist/internal/dense-loader.js +331 -0
- package/dist/internal/dissolve.d.ts +27 -0
- package/dist/internal/dissolve.js +216 -0
- package/dist/internal/dom.d.ts +23 -0
- package/dist/internal/dom.js +104 -0
- package/dist/internal/effect.d.ts +2 -0
- package/dist/internal/effect.js +17 -0
- package/dist/internal/element.d.ts +89 -0
- package/dist/internal/element.js +384 -0
- package/dist/internal/event-element.d.ts +8 -0
- package/dist/internal/event-element.js +20 -0
- package/dist/internal/frames.d.ts +1 -0
- package/dist/internal/frames.js +51 -0
- package/dist/internal/handoff.d.ts +56 -0
- package/dist/internal/handoff.js +102 -0
- package/dist/internal/ledger.d.ts +13 -0
- package/dist/internal/ledger.js +78 -0
- package/dist/internal/loading-controller.d.ts +62 -0
- package/dist/internal/loading-controller.js +698 -0
- package/dist/internal/marks.d.ts +153 -0
- package/dist/internal/marks.js +227 -0
- package/dist/internal/math.d.ts +2 -0
- package/dist/internal/math.js +2 -0
- package/dist/internal/morph-marks.d.ts +62 -0
- package/dist/internal/morph-marks.js +205 -0
- package/dist/internal/morph.d.ts +35 -0
- package/dist/internal/morph.js +488 -0
- package/dist/internal/paint.d.ts +29 -0
- package/dist/internal/paint.js +1 -0
- package/dist/internal/painter.d.ts +20 -0
- package/dist/internal/painter.js +155 -0
- package/dist/internal/preset-data.d.ts +12 -0
- package/dist/internal/preset-data.js +31 -0
- package/dist/internal/preset.d.ts +22 -0
- package/dist/internal/preset.js +86 -0
- package/dist/internal/pulse.d.ts +7 -0
- package/dist/internal/pulse.js +74 -0
- package/dist/internal/reveal-effect.d.ts +7 -0
- package/dist/internal/reveal-effect.js +24 -0
- package/dist/internal/reveal.d.ts +5 -0
- package/dist/internal/reveal.js +11 -0
- package/dist/internal/runner.d.ts +9 -0
- package/dist/internal/runner.js +70 -0
- package/dist/internal/services.d.ts +12 -0
- package/dist/internal/services.js +159 -0
- package/dist/internal/skeleton-handoff.d.ts +26 -0
- package/dist/internal/skeleton-handoff.js +6 -0
- package/dist/internal/skeleton-source.d.ts +5 -0
- package/dist/internal/skeleton-source.js +106 -0
- package/dist/internal/surface.d.ts +4 -0
- package/dist/internal/surface.js +21 -0
- package/dist/internal/table-definitions.d.ts +27 -0
- package/dist/internal/table-definitions.js +139 -0
- package/dist/internal/table-factory.d.ts +12 -0
- package/dist/internal/table-factory.js +44 -0
- package/dist/internal/table-field.d.ts +12 -0
- package/dist/internal/table-field.js +75 -0
- package/dist/internal/table-model.d.ts +21 -0
- package/dist/internal/table-model.js +117 -0
- package/dist/internal/table-projection.d.ts +7 -0
- package/dist/internal/table-projection.js +110 -0
- package/dist/internal/target-changes.d.ts +3 -0
- package/dist/internal/target-changes.js +2 -0
- package/dist/internal/target-tracker.d.ts +18 -0
- package/dist/internal/target-tracker.js +33 -0
- package/dist/internal/targets.d.ts +3 -0
- package/dist/internal/targets.js +15 -0
- package/dist/internal/text-definitions.d.ts +141 -0
- package/dist/internal/text-definitions.js +228 -0
- package/dist/internal/text-glyphs.d.ts +4 -0
- package/dist/internal/text-glyphs.js +32 -0
- package/dist/internal/text-morph.d.ts +32 -0
- package/dist/internal/text-morph.js +113 -0
- package/dist/internal/text-playback.d.ts +4 -0
- package/dist/internal/text-playback.js +119 -0
- package/dist/internal/text-scramble.d.ts +18 -0
- package/dist/internal/text-scramble.js +47 -0
- package/dist/internal/time.d.ts +9 -0
- package/dist/internal/time.js +13 -0
- package/dist/internal/unstyled.d.ts +8 -0
- package/dist/internal/unstyled.js +8 -0
- package/dist/line.css +5 -0
- package/dist/region-css.d.ts +1 -0
- package/dist/region-css.js +6 -0
- package/dist/region-styles.d.ts +3 -0
- package/dist/region-styles.js +15 -0
- package/dist/region.css +1 -0
- package/dist/region.d.ts +31 -0
- package/dist/region.js +100 -0
- package/dist/register-all.d.ts +2 -0
- package/dist/register-all.js +33 -0
- package/dist/server.d.ts +63 -0
- package/dist/server.js +141 -0
- package/dist/skeleton-animations.d.ts +10 -0
- package/dist/skeleton-animations.js +35 -0
- package/dist/skeleton-block.d.ts +50 -0
- package/dist/skeleton-block.js +260 -0
- package/dist/skeleton-circle.d.ts +5 -0
- package/dist/skeleton-circle.js +11 -0
- package/dist/skeleton-family.css +13 -0
- package/dist/skeleton-line.d.ts +5 -0
- package/dist/skeleton-line.js +11 -0
- package/dist/skeleton-text.css +5 -0
- package/dist/skeleton-text.d.ts +22 -0
- package/dist/skeleton-text.js +115 -0
- package/dist/skeleton.css +4 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.js +4 -0
- package/dist/static-catalog-styles.d.ts +8 -0
- package/dist/static-catalog-styles.js +44 -0
- package/dist/styles.d.ts +4 -0
- package/dist/styles.js +18 -0
- package/dist/table-animations.d.ts +11 -0
- package/dist/table-animations.js +4 -0
- package/dist/table-styles.d.ts +2 -0
- package/dist/table-styles.js +12 -0
- package/dist/table.css +3 -0
- package/dist/table.d.ts +88 -0
- package/dist/table.js +126 -0
- package/dist/text-animations.d.ts +31 -0
- package/dist/text-animations.js +40 -0
- package/dist/text-styles.d.ts +3 -0
- package/dist/text-styles.js +24 -0
- package/dist/text.css +3 -0
- package/dist/text.d.ts +42 -0
- package/dist/text.js +402 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.js +18 -0
- package/dist/typing-styles.d.ts +1 -0
- package/dist/typing-styles.js +7 -0
- package/dist/typing.css +4 -0
- package/dist/typing.d.ts +35 -0
- package/dist/typing.js +164 -0
- package/package.json +100 -4
package/dist/typing.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ancestors, node, register, upgradeProperties, } from './internal/dom.js';
|
|
2
|
+
import { ManagedElement, remaining, } from './internal/element.js';
|
|
3
|
+
import { curves } from './internal/marks.js';
|
|
4
|
+
import { typingPreset } from './internal/preset.js';
|
|
5
|
+
import { capturePresetData } from './internal/preset-data.js';
|
|
6
|
+
import { typingStyles } from './typing-styles.js';
|
|
7
|
+
/** Decorative activity only. Application readiness belongs to LoadingRegion. */
|
|
8
|
+
export class TypingDots extends ManagedElement {
|
|
9
|
+
upgrade() {
|
|
10
|
+
upgradeProperties(this, ['stylePolicy', 'preset', 'motion', 'speed']);
|
|
11
|
+
}
|
|
12
|
+
capturePreset(value) {
|
|
13
|
+
return capturePresetData(value, 'typing', () => typingPreset);
|
|
14
|
+
}
|
|
15
|
+
static observedAttributes = [
|
|
16
|
+
...ManagedElement.observedAttributes,
|
|
17
|
+
'count',
|
|
18
|
+
'speed',
|
|
19
|
+
];
|
|
20
|
+
#effects = [];
|
|
21
|
+
#count = 0;
|
|
22
|
+
#phase = 0;
|
|
23
|
+
get count() {
|
|
24
|
+
const value = +(this.getAttribute('count') ?? this.preset?.count ?? 3);
|
|
25
|
+
return Number.isInteger(value) && value > 0 ? Math.min(8, value) : 3;
|
|
26
|
+
}
|
|
27
|
+
set count(value) {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
this.removeAttribute('count');
|
|
30
|
+
else
|
|
31
|
+
this.setAttribute('count', String(value));
|
|
32
|
+
}
|
|
33
|
+
get speed() {
|
|
34
|
+
const value = +(this.getAttribute('speed') ?? this.preset?.speed ?? 1);
|
|
35
|
+
return value > 0 && Number.isFinite(value) ? Math.min(4, value) : 1;
|
|
36
|
+
}
|
|
37
|
+
set speed(value) {
|
|
38
|
+
if (value === undefined)
|
|
39
|
+
this.removeAttribute('speed');
|
|
40
|
+
else
|
|
41
|
+
this.setAttribute('speed', String(value));
|
|
42
|
+
}
|
|
43
|
+
get owner() {
|
|
44
|
+
const owner = ancestors(this).find((element) => element.localName === 'dotquilt-region');
|
|
45
|
+
if (!owner)
|
|
46
|
+
return undefined;
|
|
47
|
+
let top = this;
|
|
48
|
+
while (top.parentElement && top.parentElement !== owner)
|
|
49
|
+
top = top.parentElement;
|
|
50
|
+
return top.getAttribute('slot') === 'placeholder' ? owner : undefined;
|
|
51
|
+
}
|
|
52
|
+
get activity() {
|
|
53
|
+
return this.owner?.activity ?? this.ownActivity;
|
|
54
|
+
}
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
// Remove static preset decoration before replaying explicit caller properties.
|
|
57
|
+
const marker = 'data-dotquilt-preset-count';
|
|
58
|
+
const decoration = this.getAttribute(marker);
|
|
59
|
+
if (decoration !== null) {
|
|
60
|
+
if (!Object.hasOwn(this, 'count') &&
|
|
61
|
+
this.getAttribute('count') === decoration)
|
|
62
|
+
this.removeAttribute('count');
|
|
63
|
+
this.removeAttribute(marker);
|
|
64
|
+
}
|
|
65
|
+
super.connectedCallback();
|
|
66
|
+
upgradeProperties(this, ['count']);
|
|
67
|
+
this.setAttribute('data-dotquilt-surface', '');
|
|
68
|
+
if (!this.shadowRoot)
|
|
69
|
+
this.attachStyledShadow(typingStyles, true);
|
|
70
|
+
if (!this.hasAttribute('aria-hidden'))
|
|
71
|
+
this.setAttribute('aria-hidden', 'true');
|
|
72
|
+
this.whenStyled(() => {
|
|
73
|
+
for (const fallback of this.querySelectorAll(':scope > [data-dotquilt-static],:scope > [data-dotquilt-style]'))
|
|
74
|
+
fallback.remove();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
super.disconnectedCallback();
|
|
79
|
+
this.#stop();
|
|
80
|
+
}
|
|
81
|
+
attributeChangedCallback(name, old, value) {
|
|
82
|
+
if (value !== null && (name === 'count' || name === 'speed')) {
|
|
83
|
+
const number = +value;
|
|
84
|
+
if (!(number > 0 &&
|
|
85
|
+
(name === 'count'
|
|
86
|
+
? Number.isInteger(number)
|
|
87
|
+
: Number.isFinite(number))))
|
|
88
|
+
this.invalidOption(name);
|
|
89
|
+
else if (name === 'count' && number > 8)
|
|
90
|
+
this.report('typing-limit', 'count');
|
|
91
|
+
}
|
|
92
|
+
super.attributeChangedCallback(name, old, value);
|
|
93
|
+
}
|
|
94
|
+
update(patch) {
|
|
95
|
+
this.applyOptions(patch);
|
|
96
|
+
}
|
|
97
|
+
get optionNames() {
|
|
98
|
+
return [...super.optionNames, 'count', 'speed'];
|
|
99
|
+
}
|
|
100
|
+
refresh() {
|
|
101
|
+
this.resources?.eligible(true);
|
|
102
|
+
this.requestRender();
|
|
103
|
+
}
|
|
104
|
+
#stop() {
|
|
105
|
+
this.#phase =
|
|
106
|
+
this.#effects[0]?.effect?.getComputedTiming().progress ?? this.#phase;
|
|
107
|
+
for (const effect of this.#effects)
|
|
108
|
+
effect.cancel();
|
|
109
|
+
this.#effects = [];
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
const root = this.shadowRoot;
|
|
113
|
+
if (!root)
|
|
114
|
+
return;
|
|
115
|
+
const count = this.count;
|
|
116
|
+
if (this.#count !== count) {
|
|
117
|
+
this.#stop();
|
|
118
|
+
for (const dot of root.querySelectorAll('.dot'))
|
|
119
|
+
dot.remove();
|
|
120
|
+
for (let i = 0; i < count; i++)
|
|
121
|
+
root.append(node(this.ownerDocument, 'span', {
|
|
122
|
+
class: 'dot',
|
|
123
|
+
part: 'surface',
|
|
124
|
+
'aria-hidden': 'true',
|
|
125
|
+
}));
|
|
126
|
+
this.#count = count;
|
|
127
|
+
}
|
|
128
|
+
const owner = this.owner;
|
|
129
|
+
const activity = owner?.activity ?? this.ownActivity;
|
|
130
|
+
const moving = this.allowed(activity) && (!owner || owner.presentation === 'pending');
|
|
131
|
+
this.toggleAttribute('data-moving', moving);
|
|
132
|
+
if (!moving) {
|
|
133
|
+
this.#stop();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (activity.started === undefined || !this.deadline)
|
|
137
|
+
this.arm(activity);
|
|
138
|
+
// design/SPEC.md: a calm wave, 1.9 s per cycle, each dot 14% behind.
|
|
139
|
+
const period = 1900 / this.speed;
|
|
140
|
+
if (this.#effects[0]?.effect?.getTiming().duration === period)
|
|
141
|
+
return;
|
|
142
|
+
this.#stop();
|
|
143
|
+
try {
|
|
144
|
+
for (const [index, dot] of root.querySelectorAll('.dot').entries()) {
|
|
145
|
+
this.#effects.push(dot.animate([
|
|
146
|
+
{ opacity: 0.3, translate: '0 0', easing: curves.sine },
|
|
147
|
+
{ opacity: 1, translate: '0 -1.5px', easing: curves.sine },
|
|
148
|
+
{ opacity: 0.3, translate: '0 0' },
|
|
149
|
+
], {
|
|
150
|
+
duration: period,
|
|
151
|
+
iterations: remaining(this, activity) / period,
|
|
152
|
+
iterationStart: (this.#phase + 1 - ((index * 0.14) % 1)) % 1,
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
this.#stop();
|
|
158
|
+
this.report('animation-failed', 'animations');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
export function registerTypingDots() {
|
|
163
|
+
register('dotquilt-typing-dots', TypingDots);
|
|
164
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotquilt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Loading placeholders that hold the shape of your content, then hand over to it. Native Web Components.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://dotquilt.dev",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"loading",
|
|
10
|
+
"skeleton",
|
|
11
|
+
"placeholder",
|
|
12
|
+
"loader",
|
|
13
|
+
"web-components",
|
|
14
|
+
"accessibility",
|
|
15
|
+
"ssr"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": [
|
|
18
|
+
"**/*.css"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./skeleton": {
|
|
31
|
+
"types": "./dist/skeleton.d.ts",
|
|
32
|
+
"import": "./dist/skeleton.js"
|
|
33
|
+
},
|
|
34
|
+
"./region": {
|
|
35
|
+
"types": "./dist/region.d.ts",
|
|
36
|
+
"import": "./dist/region.js"
|
|
37
|
+
},
|
|
38
|
+
"./animations": {
|
|
39
|
+
"types": "./dist/animations.d.ts",
|
|
40
|
+
"import": "./dist/animations.js"
|
|
41
|
+
},
|
|
42
|
+
"./animations/skeleton": {
|
|
43
|
+
"types": "./dist/skeleton-animations.d.ts",
|
|
44
|
+
"import": "./dist/skeleton-animations.js"
|
|
45
|
+
},
|
|
46
|
+
"./server": {
|
|
47
|
+
"types": "./dist/server.d.ts",
|
|
48
|
+
"import": "./dist/server.js"
|
|
49
|
+
},
|
|
50
|
+
"./typing": {
|
|
51
|
+
"types": "./dist/typing.d.ts",
|
|
52
|
+
"import": "./dist/typing.js"
|
|
53
|
+
},
|
|
54
|
+
"./text": {
|
|
55
|
+
"types": "./dist/text.d.ts",
|
|
56
|
+
"import": "./dist/text.js"
|
|
57
|
+
},
|
|
58
|
+
"./animations/text": {
|
|
59
|
+
"types": "./dist/text-animations.d.ts",
|
|
60
|
+
"import": "./dist/text-animations.js"
|
|
61
|
+
},
|
|
62
|
+
"./chart": {
|
|
63
|
+
"types": "./dist/chart.d.ts",
|
|
64
|
+
"import": "./dist/chart.js"
|
|
65
|
+
},
|
|
66
|
+
"./animations/chart": {
|
|
67
|
+
"types": "./dist/chart-animations.d.ts",
|
|
68
|
+
"import": "./dist/chart-animations.js"
|
|
69
|
+
},
|
|
70
|
+
"./table": {
|
|
71
|
+
"types": "./dist/table.d.ts",
|
|
72
|
+
"import": "./dist/table.js"
|
|
73
|
+
},
|
|
74
|
+
"./animations/table": {
|
|
75
|
+
"types": "./dist/table-animations.d.ts",
|
|
76
|
+
"import": "./dist/table-animations.js"
|
|
77
|
+
},
|
|
78
|
+
"./register-all": {
|
|
79
|
+
"types": "./dist/register-all.d.ts",
|
|
80
|
+
"import": "./dist/register-all.js"
|
|
81
|
+
},
|
|
82
|
+
"./styles/*.css": "./dist/*.css"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "bun run ../../scripts/build.ts",
|
|
86
|
+
"check": "tsc --noEmit -p tsconfig.json",
|
|
87
|
+
"test": "bun test test"
|
|
88
|
+
},
|
|
89
|
+
"author": "Derenik Khachatryan",
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "git+https://github.com/b4rb13/dot-loaders.git",
|
|
93
|
+
"directory": "packages/core"
|
|
94
|
+
},
|
|
95
|
+
"bugs": {
|
|
96
|
+
"url": "https://github.com/b4rb13/dot-loaders/issues"
|
|
97
|
+
},
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"registry": "https://registry.npmjs.org/",
|
|
100
|
+
"access": "public"
|
|
101
|
+
}
|
|
102
|
+
}
|