@weaveprotocol/core 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.
- package/README.md +1106 -0
- package/dist/elements/auth-styles.d.ts +18 -0
- package/dist/elements/auth-styles.d.ts.map +1 -0
- package/dist/elements/auth-styles.js +150 -0
- package/dist/elements/auth-styles.js.map +1 -0
- package/dist/elements/dom.d.ts +28 -0
- package/dist/elements/dom.d.ts.map +1 -0
- package/dist/elements/dom.js +74 -0
- package/dist/elements/dom.js.map +1 -0
- package/dist/elements/index.d.ts +13 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/index.js +11 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/elements/weave-auth.d.ts +52 -0
- package/dist/elements/weave-auth.d.ts.map +1 -0
- package/dist/elements/weave-auth.js +427 -0
- package/dist/elements/weave-auth.js.map +1 -0
- package/dist/identity/account-store.d.ts +113 -0
- package/dist/identity/account-store.d.ts.map +1 -0
- package/dist/identity/account-store.js +305 -0
- package/dist/identity/account-store.js.map +1 -0
- package/dist/identity/account-vault.d.ts +199 -0
- package/dist/identity/account-vault.d.ts.map +1 -0
- package/dist/identity/account-vault.js +251 -0
- package/dist/identity/account-vault.js.map +1 -0
- package/dist/identity/agent-note.d.ts +19 -0
- package/dist/identity/agent-note.d.ts.map +1 -0
- package/dist/identity/agent-note.js +29 -0
- package/dist/identity/agent-note.js.map +1 -0
- package/dist/identity/crypto-p256.d.ts +7 -0
- package/dist/identity/crypto-p256.d.ts.map +1 -0
- package/dist/identity/crypto-p256.js +84 -0
- package/dist/identity/crypto-p256.js.map +1 -0
- package/dist/identity/device-key.d.ts +60 -0
- package/dist/identity/device-key.d.ts.map +1 -0
- package/dist/identity/device-key.js +103 -0
- package/dist/identity/device-key.js.map +1 -0
- package/dist/identity/did.d.ts +22 -0
- package/dist/identity/did.d.ts.map +1 -0
- package/dist/identity/did.js +37 -0
- package/dist/identity/did.js.map +1 -0
- package/dist/identity/folder-account.d.ts +65 -0
- package/dist/identity/folder-account.d.ts.map +1 -0
- package/dist/identity/folder-account.js +115 -0
- package/dist/identity/folder-account.js.map +1 -0
- package/dist/identity/identity-manager.d.ts +36 -0
- package/dist/identity/identity-manager.d.ts.map +1 -0
- package/dist/identity/identity-manager.js +115 -0
- package/dist/identity/identity-manager.js.map +1 -0
- package/dist/identity/index.d.ts +10 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +10 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/keys.d.ts +24 -0
- package/dist/identity/keys.d.ts.map +1 -0
- package/dist/identity/keys.js +38 -0
- package/dist/identity/keys.js.map +1 -0
- package/dist/identity/pairing.d.ts +83 -0
- package/dist/identity/pairing.d.ts.map +1 -0
- package/dist/identity/pairing.js +120 -0
- package/dist/identity/pairing.js.map +1 -0
- package/dist/identity/passkey-diagnostics.d.ts +54 -0
- package/dist/identity/passkey-diagnostics.d.ts.map +1 -0
- package/dist/identity/passkey-diagnostics.js +178 -0
- package/dist/identity/passkey-diagnostics.js.map +1 -0
- package/dist/identity/recovery-code.d.ts +50 -0
- package/dist/identity/recovery-code.d.ts.map +1 -0
- package/dist/identity/recovery-code.js +116 -0
- package/dist/identity/recovery-code.js.map +1 -0
- package/dist/identity/root-signer.d.ts +59 -0
- package/dist/identity/root-signer.d.ts.map +1 -0
- package/dist/identity/root-signer.js +44 -0
- package/dist/identity/root-signer.js.map +1 -0
- package/dist/identity/ucan.d.ts +164 -0
- package/dist/identity/ucan.d.ts.map +1 -0
- package/dist/identity/ucan.js +273 -0
- package/dist/identity/ucan.js.map +1 -0
- package/dist/identity/webauthn.d.ts +87 -0
- package/dist/identity/webauthn.d.ts.map +1 -0
- package/dist/identity/webauthn.js +155 -0
- package/dist/identity/webauthn.js.map +1 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/network/index.d.ts +17 -0
- package/dist/network/index.d.ts.map +1 -0
- package/dist/network/index.js +10 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/introductions.d.ts +85 -0
- package/dist/network/introductions.d.ts.map +1 -0
- package/dist/network/introductions.js +94 -0
- package/dist/network/introductions.js.map +1 -0
- package/dist/network/local-transport.d.ts +22 -0
- package/dist/network/local-transport.d.ts.map +1 -0
- package/dist/network/local-transport.js +55 -0
- package/dist/network/local-transport.js.map +1 -0
- package/dist/network/mesh.d.ts +31 -0
- package/dist/network/mesh.d.ts.map +1 -0
- package/dist/network/mesh.js +332 -0
- package/dist/network/mesh.js.map +1 -0
- package/dist/network/multi-signaling.d.ts +29 -0
- package/dist/network/multi-signaling.d.ts.map +1 -0
- package/dist/network/multi-signaling.js +125 -0
- package/dist/network/multi-signaling.js.map +1 -0
- package/dist/network/network-manager.d.ts +37 -0
- package/dist/network/network-manager.d.ts.map +1 -0
- package/dist/network/network-manager.js +64 -0
- package/dist/network/network-manager.js.map +1 -0
- package/dist/network/peer-auth.d.ts +98 -0
- package/dist/network/peer-auth.d.ts.map +1 -0
- package/dist/network/peer-auth.js +86 -0
- package/dist/network/peer-auth.js.map +1 -0
- package/dist/network/rtc-transport.d.ts +18 -0
- package/dist/network/rtc-transport.d.ts.map +1 -0
- package/dist/network/rtc-transport.js +149 -0
- package/dist/network/rtc-transport.js.map +1 -0
- package/dist/network/signaling.d.ts +40 -0
- package/dist/network/signaling.d.ts.map +1 -0
- package/dist/network/signaling.js +124 -0
- package/dist/network/signaling.js.map +1 -0
- package/dist/network/transport.d.ts +50 -0
- package/dist/network/transport.d.ts.map +1 -0
- package/dist/network/transport.js +13 -0
- package/dist/network/transport.js.map +1 -0
- package/dist/network/ws-transport.d.ts +42 -0
- package/dist/network/ws-transport.d.ts.map +1 -0
- package/dist/network/ws-transport.js +194 -0
- package/dist/network/ws-transport.js.map +1 -0
- package/dist/node/actions.d.ts +62 -0
- package/dist/node/actions.d.ts.map +1 -0
- package/dist/node/actions.js +500 -0
- package/dist/node/actions.js.map +1 -0
- package/dist/node/carrier.d.ts +85 -0
- package/dist/node/carrier.d.ts.map +1 -0
- package/dist/node/carrier.js +192 -0
- package/dist/node/carrier.js.map +1 -0
- package/dist/node/copy.d.ts +38 -0
- package/dist/node/copy.d.ts.map +1 -0
- package/dist/node/copy.js +53 -0
- package/dist/node/copy.js.map +1 -0
- package/dist/node/index.d.ts +16 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +11 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/node.d.ts +12 -0
- package/dist/node/node.d.ts.map +1 -0
- package/dist/node/node.js +872 -0
- package/dist/node/node.js.map +1 -0
- package/dist/node/space-runtime.d.ts +144 -0
- package/dist/node/space-runtime.d.ts.map +1 -0
- package/dist/node/space-runtime.js +1221 -0
- package/dist/node/space-runtime.js.map +1 -0
- package/dist/node/stores.d.ts +45 -0
- package/dist/node/stores.d.ts.map +1 -0
- package/dist/node/stores.js +31 -0
- package/dist/node/stores.js.map +1 -0
- package/dist/node/types.d.ts +508 -0
- package/dist/node/types.d.ts.map +1 -0
- package/dist/node/types.js +2 -0
- package/dist/node/types.js.map +1 -0
- package/dist/privacy/index.d.ts +4 -0
- package/dist/privacy/index.d.ts.map +1 -0
- package/dist/privacy/index.js +4 -0
- package/dist/privacy/index.js.map +1 -0
- package/dist/privacy/key-distribution.d.ts +42 -0
- package/dist/privacy/key-distribution.d.ts.map +1 -0
- package/dist/privacy/key-distribution.js +50 -0
- package/dist/privacy/key-distribution.js.map +1 -0
- package/dist/privacy/privacy-guard.d.ts +24 -0
- package/dist/privacy/privacy-guard.d.ts.map +1 -0
- package/dist/privacy/privacy-guard.js +87 -0
- package/dist/privacy/privacy-guard.js.map +1 -0
- package/dist/privacy/space-encryption.d.ts +48 -0
- package/dist/privacy/space-encryption.d.ts.map +1 -0
- package/dist/privacy/space-encryption.js +61 -0
- package/dist/privacy/space-encryption.js.map +1 -0
- package/dist/query/engine.d.ts +27 -0
- package/dist/query/engine.d.ts.map +1 -0
- package/dist/query/engine.js +84 -0
- package/dist/query/engine.js.map +1 -0
- package/dist/query/filter.d.ts +15 -0
- package/dist/query/filter.d.ts.map +1 -0
- package/dist/query/filter.js +207 -0
- package/dist/query/filter.js.map +1 -0
- package/dist/query/types.d.ts +144 -0
- package/dist/query/types.d.ts.map +1 -0
- package/dist/query/types.js +22 -0
- package/dist/query/types.js.map +1 -0
- package/dist/react/context.d.ts +81 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +95 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +36 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/use-live.d.ts +16 -0
- package/dist/react/use-live.d.ts.map +1 -0
- package/dist/react/use-live.js +55 -0
- package/dist/react/use-live.js.map +1 -0
- package/dist/react/use-query.d.ts +17 -0
- package/dist/react/use-query.d.ts.map +1 -0
- package/dist/react/use-query.js +23 -0
- package/dist/react/use-query.js.map +1 -0
- package/dist/react/use-space.d.ts +29 -0
- package/dist/react/use-space.d.ts.map +1 -0
- package/dist/react/use-space.js +48 -0
- package/dist/react/use-space.js.map +1 -0
- package/dist/react/use-spaces.d.ts +19 -0
- package/dist/react/use-spaces.d.ts.map +1 -0
- package/dist/react/use-spaces.js +55 -0
- package/dist/react/use-spaces.js.map +1 -0
- package/dist/react/use-weave-auth.d.ts +10 -0
- package/dist/react/use-weave-auth.d.ts.map +1 -0
- package/dist/react/use-weave-auth.js +15 -0
- package/dist/react/use-weave-auth.js.map +1 -0
- package/dist/react/weave-auth.d.ts +17 -0
- package/dist/react/weave-auth.d.ts.map +1 -0
- package/dist/react/weave-auth.js +38 -0
- package/dist/react/weave-auth.js.map +1 -0
- package/dist/records/describe.d.ts +38 -0
- package/dist/records/describe.d.ts.map +1 -0
- package/dist/records/describe.js +101 -0
- package/dist/records/describe.js.map +1 -0
- package/dist/records/links.d.ts +14 -0
- package/dist/records/links.d.ts.map +1 -0
- package/dist/records/links.js +25 -0
- package/dist/records/links.js.map +1 -0
- package/dist/records/rules.d.ts +59 -0
- package/dist/records/rules.d.ts.map +1 -0
- package/dist/records/rules.js +118 -0
- package/dist/records/rules.js.map +1 -0
- package/dist/records/version.d.ts +54 -0
- package/dist/records/version.d.ts.map +1 -0
- package/dist/records/version.js +70 -0
- package/dist/records/version.js.map +1 -0
- package/dist/schema/collection-def.d.ts +96 -0
- package/dist/schema/collection-def.d.ts.map +1 -0
- package/dist/schema/collection-def.js +272 -0
- package/dist/schema/collection-def.js.map +1 -0
- package/dist/schema/expression.d.ts +69 -0
- package/dist/schema/expression.d.ts.map +1 -0
- package/dist/schema/expression.js +92 -0
- package/dist/schema/expression.js.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +4 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/schema-engine.d.ts +42 -0
- package/dist/schema/schema-engine.d.ts.map +1 -0
- package/dist/schema/schema-engine.js +36 -0
- package/dist/schema/schema-engine.js.map +1 -0
- package/dist/schema/signer.d.ts +27 -0
- package/dist/schema/signer.d.ts.map +1 -0
- package/dist/schema/signer.js +36 -0
- package/dist/schema/signer.js.map +1 -0
- package/dist/schemas/apps.d.ts +88 -0
- package/dist/schemas/apps.d.ts.map +1 -0
- package/dist/schemas/apps.js +168 -0
- package/dist/schemas/apps.js.map +1 -0
- package/dist/schemas/index.d.ts +410 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +208 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/screens.d.ts +67 -0
- package/dist/schemas/screens.d.ts.map +1 -0
- package/dist/schemas/screens.js +242 -0
- package/dist/schemas/screens.js.map +1 -0
- package/dist/session/agent-link.d.ts +79 -0
- package/dist/session/agent-link.d.ts.map +1 -0
- package/dist/session/agent-link.js +251 -0
- package/dist/session/agent-link.js.map +1 -0
- package/dist/session/auth.d.ts +233 -0
- package/dist/session/auth.d.ts.map +1 -0
- package/dist/session/auth.js +783 -0
- package/dist/session/auth.js.map +1 -0
- package/dist/session/connect.d.ts +211 -0
- package/dist/session/connect.d.ts.map +1 -0
- package/dist/session/connect.js +355 -0
- package/dist/session/connect.js.map +1 -0
- package/dist/session/connection.d.ts +70 -0
- package/dist/session/connection.d.ts.map +1 -0
- package/dist/session/connection.js +120 -0
- package/dist/session/connection.js.map +1 -0
- package/dist/session/credentials.d.ts +44 -0
- package/dist/session/credentials.d.ts.map +1 -0
- package/dist/session/credentials.js +60 -0
- package/dist/session/credentials.js.map +1 -0
- package/dist/session/index.d.ts +25 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +18 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/pairing.d.ts +59 -0
- package/dist/session/pairing.d.ts.map +1 -0
- package/dist/session/pairing.js +144 -0
- package/dist/session/pairing.js.map +1 -0
- package/dist/session/places.d.ts +62 -0
- package/dist/session/places.d.ts.map +1 -0
- package/dist/session/places.js +101 -0
- package/dist/session/places.js.map +1 -0
- package/dist/session/stay-signed-in.d.ts +37 -0
- package/dist/session/stay-signed-in.d.ts.map +1 -0
- package/dist/session/stay-signed-in.js +124 -0
- package/dist/session/stay-signed-in.js.map +1 -0
- package/dist/space/account-registry.d.ts +64 -0
- package/dist/space/account-registry.d.ts.map +1 -0
- package/dist/space/account-registry.js +66 -0
- package/dist/space/account-registry.js.map +1 -0
- package/dist/space/index.d.ts +3 -0
- package/dist/space/index.d.ts.map +1 -0
- package/dist/space/index.js +3 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/pass.d.ts +63 -0
- package/dist/space/pass.d.ts.map +1 -0
- package/dist/space/pass.js +54 -0
- package/dist/space/pass.js.map +1 -0
- package/dist/space/presets.d.ts +31 -0
- package/dist/space/presets.d.ts.map +1 -0
- package/dist/space/presets.js +24 -0
- package/dist/space/presets.js.map +1 -0
- package/dist/space/roles.d.ts +186 -0
- package/dist/space/roles.d.ts.map +1 -0
- package/dist/space/roles.js +500 -0
- package/dist/space/roles.js.map +1 -0
- package/dist/space/space-access.d.ts +80 -0
- package/dist/space/space-access.d.ts.map +1 -0
- package/dist/space/space-access.js +135 -0
- package/dist/space/space-access.js.map +1 -0
- package/dist/space/space-manager.d.ts +87 -0
- package/dist/space/space-manager.d.ts.map +1 -0
- package/dist/space/space-manager.js +187 -0
- package/dist/space/space-manager.js.map +1 -0
- package/dist/storage/directory-access.d.ts +78 -0
- package/dist/storage/directory-access.d.ts.map +1 -0
- package/dist/storage/directory-access.js +164 -0
- package/dist/storage/directory-access.js.map +1 -0
- package/dist/storage/encrypted-adapter.d.ts +49 -0
- package/dist/storage/encrypted-adapter.d.ts.map +1 -0
- package/dist/storage/encrypted-adapter.js +106 -0
- package/dist/storage/encrypted-adapter.js.map +1 -0
- package/dist/storage/folder-adapter.d.ts +105 -0
- package/dist/storage/folder-adapter.d.ts.map +1 -0
- package/dist/storage/folder-adapter.js +280 -0
- package/dist/storage/folder-adapter.js.map +1 -0
- package/dist/storage/folder-reconcile.d.ts +53 -0
- package/dist/storage/folder-reconcile.d.ts.map +1 -0
- package/dist/storage/folder-reconcile.js +65 -0
- package/dist/storage/folder-reconcile.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +9 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/indexeddb-adapter.d.ts +12 -0
- package/dist/storage/indexeddb-adapter.d.ts.map +1 -0
- package/dist/storage/indexeddb-adapter.js +190 -0
- package/dist/storage/indexeddb-adapter.js.map +1 -0
- package/dist/storage/mst.d.ts +121 -0
- package/dist/storage/mst.d.ts.map +1 -0
- package/dist/storage/mst.js +402 -0
- package/dist/storage/mst.js.map +1 -0
- package/dist/storage/storage-provider.d.ts +85 -0
- package/dist/storage/storage-provider.d.ts.map +1 -0
- package/dist/storage/storage-provider.js +220 -0
- package/dist/storage/storage-provider.js.map +1 -0
- package/dist/sync/anti-entropy.d.ts +49 -0
- package/dist/sync/anti-entropy.d.ts.map +1 -0
- package/dist/sync/anti-entropy.js +62 -0
- package/dist/sync/anti-entropy.js.map +1 -0
- package/dist/sync/index.d.ts +4 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +4 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/sync-engine.d.ts +71 -0
- package/dist/sync/sync-engine.d.ts.map +1 -0
- package/dist/sync/sync-engine.js +309 -0
- package/dist/sync/sync-engine.js.map +1 -0
- package/dist/sync/sync-messages.d.ts +75 -0
- package/dist/sync/sync-messages.d.ts.map +1 -0
- package/dist/sync/sync-messages.js +12 -0
- package/dist/sync/sync-messages.js.map +1 -0
- package/dist/types.d.ts +243 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/encoding.d.ts +63 -0
- package/dist/utils/encoding.d.ts.map +1 -0
- package/dist/utils/encoding.js +130 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/errors.d.ts +43 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +28 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/events.d.ts +19 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +27 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/hash.d.ts +23 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +49 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/validation/capability-gate.d.ts +50 -0
- package/dist/validation/capability-gate.d.ts.map +1 -0
- package/dist/validation/capability-gate.js +71 -0
- package/dist/validation/capability-gate.js.map +1 -0
- package/dist/validation/crypto-gate.d.ts +16 -0
- package/dist/validation/crypto-gate.d.ts.map +1 -0
- package/dist/validation/crypto-gate.js +37 -0
- package/dist/validation/crypto-gate.js.map +1 -0
- package/dist/validation/index.d.ts +6 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +6 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/stateful-gate.d.ts +15 -0
- package/dist/validation/stateful-gate.d.ts.map +1 -0
- package/dist/validation/stateful-gate.js +50 -0
- package/dist/validation/stateful-gate.js.map +1 -0
- package/dist/validation/structural-gate.d.ts +18 -0
- package/dist/validation/structural-gate.d.ts.map +1 -0
- package/dist/validation/structural-gate.js +54 -0
- package/dist/validation/structural-gate.js.map +1 -0
- package/dist/validation/validation-engine.d.ts +28 -0
- package/dist/validation/validation-engine.d.ts.map +1 -0
- package/dist/validation/validation-engine.js +38 -0
- package/dist/validation/validation-engine.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module elements/auth-styles
|
|
3
|
+
* How `<weave-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
|
+
* weave-auth { --weave-accent: #4f46e5; --weave-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 declare const AUTH_CSS = "\nweave-auth {\n --weave-ink: #000;\n --weave-body: #171717;\n --weave-muted: #666;\n --weave-faint: #8f8f8f;\n --weave-surface: #fff;\n --weave-sunken: #fafafa;\n --weave-line: #eaeaea;\n --weave-line-strong: #d4d4d4;\n --weave-accent: #000;\n --weave-accent-hover: #383838;\n --weave-on-accent: #fff;\n --weave-danger: #e5484d;\n --weave-danger-soft: #fff0f0;\n --weave-radius: 6px;\n --weave-font: \"Geist\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n --weave-mono: \"Geist Mono\", ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;\n\n display: block;\n container-type: inline-size;\n color: var(--weave-body);\n font-family: var(--weave-font);\n font-size: 14px;\n letter-spacing: -0.006em;\n -webkit-font-smoothing: antialiased;\n}\nweave-auth[hidden] { display: none; }\nweave-auth *, weave-auth *::before, weave-auth *::after { box-sizing: border-box; }\nweave-auth :is(h1, p) { margin: 0; }\n\nweave-auth .wa-card { width: 100%; max-width: 380px; margin: 0 auto; }\nweave-auth .wa-wordmark { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; color: var(--weave-ink); font-weight: 600; font-size: 16px; letter-spacing: -0.03em; }\nweave-auth .wa-title { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--weave-ink); margin-bottom: 8px; line-height: 1.2; }\nweave-auth .wa-subtitle { font-size: 15px; color: var(--weave-muted); margin-bottom: 32px; line-height: 1.5; }\nweave-auth .wa-hint { font-size: 14px; color: var(--weave-muted); margin-bottom: 20px; line-height: 1.6; }\nweave-auth .wa-small { font-size: 13px; color: var(--weave-muted); margin-top: 8px; line-height: 1.6; }\nweave-auth .wa-error { color: var(--weave-danger); font-size: 14px; font-weight: 500; }\nweave-auth .wa-error-box { margin-top: 16px; padding: 12px 14px; border-radius: var(--weave-radius); background: var(--weave-danger-soft); }\n\nweave-auth .wa-form { display: flex; flex-direction: column; gap: 8px; }\nweave-auth .wa-form + .wa-form { margin-top: 10px; }\nweave-auth input {\n width: 100%; height: 40px; padding: 0 12px;\n border-radius: var(--weave-radius); border: 1px solid var(--weave-line-strong);\n background: var(--weave-surface); color: var(--weave-ink);\n font: inherit; font-size: 14px; outline: none;\n transition: border-color .15s ease, box-shadow .15s ease;\n}\nweave-auth input::placeholder { color: var(--weave-faint); }\nweave-auth input:focus { border-color: var(--weave-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }\nweave-auth .wa-offscreen {\n position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;\n overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;\n}\n\nweave-auth button { font: inherit; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }\nweave-auth button:not(:disabled) { cursor: pointer; }\nweave-auth button:disabled { opacity: .5; cursor: not-allowed; }\nweave-auth :focus-visible { outline: 2px solid var(--weave-ink); outline-offset: 2px; }\nweave-auth button:focus:not(:focus-visible) { outline: none; }\n\nweave-auth .wa-button {\n width: 100%; height: 40px; padding: 0 16px;\n border-radius: var(--weave-radius); border: 1px solid transparent;\n background: var(--weave-accent); color: var(--weave-on-accent);\n font-size: 14px; font-weight: 500;\n}\nweave-auth .wa-button:not(:disabled):hover { background: var(--weave-accent-hover); }\nweave-auth .wa-link {\n background: none; border: none; padding: 4px 0; margin-right: 12px;\n color: var(--weave-muted); font-size: 13px; font-weight: 500; text-align: left;\n}\nweave-auth .wa-link:not(:disabled):hover { color: var(--weave-ink); }\nweave-auth .wa-links { display: flex; flex-wrap: wrap; margin-top: 10px; }\n\nweave-auth .wa-options { display: flex; flex-direction: column; gap: 12px; }\nweave-auth .wa-option {\n display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 16px;\n text-align: left; border-radius: var(--weave-radius);\n border: 1px solid var(--weave-line); background: var(--weave-surface); color: var(--weave-body);\n}\nweave-auth .wa-option:not(:disabled):hover { background: var(--weave-sunken); border-color: var(--weave-line-strong); }\nweave-auth .wa-option-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--weave-ink); }\nweave-auth .wa-option-text { color: var(--weave-muted); font-size: 13px; line-height: 1.5; }\nweave-auth .wa-badge {\n font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;\n background: var(--weave-sunken); border: 1px solid var(--weave-line); color: var(--weave-muted);\n}\n\nweave-auth .wa-account { padding: 12px 0; border-top: 1px solid var(--weave-line); }\nweave-auth .wa-account:last-of-type { border-bottom: 1px solid var(--weave-line); margin-bottom: 8px; }\nweave-auth .wa-account-row {\n display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; margin: 0 -8px;\n width: calc(100% + 16px); text-align: left;\n background: none; border: 1px solid transparent; border-radius: var(--weave-radius); color: var(--weave-body);\n}\nweave-auth .wa-account-row:not(:disabled):hover { background: var(--weave-sunken); }\nweave-auth .wa-account-name { display: block; font-weight: 600; color: var(--weave-ink); }\nweave-auth .wa-account-did { display: block; font-size: 12px; color: var(--weave-faint); font-family: var(--weave-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\nweave-auth .wa-account-body { margin-top: 10px; }\nweave-auth .wa-avatar { flex-shrink: 0; display: block; border-radius: 8px; }\n\nweave-auth .wa-code {\n display: block; margin-top: 16px; padding: 12px; border-radius: var(--weave-radius);\n background: var(--weave-sunken); border: 1px solid var(--weave-line);\n font-family: var(--weave-mono); font-size: 13px; color: var(--weave-ink);\n word-break: break-all; user-select: all;\n}\n\nweave-auth .wa-info { position: relative; display: inline; }\nweave-auth .wa-info-button {\n display: inline-flex; align-items: center; justify-content: center;\n width: 16px; height: 16px; padding: 0; margin-left: 6px; vertical-align: text-bottom;\n border-radius: 999px; border: 1px solid var(--weave-line-strong); background: none;\n color: var(--weave-faint); font-size: 10px; font-weight: 700; line-height: 1;\n}\nweave-auth .wa-popover {\n position: absolute; z-index: 30; top: 22px; left: 0; width: min(260px, 80cqi);\n padding: 12px 14px; border-radius: var(--weave-radius);\n background: var(--weave-surface); border: 1px solid var(--weave-line);\n box-shadow: 0 12px 28px -12px rgba(15, 17, 21, .22);\n font-size: 12.5px; line-height: 1.6; color: var(--weave-muted); font-weight: 400;\n}\nweave-auth .wa-popover[hidden] { display: none; }\n\n@container (max-width: 340px) {\n weave-auth .wa-title { font-size: 24px; }\n weave-auth .wa-subtitle { margin-bottom: 24px; }\n weave-auth .wa-wordmark { margin-bottom: 28px; }\n weave-auth .wa-popover { left: auto; right: -8px; }\n}\n";
|
|
18
|
+
//# sourceMappingURL=auth-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-styles.d.ts","sourceRoot":"","sources":["../../src/elements/auth-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,27NAoIpB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module elements/auth-styles
|
|
3
|
+
* How `<weave-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
|
+
* weave-auth { --weave-accent: #4f46e5; --weave-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
|
+
weave-auth {
|
|
19
|
+
--weave-ink: #000;
|
|
20
|
+
--weave-body: #171717;
|
|
21
|
+
--weave-muted: #666;
|
|
22
|
+
--weave-faint: #8f8f8f;
|
|
23
|
+
--weave-surface: #fff;
|
|
24
|
+
--weave-sunken: #fafafa;
|
|
25
|
+
--weave-line: #eaeaea;
|
|
26
|
+
--weave-line-strong: #d4d4d4;
|
|
27
|
+
--weave-accent: #000;
|
|
28
|
+
--weave-accent-hover: #383838;
|
|
29
|
+
--weave-on-accent: #fff;
|
|
30
|
+
--weave-danger: #e5484d;
|
|
31
|
+
--weave-danger-soft: #fff0f0;
|
|
32
|
+
--weave-radius: 6px;
|
|
33
|
+
--weave-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
34
|
+
--weave-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
35
|
+
|
|
36
|
+
display: block;
|
|
37
|
+
container-type: inline-size;
|
|
38
|
+
color: var(--weave-body);
|
|
39
|
+
font-family: var(--weave-font);
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
letter-spacing: -0.006em;
|
|
42
|
+
-webkit-font-smoothing: antialiased;
|
|
43
|
+
}
|
|
44
|
+
weave-auth[hidden] { display: none; }
|
|
45
|
+
weave-auth *, weave-auth *::before, weave-auth *::after { box-sizing: border-box; }
|
|
46
|
+
weave-auth :is(h1, p) { margin: 0; }
|
|
47
|
+
|
|
48
|
+
weave-auth .wa-card { width: 100%; max-width: 380px; margin: 0 auto; }
|
|
49
|
+
weave-auth .wa-wordmark { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; color: var(--weave-ink); font-weight: 600; font-size: 16px; letter-spacing: -0.03em; }
|
|
50
|
+
weave-auth .wa-title { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--weave-ink); margin-bottom: 8px; line-height: 1.2; }
|
|
51
|
+
weave-auth .wa-subtitle { font-size: 15px; color: var(--weave-muted); margin-bottom: 32px; line-height: 1.5; }
|
|
52
|
+
weave-auth .wa-hint { font-size: 14px; color: var(--weave-muted); margin-bottom: 20px; line-height: 1.6; }
|
|
53
|
+
weave-auth .wa-small { font-size: 13px; color: var(--weave-muted); margin-top: 8px; line-height: 1.6; }
|
|
54
|
+
weave-auth .wa-error { color: var(--weave-danger); font-size: 14px; font-weight: 500; }
|
|
55
|
+
weave-auth .wa-error-box { margin-top: 16px; padding: 12px 14px; border-radius: var(--weave-radius); background: var(--weave-danger-soft); }
|
|
56
|
+
|
|
57
|
+
weave-auth .wa-form { display: flex; flex-direction: column; gap: 8px; }
|
|
58
|
+
weave-auth .wa-form + .wa-form { margin-top: 10px; }
|
|
59
|
+
weave-auth input {
|
|
60
|
+
width: 100%; height: 40px; padding: 0 12px;
|
|
61
|
+
border-radius: var(--weave-radius); border: 1px solid var(--weave-line-strong);
|
|
62
|
+
background: var(--weave-surface); color: var(--weave-ink);
|
|
63
|
+
font: inherit; font-size: 14px; outline: none;
|
|
64
|
+
transition: border-color .15s ease, box-shadow .15s ease;
|
|
65
|
+
}
|
|
66
|
+
weave-auth input::placeholder { color: var(--weave-faint); }
|
|
67
|
+
weave-auth input:focus { border-color: var(--weave-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
|
|
68
|
+
weave-auth .wa-offscreen {
|
|
69
|
+
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
|
|
70
|
+
overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
weave-auth button { font: inherit; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
|
|
74
|
+
weave-auth button:not(:disabled) { cursor: pointer; }
|
|
75
|
+
weave-auth button:disabled { opacity: .5; cursor: not-allowed; }
|
|
76
|
+
weave-auth :focus-visible { outline: 2px solid var(--weave-ink); outline-offset: 2px; }
|
|
77
|
+
weave-auth button:focus:not(:focus-visible) { outline: none; }
|
|
78
|
+
|
|
79
|
+
weave-auth .wa-button {
|
|
80
|
+
width: 100%; height: 40px; padding: 0 16px;
|
|
81
|
+
border-radius: var(--weave-radius); border: 1px solid transparent;
|
|
82
|
+
background: var(--weave-accent); color: var(--weave-on-accent);
|
|
83
|
+
font-size: 14px; font-weight: 500;
|
|
84
|
+
}
|
|
85
|
+
weave-auth .wa-button:not(:disabled):hover { background: var(--weave-accent-hover); }
|
|
86
|
+
weave-auth .wa-link {
|
|
87
|
+
background: none; border: none; padding: 4px 0; margin-right: 12px;
|
|
88
|
+
color: var(--weave-muted); font-size: 13px; font-weight: 500; text-align: left;
|
|
89
|
+
}
|
|
90
|
+
weave-auth .wa-link:not(:disabled):hover { color: var(--weave-ink); }
|
|
91
|
+
weave-auth .wa-links { display: flex; flex-wrap: wrap; margin-top: 10px; }
|
|
92
|
+
|
|
93
|
+
weave-auth .wa-options { display: flex; flex-direction: column; gap: 12px; }
|
|
94
|
+
weave-auth .wa-option {
|
|
95
|
+
display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 16px;
|
|
96
|
+
text-align: left; border-radius: var(--weave-radius);
|
|
97
|
+
border: 1px solid var(--weave-line); background: var(--weave-surface); color: var(--weave-body);
|
|
98
|
+
}
|
|
99
|
+
weave-auth .wa-option:not(:disabled):hover { background: var(--weave-sunken); border-color: var(--weave-line-strong); }
|
|
100
|
+
weave-auth .wa-option-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--weave-ink); }
|
|
101
|
+
weave-auth .wa-option-text { color: var(--weave-muted); font-size: 13px; line-height: 1.5; }
|
|
102
|
+
weave-auth .wa-badge {
|
|
103
|
+
font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
|
|
104
|
+
background: var(--weave-sunken); border: 1px solid var(--weave-line); color: var(--weave-muted);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
weave-auth .wa-account { padding: 12px 0; border-top: 1px solid var(--weave-line); }
|
|
108
|
+
weave-auth .wa-account:last-of-type { border-bottom: 1px solid var(--weave-line); margin-bottom: 8px; }
|
|
109
|
+
weave-auth .wa-account-row {
|
|
110
|
+
display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; margin: 0 -8px;
|
|
111
|
+
width: calc(100% + 16px); text-align: left;
|
|
112
|
+
background: none; border: 1px solid transparent; border-radius: var(--weave-radius); color: var(--weave-body);
|
|
113
|
+
}
|
|
114
|
+
weave-auth .wa-account-row:not(:disabled):hover { background: var(--weave-sunken); }
|
|
115
|
+
weave-auth .wa-account-name { display: block; font-weight: 600; color: var(--weave-ink); }
|
|
116
|
+
weave-auth .wa-account-did { display: block; font-size: 12px; color: var(--weave-faint); font-family: var(--weave-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
117
|
+
weave-auth .wa-account-body { margin-top: 10px; }
|
|
118
|
+
weave-auth .wa-avatar { flex-shrink: 0; display: block; border-radius: 8px; }
|
|
119
|
+
|
|
120
|
+
weave-auth .wa-code {
|
|
121
|
+
display: block; margin-top: 16px; padding: 12px; border-radius: var(--weave-radius);
|
|
122
|
+
background: var(--weave-sunken); border: 1px solid var(--weave-line);
|
|
123
|
+
font-family: var(--weave-mono); font-size: 13px; color: var(--weave-ink);
|
|
124
|
+
word-break: break-all; user-select: all;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
weave-auth .wa-info { position: relative; display: inline; }
|
|
128
|
+
weave-auth .wa-info-button {
|
|
129
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
130
|
+
width: 16px; height: 16px; padding: 0; margin-left: 6px; vertical-align: text-bottom;
|
|
131
|
+
border-radius: 999px; border: 1px solid var(--weave-line-strong); background: none;
|
|
132
|
+
color: var(--weave-faint); font-size: 10px; font-weight: 700; line-height: 1;
|
|
133
|
+
}
|
|
134
|
+
weave-auth .wa-popover {
|
|
135
|
+
position: absolute; z-index: 30; top: 22px; left: 0; width: min(260px, 80cqi);
|
|
136
|
+
padding: 12px 14px; border-radius: var(--weave-radius);
|
|
137
|
+
background: var(--weave-surface); border: 1px solid var(--weave-line);
|
|
138
|
+
box-shadow: 0 12px 28px -12px rgba(15, 17, 21, .22);
|
|
139
|
+
font-size: 12.5px; line-height: 1.6; color: var(--weave-muted); font-weight: 400;
|
|
140
|
+
}
|
|
141
|
+
weave-auth .wa-popover[hidden] { display: none; }
|
|
142
|
+
|
|
143
|
+
@container (max-width: 340px) {
|
|
144
|
+
weave-auth .wa-title { font-size: 24px; }
|
|
145
|
+
weave-auth .wa-subtitle { margin-bottom: 24px; }
|
|
146
|
+
weave-auth .wa-wordmark { margin-bottom: 28px; }
|
|
147
|
+
weave-auth .wa-popover { left: auto; right: -8px; }
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
//# sourceMappingURL=auth-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-styles.js","sourceRoot":"","sources":["../../src/elements/auth-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIvB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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(tag: string, props?: Props | null, ...children: Child[]): HTMLElement;
|
|
17
|
+
/** Markup from trusted, constant strings — an icon, never anything a person typed. */
|
|
18
|
+
export declare function svg(markup: string): Element;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a stylesheet to the document once, by id.
|
|
21
|
+
*
|
|
22
|
+
* A constructed stylesheet where the browser has them — it needs no inline
|
|
23
|
+
* `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
|
|
24
|
+
* element otherwise.
|
|
25
|
+
*/
|
|
26
|
+
export declare function adoptStyles(id: string, css: string): void;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,CAgB5F;AAUD,sFAAsF;AACtF,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI3C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAgBzD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Makes an element. Props starting with `on` become listeners, `class` and
|
|
10
|
+
* `style` are set as attributes, booleans toggle attributes, anything else is
|
|
11
|
+
* set as a property when the element has one and an attribute otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export function h(tag, props = null, ...children) {
|
|
14
|
+
const element = globalThis.document.createElement(tag);
|
|
15
|
+
for (const [name, value] of Object.entries(props ?? {})) {
|
|
16
|
+
if (value === undefined || value === null || value === false)
|
|
17
|
+
continue;
|
|
18
|
+
if (name.startsWith('on') && typeof value === 'function') {
|
|
19
|
+
element.addEventListener(name.slice(2), value);
|
|
20
|
+
}
|
|
21
|
+
else if (value === true) {
|
|
22
|
+
element.setAttribute(name, '');
|
|
23
|
+
}
|
|
24
|
+
else if (ATTRIBUTES.has(name) || name.startsWith('data-') || name.startsWith('aria-') || !(name in element)) {
|
|
25
|
+
element.setAttribute(name, String(value));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
element[name] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
append(element, children);
|
|
32
|
+
return element;
|
|
33
|
+
}
|
|
34
|
+
function append(parent, children) {
|
|
35
|
+
for (const child of children) {
|
|
36
|
+
if (child === null || child === undefined || child === false)
|
|
37
|
+
continue;
|
|
38
|
+
if (Array.isArray(child))
|
|
39
|
+
append(parent, child);
|
|
40
|
+
else
|
|
41
|
+
parent.appendChild(typeof child === 'object' ? child : globalThis.document.createTextNode(String(child)));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Markup from trusted, constant strings — an icon, never anything a person typed. */
|
|
45
|
+
export function svg(markup) {
|
|
46
|
+
const template = globalThis.document.createElement('template');
|
|
47
|
+
template.innerHTML = markup.trim();
|
|
48
|
+
return template.content.firstElementChild;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Adds a stylesheet to the document once, by id.
|
|
52
|
+
*
|
|
53
|
+
* A constructed stylesheet where the browser has them — it needs no inline
|
|
54
|
+
* `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
|
|
55
|
+
* element otherwise.
|
|
56
|
+
*/
|
|
57
|
+
export function adoptStyles(id, css) {
|
|
58
|
+
const doc = globalThis.document;
|
|
59
|
+
doc.__weaveStyles ??= new Set();
|
|
60
|
+
if (doc.__weaveStyles.has(id))
|
|
61
|
+
return;
|
|
62
|
+
doc.__weaveStyles.add(id);
|
|
63
|
+
if ('adoptedStyleSheets' in doc && typeof CSSStyleSheet === 'function' && 'replaceSync' in CSSStyleSheet.prototype) {
|
|
64
|
+
const sheet = new CSSStyleSheet();
|
|
65
|
+
sheet.replaceSync(css);
|
|
66
|
+
doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const style = doc.createElement('style');
|
|
70
|
+
style.id = id;
|
|
71
|
+
style.textContent = css;
|
|
72
|
+
doc.head.appendChild(style);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/elements/dom.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module elements
|
|
3
|
+
* Web components for Weave, usable from any framework or none. Importing this
|
|
4
|
+
* registers them.
|
|
5
|
+
*
|
|
6
|
+
* - `<weave-auth>` — the sign-in flow: where the data lives, which account,
|
|
7
|
+
* the ways into it. Fires `weave-session` when someone signs in or out.
|
|
8
|
+
*/
|
|
9
|
+
export { WeaveAuthElement, defineWeaveAuth } from './weave-auth.js';
|
|
10
|
+
export type { WeaveSessionEventDetail } from './weave-auth.js';
|
|
11
|
+
export { createWeaveAuth } from '../session/auth.js';
|
|
12
|
+
export type { WeaveAuth, WeaveAuthConfig, AuthState, WeaveSession } from '../session/auth.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module elements
|
|
3
|
+
* Web components for Weave, usable from any framework or none. Importing this
|
|
4
|
+
* registers them.
|
|
5
|
+
*
|
|
6
|
+
* - `<weave-auth>` — the sign-in flow: where the data lives, which account,
|
|
7
|
+
* the ways into it. Fires `weave-session` when someone signs in or out.
|
|
8
|
+
*/
|
|
9
|
+
export { WeaveAuthElement, defineWeaveAuth } from './weave-auth.js';
|
|
10
|
+
export { createWeaveAuth } from '../session/auth.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module elements/weave-auth
|
|
3
|
+
* `<weave-auth>`: the whole sign-in flow as one element.
|
|
4
|
+
*
|
|
5
|
+
* ```html
|
|
6
|
+
* <weave-auth app-name="Todo" relays="wss://relay.example"></weave-auth>
|
|
7
|
+
* <script type="module">
|
|
8
|
+
* import '@weaveprotocol/core/elements';
|
|
9
|
+
* document.querySelector('weave-auth').addEventListener('weave-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, to share it with the rest of the page:
|
|
17
|
+
* `element.auth = createWeaveAuth({ … })`.
|
|
18
|
+
*
|
|
19
|
+
* It draws into its own light DOM, not a shadow root, on purpose: password
|
|
20
|
+
* managers find and fill forms in the page far more reliably than forms inside
|
|
21
|
+
* a shadow root, and the account password living in a password manager is the
|
|
22
|
+
* point of the whole design. Its styles are scoped to the element instead.
|
|
23
|
+
*
|
|
24
|
+
* It fills whatever box it is put in — a page, a modal, a panel — and draws
|
|
25
|
+
* nothing once signed in; the host decides what happens then.
|
|
26
|
+
*/
|
|
27
|
+
import { type WeaveAuth, type WeaveSession } from '../session/auth.js';
|
|
28
|
+
/** What `weave-session` carries */
|
|
29
|
+
export interface WeaveSessionEventDetail {
|
|
30
|
+
readonly session: WeaveSession | null;
|
|
31
|
+
}
|
|
32
|
+
declare const Base: typeof HTMLElement;
|
|
33
|
+
export declare class WeaveAuthElement extends Base {
|
|
34
|
+
#private;
|
|
35
|
+
/** The flow this element draws. Set it to share one with the rest of the page; otherwise one is made from the attributes. */
|
|
36
|
+
get auth(): WeaveAuth;
|
|
37
|
+
set auth(auth: WeaveAuth);
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
}
|
|
41
|
+
/** Registers `<weave-auth>`, once. Importing this module does it for you. */
|
|
42
|
+
export declare function defineWeaveAuth(tag?: string): void;
|
|
43
|
+
declare global {
|
|
44
|
+
interface HTMLElementTagNameMap {
|
|
45
|
+
'weave-auth': WeaveAuthElement;
|
|
46
|
+
}
|
|
47
|
+
interface HTMLElementEventMap {
|
|
48
|
+
'weave-session': CustomEvent<WeaveSessionEventDetail>;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=weave-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weave-auth.d.ts","sourceRoot":"","sources":["../../src/elements/weave-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAmD,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOxH,mCAAmC;AACnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;CACvC;AAED,QAAA,MAAM,IAAI,EAA2C,OAAO,WAAW,CAAC;AAyGxE,qBAAa,gBAAiB,SAAQ,IAAI;;IAYxC,6HAA6H;IAC7H,IAAI,IAAI,IAAI,SAAS,CASpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAIvB;IAED,iBAAiB,IAAI,IAAI;IAazB,oBAAoB,IAAI,IAAI;CAygB7B;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"}
|