dotquilt 0.0.0-stage → 0.1.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.
Files changed (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -2
  3. package/dist/animations.d.ts +105 -0
  4. package/dist/animations.js +107 -0
  5. package/dist/catalog-styles.d.ts +4 -0
  6. package/dist/catalog-styles.js +12 -0
  7. package/dist/chart-animations.d.ts +36 -0
  8. package/dist/chart-animations.js +25 -0
  9. package/dist/chart-styles.d.ts +3 -0
  10. package/dist/chart-styles.js +23 -0
  11. package/dist/chart.css +4 -0
  12. package/dist/chart.d.ts +73 -0
  13. package/dist/chart.js +80 -0
  14. package/dist/circle.css +5 -0
  15. package/dist/index.d.ts +11 -0
  16. package/dist/index.js +9 -0
  17. package/dist/internal/binding.d.ts +13 -0
  18. package/dist/internal/binding.js +21 -0
  19. package/dist/internal/capture.d.ts +4 -0
  20. package/dist/internal/capture.js +13 -0
  21. package/dist/internal/chart-appearance.d.ts +12 -0
  22. package/dist/internal/chart-appearance.js +2 -0
  23. package/dist/internal/chart-definitions.d.ts +19 -0
  24. package/dist/internal/chart-definitions.js +149 -0
  25. package/dist/internal/chart-factory.d.ts +12 -0
  26. package/dist/internal/chart-factory.js +31 -0
  27. package/dist/internal/chart-field.d.ts +22 -0
  28. package/dist/internal/chart-field.js +74 -0
  29. package/dist/internal/chart-idle.d.ts +3 -0
  30. package/dist/internal/chart-idle.js +96 -0
  31. package/dist/internal/chart-math.d.ts +8 -0
  32. package/dist/internal/chart-math.js +19 -0
  33. package/dist/internal/chart-participant.d.ts +8 -0
  34. package/dist/internal/chart-participant.js +4 -0
  35. package/dist/internal/chart-projection.d.ts +11 -0
  36. package/dist/internal/chart-projection.js +69 -0
  37. package/dist/internal/content-box.d.ts +11 -0
  38. package/dist/internal/content-box.js +36 -0
  39. package/dist/internal/coordinated-handoff.d.ts +4 -0
  40. package/dist/internal/coordinated-handoff.js +158 -0
  41. package/dist/internal/count.d.ts +3 -0
  42. package/dist/internal/count.js +20 -0
  43. package/dist/internal/defaults.d.ts +11 -0
  44. package/dist/internal/defaults.js +11 -0
  45. package/dist/internal/dense/managed-painter.d.ts +4 -0
  46. package/dist/internal/dense/managed-painter.js +361 -0
  47. package/dist/internal/dense/runner.d.ts +2 -0
  48. package/dist/internal/dense/runner.js +5 -0
  49. package/dist/internal/dense-loader.d.ts +83 -0
  50. package/dist/internal/dense-loader.js +331 -0
  51. package/dist/internal/dissolve.d.ts +27 -0
  52. package/dist/internal/dissolve.js +216 -0
  53. package/dist/internal/dom.d.ts +23 -0
  54. package/dist/internal/dom.js +104 -0
  55. package/dist/internal/effect.d.ts +2 -0
  56. package/dist/internal/effect.js +17 -0
  57. package/dist/internal/element.d.ts +89 -0
  58. package/dist/internal/element.js +384 -0
  59. package/dist/internal/event-element.d.ts +8 -0
  60. package/dist/internal/event-element.js +20 -0
  61. package/dist/internal/frames.d.ts +1 -0
  62. package/dist/internal/frames.js +51 -0
  63. package/dist/internal/handoff.d.ts +56 -0
  64. package/dist/internal/handoff.js +102 -0
  65. package/dist/internal/ledger.d.ts +13 -0
  66. package/dist/internal/ledger.js +78 -0
  67. package/dist/internal/loading-controller.d.ts +62 -0
  68. package/dist/internal/loading-controller.js +694 -0
  69. package/dist/internal/marks.d.ts +153 -0
  70. package/dist/internal/marks.js +227 -0
  71. package/dist/internal/math.d.ts +2 -0
  72. package/dist/internal/math.js +2 -0
  73. package/dist/internal/morph-marks.d.ts +62 -0
  74. package/dist/internal/morph-marks.js +205 -0
  75. package/dist/internal/morph.d.ts +35 -0
  76. package/dist/internal/morph.js +488 -0
  77. package/dist/internal/paint.d.ts +29 -0
  78. package/dist/internal/paint.js +1 -0
  79. package/dist/internal/painter.d.ts +20 -0
  80. package/dist/internal/painter.js +155 -0
  81. package/dist/internal/preset-data.d.ts +12 -0
  82. package/dist/internal/preset-data.js +31 -0
  83. package/dist/internal/preset.d.ts +22 -0
  84. package/dist/internal/preset.js +86 -0
  85. package/dist/internal/pulse.d.ts +7 -0
  86. package/dist/internal/pulse.js +74 -0
  87. package/dist/internal/reveal-effect.d.ts +7 -0
  88. package/dist/internal/reveal-effect.js +24 -0
  89. package/dist/internal/reveal.d.ts +5 -0
  90. package/dist/internal/reveal.js +11 -0
  91. package/dist/internal/runner.d.ts +9 -0
  92. package/dist/internal/runner.js +70 -0
  93. package/dist/internal/services.d.ts +12 -0
  94. package/dist/internal/services.js +159 -0
  95. package/dist/internal/skeleton-handoff.d.ts +26 -0
  96. package/dist/internal/skeleton-handoff.js +6 -0
  97. package/dist/internal/skeleton-source.d.ts +5 -0
  98. package/dist/internal/skeleton-source.js +106 -0
  99. package/dist/internal/surface.d.ts +4 -0
  100. package/dist/internal/surface.js +21 -0
  101. package/dist/internal/table-definitions.d.ts +27 -0
  102. package/dist/internal/table-definitions.js +139 -0
  103. package/dist/internal/table-factory.d.ts +12 -0
  104. package/dist/internal/table-factory.js +44 -0
  105. package/dist/internal/table-field.d.ts +12 -0
  106. package/dist/internal/table-field.js +75 -0
  107. package/dist/internal/table-model.d.ts +21 -0
  108. package/dist/internal/table-model.js +117 -0
  109. package/dist/internal/table-projection.d.ts +7 -0
  110. package/dist/internal/table-projection.js +110 -0
  111. package/dist/internal/target-changes.d.ts +3 -0
  112. package/dist/internal/target-changes.js +2 -0
  113. package/dist/internal/target-tracker.d.ts +18 -0
  114. package/dist/internal/target-tracker.js +33 -0
  115. package/dist/internal/targets.d.ts +3 -0
  116. package/dist/internal/targets.js +15 -0
  117. package/dist/internal/text-definitions.d.ts +141 -0
  118. package/dist/internal/text-definitions.js +228 -0
  119. package/dist/internal/text-glyphs.d.ts +4 -0
  120. package/dist/internal/text-glyphs.js +32 -0
  121. package/dist/internal/text-morph.d.ts +32 -0
  122. package/dist/internal/text-morph.js +113 -0
  123. package/dist/internal/text-playback.d.ts +4 -0
  124. package/dist/internal/text-playback.js +119 -0
  125. package/dist/internal/text-scramble.d.ts +18 -0
  126. package/dist/internal/text-scramble.js +47 -0
  127. package/dist/internal/time.d.ts +9 -0
  128. package/dist/internal/time.js +13 -0
  129. package/dist/internal/unstyled.d.ts +8 -0
  130. package/dist/internal/unstyled.js +8 -0
  131. package/dist/line.css +5 -0
  132. package/dist/region-css.d.ts +1 -0
  133. package/dist/region-css.js +6 -0
  134. package/dist/region-styles.d.ts +3 -0
  135. package/dist/region-styles.js +15 -0
  136. package/dist/region.css +1 -0
  137. package/dist/region.d.ts +31 -0
  138. package/dist/region.js +100 -0
  139. package/dist/register-all.d.ts +2 -0
  140. package/dist/register-all.js +33 -0
  141. package/dist/server.d.ts +63 -0
  142. package/dist/server.js +141 -0
  143. package/dist/skeleton-animations.d.ts +10 -0
  144. package/dist/skeleton-animations.js +35 -0
  145. package/dist/skeleton-block.d.ts +50 -0
  146. package/dist/skeleton-block.js +260 -0
  147. package/dist/skeleton-circle.d.ts +5 -0
  148. package/dist/skeleton-circle.js +11 -0
  149. package/dist/skeleton-family.css +13 -0
  150. package/dist/skeleton-line.d.ts +5 -0
  151. package/dist/skeleton-line.js +11 -0
  152. package/dist/skeleton-text.css +5 -0
  153. package/dist/skeleton-text.d.ts +22 -0
  154. package/dist/skeleton-text.js +115 -0
  155. package/dist/skeleton.css +4 -0
  156. package/dist/skeleton.d.ts +5 -0
  157. package/dist/skeleton.js +4 -0
  158. package/dist/static-catalog-styles.d.ts +8 -0
  159. package/dist/static-catalog-styles.js +44 -0
  160. package/dist/styles.d.ts +4 -0
  161. package/dist/styles.js +18 -0
  162. package/dist/table-animations.d.ts +11 -0
  163. package/dist/table-animations.js +4 -0
  164. package/dist/table-styles.d.ts +2 -0
  165. package/dist/table-styles.js +12 -0
  166. package/dist/table.css +3 -0
  167. package/dist/table.d.ts +88 -0
  168. package/dist/table.js +126 -0
  169. package/dist/text-animations.d.ts +31 -0
  170. package/dist/text-animations.js +40 -0
  171. package/dist/text-styles.d.ts +3 -0
  172. package/dist/text-styles.js +24 -0
  173. package/dist/text.css +3 -0
  174. package/dist/text.d.ts +42 -0
  175. package/dist/text.js +402 -0
  176. package/dist/types.d.ts +56 -0
  177. package/dist/types.js +18 -0
  178. package/dist/typing-styles.d.ts +1 -0
  179. package/dist/typing-styles.js +7 -0
  180. package/dist/typing.css +4 -0
  181. package/dist/typing.d.ts +35 -0
  182. package/dist/typing.js +164 -0
  183. 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.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
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
+ }