@minca/core 0.1.17 → 0.2.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 (120) hide show
  1. package/README.md +2 -1
  2. package/dist/files/space-files.d.ts +2 -2
  3. package/dist/files/space-files.d.ts.map +1 -1
  4. package/dist/files/space-files.js +7 -5
  5. package/dist/files/space-files.js.map +1 -1
  6. package/dist/inbox/names.d.ts +1 -1
  7. package/dist/inbox/names.js +1 -1
  8. package/dist/index.d.ts +3 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +2 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/node/actions.d.ts +3 -0
  13. package/dist/node/actions.d.ts.map +1 -1
  14. package/dist/node/actions.js.map +1 -1
  15. package/dist/node/api.d.ts +1 -0
  16. package/dist/node/api.d.ts.map +1 -1
  17. package/dist/node/api.js +1 -0
  18. package/dist/node/api.js.map +1 -1
  19. package/dist/node/carrier.js +1 -1
  20. package/dist/node/carrier.js.map +1 -1
  21. package/dist/node/index.d.ts +1 -1
  22. package/dist/node/index.d.ts.map +1 -1
  23. package/dist/node/node-contacts.d.ts.map +1 -1
  24. package/dist/node/node-contacts.js +1 -0
  25. package/dist/node/node-contacts.js.map +1 -1
  26. package/dist/node/node-records.d.ts.map +1 -1
  27. package/dist/node/node-records.js +6 -1
  28. package/dist/node/node-records.js.map +1 -1
  29. package/dist/node/node.d.ts.map +1 -1
  30. package/dist/node/node.js +13 -1
  31. package/dist/node/node.js.map +1 -1
  32. package/dist/node/remote.d.ts.map +1 -1
  33. package/dist/node/remote.js +7 -1
  34. package/dist/node/remote.js.map +1 -1
  35. package/dist/node/space-runtime.d.ts +5 -3
  36. package/dist/node/space-runtime.d.ts.map +1 -1
  37. package/dist/node/space-runtime.js +3 -1
  38. package/dist/node/space-runtime.js.map +1 -1
  39. package/dist/node/types.d.ts +112 -36
  40. package/dist/node/types.d.ts.map +1 -1
  41. package/dist/node/watch-notifications.d.ts +6 -0
  42. package/dist/node/watch-notifications.d.ts.map +1 -1
  43. package/dist/node/watch-notifications.js +47 -9
  44. package/dist/node/watch-notifications.js.map +1 -1
  45. package/dist/query/types.d.ts +1 -0
  46. package/dist/query/types.d.ts.map +1 -1
  47. package/dist/query/types.js.map +1 -1
  48. package/dist/records/contract-builder.d.ts +22 -6
  49. package/dist/records/contract-builder.d.ts.map +1 -1
  50. package/dist/records/contract-builder.js.map +1 -1
  51. package/dist/schemas/automations.d.ts +6 -2
  52. package/dist/schemas/automations.d.ts.map +1 -1
  53. package/dist/schemas/automations.js.map +1 -1
  54. package/dist/schemas/connectors.d.ts +4 -3
  55. package/dist/schemas/connectors.d.ts.map +1 -1
  56. package/dist/schemas/connectors.js +4 -3
  57. package/dist/schemas/connectors.js.map +1 -1
  58. package/dist/schemas/library/media.js +1 -1
  59. package/dist/schemas/library/media.js.map +1 -1
  60. package/dist/session/account-hint.d.ts +2 -2
  61. package/dist/session/account-hint.d.ts.map +1 -1
  62. package/dist/session/account-hint.js +3 -3
  63. package/dist/session/account-hint.js.map +1 -1
  64. package/dist/session/auth.d.ts +7 -3
  65. package/dist/session/auth.d.ts.map +1 -1
  66. package/dist/session/auth.js.map +1 -1
  67. package/dist/session/connection.d.ts +18 -0
  68. package/dist/session/connection.d.ts.map +1 -1
  69. package/dist/session/connection.js +11 -0
  70. package/dist/session/connection.js.map +1 -1
  71. package/dist/session/index.d.ts +2 -2
  72. package/dist/session/index.d.ts.map +1 -1
  73. package/dist/session/index.js +2 -2
  74. package/dist/session/index.js.map +1 -1
  75. package/dist/storage/blob-store.d.ts +3 -0
  76. package/dist/storage/blob-store.d.ts.map +1 -1
  77. package/dist/types.d.ts +11 -2
  78. package/dist/types.d.ts.map +1 -1
  79. package/dist/types.js.map +1 -1
  80. package/docs/README.md +86 -93
  81. package/docs/actions.md +213 -152
  82. package/docs/agents.md +198 -167
  83. package/docs/automations.md +296 -204
  84. package/docs/blueprints-and-guides.md +405 -311
  85. package/docs/bots.md +208 -134
  86. package/docs/building-an-app.md +86 -159
  87. package/docs/collections.md +248 -328
  88. package/docs/computed.md +112 -89
  89. package/docs/contacts.md +151 -112
  90. package/docs/contracts.md +299 -120
  91. package/docs/direct-messages.md +80 -65
  92. package/docs/inbox.md +138 -93
  93. package/docs/node.md +1081 -996
  94. package/docs/permissions.md +142 -0
  95. package/docs/proposing-collections.md +74 -55
  96. package/docs/query-format.md +150 -126
  97. package/docs/records-and-queries.md +205 -126
  98. package/docs/sign-in.md +487 -416
  99. package/docs/spaces.md +261 -246
  100. package/docs/standard-library.md +487 -526
  101. package/docs/storage.md +325 -348
  102. package/docs/usernames.md +164 -97
  103. package/docs/warrants.md +100 -67
  104. package/package.json +1 -6
  105. package/dist/elements/auth-styles.d.ts +0 -18
  106. package/dist/elements/auth-styles.d.ts.map +0 -1
  107. package/dist/elements/auth-styles.js +0 -206
  108. package/dist/elements/auth-styles.js.map +0 -1
  109. package/dist/elements/dom.d.ts +0 -29
  110. package/dist/elements/dom.d.ts.map +0 -1
  111. package/dist/elements/dom.js +0 -91
  112. package/dist/elements/dom.js.map +0 -1
  113. package/dist/elements/index.d.ts +0 -13
  114. package/dist/elements/index.d.ts.map +0 -1
  115. package/dist/elements/index.js +0 -11
  116. package/dist/elements/index.js.map +0 -1
  117. package/dist/elements/minca-auth.d.ts +0 -55
  118. package/dist/elements/minca-auth.d.ts.map +0 -1
  119. package/dist/elements/minca-auth.js +0 -768
  120. package/dist/elements/minca-auth.js.map +0 -1
@@ -1,206 +0,0 @@
1
- /**
2
- * @module elements/auth-styles
3
- * How `<minca-auth>` looks.
4
- *
5
- * Black and white, hairline borders, one accent. Every colour, the font and
6
- * the corner radius are custom properties on the element, so a host page
7
- * restyles it without reaching inside:
8
- *
9
- * ```css
10
- * minca-auth { --minca-accent: #4f46e5; --minca-font: 'Inter', sans-serif; }
11
- * ```
12
- *
13
- * It sizes itself to its container rather than the window — a container query,
14
- * not a media query — so the same element fits a full page, a modal or a side
15
- * panel without being told which.
16
- */
17
- export const AUTH_CSS = `
18
- minca-auth {
19
- --minca-ink: #000;
20
- --minca-body: #171717;
21
- --minca-muted: #666;
22
- --minca-faint: #8f8f8f;
23
- --minca-surface: #fff;
24
- --minca-sunken: #fafafa;
25
- --minca-line: #eaeaea;
26
- --minca-line-strong: #d4d4d4;
27
- --minca-accent: #000;
28
- --minca-accent-hover: #383838;
29
- --minca-on-accent: #fff;
30
- --minca-danger: #e5484d;
31
- --minca-danger-soft: #fff0f0;
32
- --minca-warn: #9a5a0b;
33
- --minca-good: #2f7a52;
34
- --minca-radius: 6px;
35
- --minca-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
36
- --minca-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
37
-
38
- display: block;
39
- container-type: inline-size;
40
- color: var(--minca-body);
41
- font-family: var(--minca-font);
42
- font-size: 14px;
43
- letter-spacing: -0.006em;
44
- -webkit-font-smoothing: antialiased;
45
- }
46
- minca-auth[hidden] { display: none; }
47
- minca-auth *, minca-auth *::before, minca-auth *::after { box-sizing: border-box; }
48
- minca-auth :is(h1, p) { margin: 0; }
49
-
50
- minca-auth .wa-card { width: 100%; max-width: 380px; margin: 0 auto; }
51
- minca-auth .wa-wordmark { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; color: var(--minca-ink); font-weight: 600; font-size: 16px; letter-spacing: -0.03em; }
52
- minca-auth .wa-title { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--minca-ink); margin-bottom: 8px; line-height: 1.2; }
53
- minca-auth .wa-subtitle { font-size: 15px; color: var(--minca-muted); margin-bottom: 32px; line-height: 1.5; }
54
- minca-auth .wa-hint { font-size: 14px; color: var(--minca-muted); margin-bottom: 20px; line-height: 1.6; }
55
- minca-auth .wa-small { font-size: 13px; color: var(--minca-muted); margin-top: 8px; line-height: 1.6; }
56
- minca-auth .wa-meter { display: flex; gap: 4px; margin-top: 2px; }
57
- minca-auth .wa-meter > span { flex: 1; height: 4px; border-radius: 2px; background: var(--minca-line); transition: background-color .15s ease; }
58
- minca-auth .wa-meter[data-strength="weak"] > span:first-child { background: var(--minca-danger); }
59
- minca-auth .wa-meter[data-strength="fair"] > span:not(:last-child) { background: var(--minca-warn); }
60
- minca-auth .wa-meter[data-strength="strong"] > span { background: var(--minca-good); }
61
- minca-auth .wa-small[data-strength] { margin-top: 0; }
62
- minca-auth .wa-small[data-strength="weak"] { color: var(--minca-danger); }
63
- minca-auth .wa-error { color: var(--minca-danger); font-size: 14px; font-weight: 500; }
64
- minca-auth .wa-error-box { margin-top: 16px; padding: 12px 14px; border-radius: var(--minca-radius); background: var(--minca-danger-soft); }
65
-
66
- minca-auth .wa-form { display: flex; flex-direction: column; gap: 8px; }
67
- minca-auth .wa-form + .wa-form { margin-top: 10px; }
68
- minca-auth input {
69
- width: 100%; height: 40px; padding: 0 12px;
70
- border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);
71
- background: var(--minca-surface); color: var(--minca-ink);
72
- font: inherit; font-size: 14px; outline: none;
73
- transition: border-color .15s ease, box-shadow .15s ease;
74
- }
75
- minca-auth input::placeholder { color: var(--minca-faint); }
76
- minca-auth .wa-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--minca-ink); margin-top: 10px; }
77
- minca-auth .wa-optional { font-weight: 400; color: var(--minca-faint); }
78
- minca-auth .wa-under { margin-top: -2px; font-size: 12px; }
79
- minca-auth .wa-username {
80
- display: flex; align-items: center; height: 40px;
81
- border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong); background: var(--minca-surface);
82
- transition: border-color .15s ease, box-shadow .15s ease;
83
- }
84
- minca-auth .wa-username:focus-within { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
85
- minca-auth .wa-username input, minca-auth .wa-username input:focus { flex: 1; min-width: 0; height: 100%; border: none; box-shadow: none; background: transparent; }
86
- minca-auth .wa-username > span { padding-right: 12px; color: var(--minca-muted); white-space: nowrap; }
87
- minca-auth .wa-domain { all: unset; padding: 0 12px 0 0; color: var(--minca-muted); white-space: nowrap; cursor: pointer; }
88
- minca-auth .wa-domain:hover, minca-auth .wa-domain:focus-visible { color: var(--minca-ink); text-decoration: underline; text-underline-offset: 3px; }
89
- minca-auth .wa-domain[hidden] { display: none; }
90
- minca-auth .wa-under a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
91
- minca-auth .wa-mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin: 0 10px 0 -4px; padding: 0 !important; border-radius: 50%; font-size: 11px; font-weight: 700; }
92
- minca-auth .wa-mark:empty { display: none; }
93
- minca-auth .wa-mark[data-name="free"] { background: var(--minca-good); color: #fff !important; }
94
- minca-auth .wa-mark[data-name="taken"] { background: var(--minca-danger); color: #fff !important; }
95
- minca-auth .wa-small[data-name="taken"] { color: var(--minca-danger); }
96
- minca-auth .wa-small[data-name="free"]:not(.wa-under) { color: var(--minca-good); }
97
- minca-auth input:focus { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
98
- minca-auth .wa-offscreen {
99
- position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
100
- overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
101
- }
102
-
103
- minca-auth button { font: inherit; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
104
- minca-auth button:not(:disabled) { cursor: pointer; }
105
- minca-auth button:disabled { opacity: .5; cursor: not-allowed; }
106
- minca-auth :focus-visible { outline: 2px solid var(--minca-ink); outline-offset: 2px; }
107
- minca-auth button:focus:not(:focus-visible) { outline: none; }
108
-
109
- minca-auth .wa-button {
110
- width: 100%; height: 40px; padding: 0 16px;
111
- border-radius: var(--minca-radius); border: 1px solid transparent;
112
- background: var(--minca-accent); color: var(--minca-on-accent);
113
- font-size: 14px; font-weight: 500;
114
- }
115
- minca-auth .wa-button:not(:disabled):hover { background: var(--minca-accent-hover); }
116
- minca-auth .wa-link {
117
- background: none; border: none; padding: 4px 0; margin-right: 12px;
118
- color: var(--minca-muted); font-size: 13px; font-weight: 500; text-align: left;
119
- }
120
- minca-auth .wa-link:not(:disabled):hover { color: var(--minca-ink); }
121
- minca-auth .wa-links { display: flex; flex-wrap: wrap; margin-top: 10px; }
122
-
123
- /* Choices are one list: a box, a hairline between each. */
124
- minca-auth .wa-options {
125
- display: flex; flex-direction: column; overflow: hidden;
126
- border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface);
127
- }
128
- minca-auth .wa-option {
129
- display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;
130
- text-align: left; border: none; border-radius: 0; background: none; color: var(--minca-body);
131
- }
132
- minca-auth .wa-option:not(:disabled):hover { background: var(--minca-sunken); }
133
- /* After .wa-option, which has no border of its own, and as specific: the line between rows wins. */
134
- minca-auth .wa-options > :not(:first-child) { border-top: 1px solid var(--minca-line); }
135
- minca-auth .wa-option-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
136
- /* Where a page draws each kind of choice's icon, by its data-option; empty, it takes no room. */
137
- minca-auth .wa-option-icon { display: none; flex-shrink: 0; width: 36px; height: 36px; background: center / contain no-repeat; }
138
- minca-auth .wa-options > .wa-steps { margin: 0; padding: 12px 16px 14px 36px; }
139
- minca-auth .wa-option-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--minca-ink); }
140
- minca-auth .wa-option-text { color: var(--minca-muted); font-size: 13px; line-height: 1.5; }
141
- minca-auth .wa-badge {
142
- font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
143
- background: var(--minca-sunken); border: 1px solid var(--minca-line); color: var(--minca-muted);
144
- }
145
-
146
- minca-auth .wa-accounts { display: flex; flex-direction: column; gap: 8px; }
147
- minca-auth .wa-account { border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface); }
148
- minca-auth .wa-account-open { padding: 20px; border-color: var(--minca-line-strong); }
149
- minca-auth .wa-account-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
150
- minca-auth .wa-account-head .wa-account-name { font-size: 17px; }
151
- minca-auth .wa-account-row {
152
- display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px;
153
- text-align: left; color: var(--minca-body);
154
- }
155
- minca-auth .wa-account-row:not(:disabled):hover { background: var(--minca-sunken); }
156
- minca-auth .wa-account-name { display: block; font-weight: 600; color: var(--minca-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
157
- minca-auth .wa-chevron { color: var(--minca-faint); font-size: 18px; }
158
- minca-auth .wa-small .wa-link { padding: 0; margin: 0 8px 0 0; font-size: 13px; }
159
- minca-auth .wa-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--minca-line); }
160
- minca-auth .wa-footer .wa-links { margin-top: 0; }
161
- minca-auth .wa-avatar { flex-shrink: 0; display: block; border-radius: 8px; }
162
- minca-auth .wa-avatar-round { border-radius: 50% !important; }
163
-
164
- minca-auth .wa-code {
165
- display: block; margin-top: 16px; padding: 12px; border-radius: var(--minca-radius);
166
- background: var(--minca-sunken); border: 1px solid var(--minca-line);
167
- font-family: var(--minca-mono); font-size: 13px; color: var(--minca-ink);
168
- word-break: break-all; user-select: all;
169
- }
170
-
171
- minca-auth .wa-code-large { font-size: 17px; letter-spacing: 0.04em; text-align: center; padding: 16px 12px; margin-top: 0; }
172
- minca-auth .wa-row { display: flex; gap: 8px; margin-top: 10px; }
173
- minca-auth .wa-secondary {
174
- flex: 1; height: 36px; padding: 0 12px;
175
- border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);
176
- background: var(--minca-surface); color: var(--minca-ink); font-size: 13px; font-weight: 500;
177
- }
178
- minca-auth .wa-secondary:not(:disabled):hover { background: var(--minca-sunken); }
179
- minca-auth .wa-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 16px; font-size: 14px; line-height: 1.5; color: var(--minca-body); cursor: pointer; }
180
- minca-auth .wa-check input { width: 16px; height: 16px; margin: 3px 0 0; padding: 0; flex-shrink: 0; accent-color: var(--minca-accent); box-shadow: none; }
181
- minca-auth .wa-steps { margin: 0 0 20px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--minca-body); }
182
-
183
- minca-auth .wa-info { position: relative; display: inline; }
184
- minca-auth .wa-info-button {
185
- display: inline-flex; align-items: center; justify-content: center;
186
- width: 16px; height: 16px; padding: 0; margin-left: 6px; vertical-align: text-bottom;
187
- border-radius: 999px; border: 1px solid var(--minca-line-strong); background: none;
188
- color: var(--minca-faint); font-size: 10px; font-weight: 700; line-height: 1;
189
- }
190
- minca-auth .wa-popover {
191
- position: absolute; z-index: 30; top: 22px; left: 0; width: min(260px, 80cqi);
192
- padding: 12px 14px; border-radius: var(--minca-radius);
193
- background: var(--minca-surface); border: 1px solid var(--minca-line);
194
- box-shadow: 0 12px 28px -12px rgba(15, 17, 21, .22);
195
- font-size: 12.5px; line-height: 1.6; color: var(--minca-muted); font-weight: 400;
196
- }
197
- minca-auth .wa-popover[hidden] { display: none; }
198
-
199
- @container (max-width: 340px) {
200
- minca-auth .wa-title { font-size: 24px; }
201
- minca-auth .wa-subtitle { margin-bottom: 24px; }
202
- minca-auth .wa-wordmark { margin-bottom: 28px; }
203
- minca-auth .wa-popover { left: auto; right: -8px; }
204
- }
205
- `;
206
- //# sourceMappingURL=auth-styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-styles.js","sourceRoot":"","sources":["../../src/elements/auth-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4LvB,CAAC"}
@@ -1,29 +0,0 @@
1
- /**
2
- * @module elements/dom
3
- * Just enough DOM building for the elements to stay readable without a
4
- * framework: `h('button', { onclick }, 'Save')`.
5
- */
6
- export type Child = Node | string | number | false | null | undefined | ReadonlyArray<Child>;
7
- type Props = Record<string, unknown> & {
8
- class?: string;
9
- style?: string;
10
- };
11
- /**
12
- * Makes an element. Props starting with `on` become listeners, `class` and
13
- * `style` are set as attributes, booleans toggle attributes, anything else is
14
- * set as a property when the element has one and an attribute otherwise.
15
- */
16
- export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Props | null, ...children: Child[]): HTMLElementTagNameMap[K];
17
- export declare function h(tag: string, props?: Props | null, ...children: Child[]): HTMLElement;
18
- /** Markup from trusted, constant strings — an icon, never anything a person typed. */
19
- export declare function svg(markup: string): Element;
20
- /**
21
- * Adds a stylesheet to the document once, by id.
22
- *
23
- * A constructed stylesheet where the browser has them — it needs no inline
24
- * `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
25
- * element otherwise.
26
- */
27
- export declare function adoptStyles(id: string, css: string): void;
28
- export {};
29
- //# sourceMappingURL=dom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/elements/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE7F,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAK1E;;;;GAIG;AACH,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACrD,GAAG,EAAE,CAAC,EACN,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,QAAQ,EAAE,KAAK,EAAE,GACnB,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAC5B,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;AAwCxF,sFAAsF;AACtF,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI3C;AAWD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAoBzD"}
@@ -1,91 +0,0 @@
1
- /**
2
- * @module elements/dom
3
- * Just enough DOM building for the elements to stay readable without a
4
- * framework: `h('button', { onclick }, 'Save')`.
5
- */
6
- /** Always set as attributes: their properties want other types, or do not exist on every element */
7
- const ATTRIBUTES = new Set(['class', 'style', 'role', 'spellcheck', 'autocomplete', 'tabindex', 'for']);
8
- export function h(tag, props = null, ...children) {
9
- const element = globalThis.document.createElement(tag);
10
- for (const [name, value] of Object.entries(props ?? {})) {
11
- if (value === undefined || value === null || value === false)
12
- continue;
13
- if (name.startsWith('on') && typeof value === 'function') {
14
- element.addEventListener(name.slice(2), (event) => {
15
- Reflect.apply(value, element, [event]);
16
- });
17
- }
18
- else if (value === true) {
19
- element.setAttribute(name, '');
20
- }
21
- else if (ATTRIBUTES.has(name) ||
22
- name.startsWith('data-') ||
23
- name.startsWith('aria-') ||
24
- !(name in element)) {
25
- // What setAttribute would make of it anyway; props hold text and numbers.
26
- // eslint-disable-next-line @typescript-eslint/no-base-to-string -- the DOM's own conversion
27
- element.setAttribute(name, String(value));
28
- }
29
- else if (!Reflect.set(element, name, value)) {
30
- throw new TypeError(`Cannot set ${name} on <${tag}>`);
31
- }
32
- }
33
- append(element, children);
34
- return element;
35
- }
36
- // Array.isArray does not narrow a readonly array out of a union.
37
- const isChildList = (child) => Array.isArray(child);
38
- function append(parent, children) {
39
- for (const child of children) {
40
- if (child === null || child === undefined || child === false)
41
- continue;
42
- if (isChildList(child))
43
- append(parent, child);
44
- else if (typeof child === 'object')
45
- parent.appendChild(child);
46
- else
47
- parent.appendChild(globalThis.document.createTextNode(String(child)));
48
- }
49
- }
50
- /** Markup from trusted, constant strings — an icon, never anything a person typed. */
51
- export function svg(markup) {
52
- const template = globalThis.document.createElement('template');
53
- template.innerHTML = markup.trim();
54
- return template.content.firstElementChild;
55
- }
56
- /** Kept on the document itself, so two copies of this library on one page still add each sheet once */
57
- function adoptedIds(doc) {
58
- const found = Reflect.get(doc, '__mincaStyles');
59
- if (found instanceof Set)
60
- return found;
61
- const ids = new Set();
62
- Reflect.set(doc, '__mincaStyles', ids);
63
- return ids;
64
- }
65
- /**
66
- * Adds a stylesheet to the document once, by id.
67
- *
68
- * A constructed stylesheet where the browser has them — it needs no inline
69
- * `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
70
- * element otherwise.
71
- */
72
- export function adoptStyles(id, css) {
73
- const doc = globalThis.document;
74
- const adopted = adoptedIds(doc);
75
- if (adopted.has(id))
76
- return;
77
- adopted.add(id);
78
- if ('adoptedStyleSheets' in doc &&
79
- typeof CSSStyleSheet === 'function' &&
80
- 'replaceSync' in CSSStyleSheet.prototype) {
81
- const sheet = new CSSStyleSheet();
82
- sheet.replaceSync(css);
83
- doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];
84
- return;
85
- }
86
- const style = doc.createElement('style');
87
- style.id = id;
88
- style.textContent = css;
89
- doc.head.appendChild(style);
90
- }
91
- //# sourceMappingURL=dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/elements/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,oGAAoG;AACpG,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,c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M,GAAG,GAAG,IAAI,GAAG,EAAW,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,GAAW;IACjD,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC;IAChC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO;IAC5B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,IACE,oBAAoB,IAAI,GAAG;QAC3B,OAAO,aAAa,KAAK,UAAU;QACnC,aAAa,IAAI,aAAa,CAAC,SAAS,EACxC,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvB,GAAG,CAAC,kBAAkB,GAAG,CAAC,GAAG,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * @module elements
3
- * Web components for Minca, usable from any framework or none. Importing this
4
- * registers them.
5
- *
6
- * - `<minca-auth>` — the sign-in flow: where the data lives, which account,
7
- * the ways into it. Fires `minca-session` when someone signs in or out.
8
- */
9
- export { MincaAuthElement, defineMincaAuth } from './minca-auth.js';
10
- export type { MincaSessionEventDetail } from './minca-auth.js';
11
- export { createMincaAuth } from '../session/auth.js';
12
- export type { MincaAuth, MincaAuthConfig, AuthState, MincaSession } from '../session/auth.js';
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * @module elements
3
- * Web components for Minca, usable from any framework or none. Importing this
4
- * registers them.
5
- *
6
- * - `<minca-auth>` — the sign-in flow: where the data lives, which account,
7
- * the ways into it. Fires `minca-session` when someone signs in or out.
8
- */
9
- export { MincaAuthElement, defineMincaAuth } from './minca-auth.js';
10
- export { createMincaAuth } from '../session/auth.js';
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,55 +0,0 @@
1
- /**
2
- * @module elements/minca-auth
3
- * `<minca-auth>`: the whole sign-in flow as one element.
4
- *
5
- * ```html
6
- * <minca-auth app-name="Todo" relays="wss://relay.example"></minca-auth>
7
- * <script type="module">
8
- * import '@minca/core/elements';
9
- * document.querySelector('minca-auth').addEventListener('minca-session', (event) => {
10
- * const session = event.detail.session; // null when signed out
11
- * if (session) start(session.node);
12
- * });
13
- * </script>
14
- * ```
15
- *
16
- * Or hand it a flow you made yourself: `element.auth = createMincaAuth({ … })`.
17
- * It draws into its light DOM, not a shadow root, because password managers
18
- * fill forms there far more reliably; its styles are scoped to the element.
19
- */
20
- import { type MincaAuth, type MincaSession } from '../session/auth.js';
21
- /** What `minca-session` carries */
22
- export interface MincaSessionEventDetail {
23
- readonly session: MincaSession | null;
24
- }
25
- declare const Base: {
26
- new (): HTMLElement;
27
- prototype: HTMLElement;
28
- };
29
- export declare class MincaAuthElement extends Base {
30
- #private;
31
- /** The flow this element draws. Set it to share one with the rest of the page; otherwise one is made from the attributes. */
32
- get auth(): MincaAuth;
33
- set auth(auth: MincaAuth);
34
- /**
35
- * Draws an account's avatar from its DID, round or not. A page that shows
36
- * accounts its own way sets this, so an account looks the same here as
37
- * everywhere else on it; otherwise a simple one is drawn.
38
- */
39
- get avatar(): ((did: string, size: number, round: boolean) => Element) | null;
40
- set avatar(draw: ((did: string, size: number, round: boolean) => Element) | null);
41
- connectedCallback(): void;
42
- disconnectedCallback(): void;
43
- }
44
- /** Registers `<minca-auth>`, once. Importing this module does it for you. */
45
- export declare function defineMincaAuth(tag?: string): void;
46
- declare global {
47
- interface HTMLElementTagNameMap {
48
- 'minca-auth': MincaAuthElement;
49
- }
50
- interface HTMLElementEventMap {
51
- 'minca-session': CustomEvent<MincaSessionEventDetail>;
52
- }
53
- }
54
- export {};
55
- //# sourceMappingURL=minca-auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"minca-auth.d.ts","sourceRoot":"","sources":["../../src/elements/minca-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAS5B,mCAAmC;AACnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;CACvC;AAUD,QAAA,MAAM,IAAI;;;CAAqC,CAAC;AA8NhD,qBAAa,gBAAiB,SAAQ,IAAI;;IAwBxC,6HAA6H;IAC7H,IAAI,IAAI,IAAI,SAAS,CAMpB;IAUD,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAIvB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,IAAI,CAE5E;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,IAAI,EAG/E;IAYD,iBAAiB,IAAI,IAAI,CAWxB;IAED,oBAAoB,IAAI,IAAI,CAG3B;CA03BF;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,SAAe,GAAG,IAAI,CAGxD;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,gBAAgB,CAAC;KAChC;IACD,UAAU,mBAAmB;QAC3B,eAAe,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC;KACvD;CACF"}