@odla-ai/chapter 0.22.1 → 0.23.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 +99 -26
- package/dist/chunk-NTZSXAFT.js +411 -0
- package/dist/chunk-NTZSXAFT.js.map +1 -0
- package/dist/{chunk-4COPR4SY.js → chunk-OYXNI6VR.js} +266 -84
- package/dist/chunk-OYXNI6VR.js.map +1 -0
- package/dist/{chunk-C4XQSRW7.js → chunk-VCC4S6JU.js} +199 -171
- package/dist/chunk-VCC4S6JU.js.map +1 -0
- package/dist/{types-CgWUQ2MH.d.ts → copy-context-pDogTR4x.d.ts} +78 -20
- package/dist/index.cjs +322 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -24
- package/dist/index.d.ts +90 -24
- package/dist/index.js +322 -3
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +5 -2
- package/dist/ui/admin/index.js +8 -3
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +11 -5
- package/dist/ui/member/index.d.ts +118 -2
- package/dist/ui/member/index.js +10 -4
- package/dist/worker/index.cjs +180 -130
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +67 -19
- package/dist/worker/index.d.ts +67 -19
- package/dist/worker/index.js +180 -130
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/runbooks/adopt-existing.md +23 -5
- package/runbooks/greenfield.md +85 -4
- package/dist/chunk-3QKGKUTX.js +0 -91
- package/dist/chunk-3QKGKUTX.js.map +0 -1
- package/dist/chunk-4COPR4SY.js.map +0 -1
- package/dist/chunk-C4XQSRW7.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
DEFAULT_CHAPTER_COPY: () => DEFAULT_CHAPTER_COPY,
|
|
23
24
|
DEFAULT_SHARE_FIELDS: () => DEFAULT_SHARE_FIELDS,
|
|
24
25
|
SCHEDULING_DEFAULTS: () => SCHEDULING_DEFAULTS,
|
|
25
26
|
applicantProfile: () => applicantProfile,
|
|
@@ -35,6 +36,7 @@ __export(index_exports, {
|
|
|
35
36
|
canChangeRole: () => canChangeRole,
|
|
36
37
|
canTransition: () => canTransition,
|
|
37
38
|
canceledPatch: () => canceledPatch,
|
|
39
|
+
chapterBrandFromTokens: () => chapterBrandFromTokens,
|
|
38
40
|
chapterDb: () => chapterDb,
|
|
39
41
|
clampArray: () => clampArray,
|
|
40
42
|
clerkGetUser: () => clerkGetUser,
|
|
@@ -54,6 +56,7 @@ __export(index_exports, {
|
|
|
54
56
|
endForSlot: () => endForSlot,
|
|
55
57
|
findApplicationRef: () => findApplicationRef,
|
|
56
58
|
firstPaymentPatch: () => firstPaymentPatch,
|
|
59
|
+
formatChapterCopy: () => formatChapterCopy,
|
|
57
60
|
getVaultSecret: () => getVaultSecret,
|
|
58
61
|
hasDisclaimerAck: () => hasDisclaimerAck,
|
|
59
62
|
introIdempotencyKey: () => introIdempotencyKey,
|
|
@@ -83,6 +86,7 @@ __export(index_exports, {
|
|
|
83
86
|
renewalPatch: () => renewalPatch,
|
|
84
87
|
resolveApplication: () => resolveApplication,
|
|
85
88
|
resolveAuth: () => resolveAuth,
|
|
89
|
+
resolveChapterCopy: () => resolveChapterCopy,
|
|
86
90
|
resolvePipeline: () => resolvePipeline,
|
|
87
91
|
resolveScheduling: () => resolveScheduling,
|
|
88
92
|
roleFromClaim: () => roleFromClaim,
|
|
@@ -506,8 +510,8 @@ function resolveApplication(a) {
|
|
|
506
510
|
maxLen: a?.maxLen ?? {},
|
|
507
511
|
defaultMaxLen: a?.defaultMaxLen ?? 2e3,
|
|
508
512
|
bodyCap: a?.bodyCap ?? 32768,
|
|
509
|
-
requireDisclaimerAck: a?.requireDisclaimerAck ??
|
|
510
|
-
profileFields: a?.profileFields ??
|
|
513
|
+
requireDisclaimerAck: a?.requireDisclaimerAck ?? true,
|
|
514
|
+
profileFields: a?.profileFields ?? [],
|
|
511
515
|
crmFields: a?.crmFields ?? [],
|
|
512
516
|
maxArrayLen: a?.maxArrayLen ?? 100,
|
|
513
517
|
validateEmail: a?.validateEmail ?? true
|
|
@@ -527,7 +531,7 @@ function hasDisclaimerAck(fields) {
|
|
|
527
531
|
var IDENTITY_FIELDS = /* @__PURE__ */ new Set(["email", "firstName", "lastName"]);
|
|
528
532
|
function applicantProfile(chapter, fields) {
|
|
529
533
|
const app = chapter.application;
|
|
530
|
-
const allowed = (f) => app.profileFields
|
|
534
|
+
const allowed = (f) => app.profileFields.includes(f);
|
|
531
535
|
const profile = {};
|
|
532
536
|
for (const f of [...app.required, ...app.optional]) {
|
|
533
537
|
if (IDENTITY_FIELDS.has(f) || !allowed(f)) continue;
|
|
@@ -584,6 +588,299 @@ function joinConfig(group, paymentsReady2) {
|
|
|
584
588
|
};
|
|
585
589
|
}
|
|
586
590
|
|
|
591
|
+
// src/copy-defaults-admin.ts
|
|
592
|
+
var DEFAULT_ADMIN_COPY = {
|
|
593
|
+
auth: {
|
|
594
|
+
checking: "Checking access\u2026",
|
|
595
|
+
notAuthorized: "Not authorized",
|
|
596
|
+
accountNotAuthorized: "{account} isn't on the admin list.",
|
|
597
|
+
thisAccount: "This account",
|
|
598
|
+
signOut: "Sign out",
|
|
599
|
+
loading: "Loading\u2026",
|
|
600
|
+
signInNotConfigured: "Sign-in not configured",
|
|
601
|
+
missingPublishableKey: "No Clerk publishable key is set for this environment yet.",
|
|
602
|
+
noWorkspaces: "No admin workspaces are configured.",
|
|
603
|
+
signInTagline: "Admin sign-in, invite only"
|
|
604
|
+
},
|
|
605
|
+
shell: {
|
|
606
|
+
adminRole: "admin",
|
|
607
|
+
adminConsole: "Admin Console",
|
|
608
|
+
adminName: "Admin",
|
|
609
|
+
navigationLabel: "Admin navigation"
|
|
610
|
+
},
|
|
611
|
+
workspaces: {
|
|
612
|
+
dashboard: "Dashboard",
|
|
613
|
+
overview: "Overview",
|
|
614
|
+
billing: "Billing",
|
|
615
|
+
people: "People",
|
|
616
|
+
settings: "Settings",
|
|
617
|
+
calendar: "Calendar",
|
|
618
|
+
email: "Email",
|
|
619
|
+
dashboardViewsLabel: "Dashboard views",
|
|
620
|
+
settingsViewsLabel: "Settings views",
|
|
621
|
+
collectionsLabel: "CRM collections"
|
|
622
|
+
},
|
|
623
|
+
dashboard: {
|
|
624
|
+
loading: "Loading dashboard\u2026",
|
|
625
|
+
loadFailed: "Couldn't load the dashboard",
|
|
626
|
+
upcomingCalls: "Upcoming calls",
|
|
627
|
+
callsNeedAttention: "{count} need attention",
|
|
628
|
+
noUpcomingCalls: "No upcoming calls.",
|
|
629
|
+
drift: "drift",
|
|
630
|
+
open: "Open",
|
|
631
|
+
meet: "Meet",
|
|
632
|
+
applications: "Applications",
|
|
633
|
+
newMembers: "New members",
|
|
634
|
+
newMembersUnavailable: "Appears once billing is connected.",
|
|
635
|
+
revenueAdded: "Revenue \xB7 annual run rate added",
|
|
636
|
+
revenue: "Revenue",
|
|
637
|
+
revenueUnavailable: "Appears once billing is connected.",
|
|
638
|
+
pipeline: "Pipeline",
|
|
639
|
+
pipelineLabel: "Membership pipeline",
|
|
640
|
+
thisWeek: "+{count} this week",
|
|
641
|
+
noChange: "no change",
|
|
642
|
+
activeMemberships: "Active memberships",
|
|
643
|
+
annualRunRate: "Annual run rate",
|
|
644
|
+
testMode: "test mode"
|
|
645
|
+
},
|
|
646
|
+
billing: {
|
|
647
|
+
loading: "Loading\u2026",
|
|
648
|
+
loadFailed: "Couldn't load billing",
|
|
649
|
+
notConfigured: "Billing isn't configured. No Stripe key is vaulted for this group.",
|
|
650
|
+
active: "Active",
|
|
651
|
+
annualized: "Annualized",
|
|
652
|
+
renewingSoon: "Renewing within 60 days",
|
|
653
|
+
pastDue: "Past due",
|
|
654
|
+
subscriptions: "Subscriptions",
|
|
655
|
+
testMode: "Stripe test mode",
|
|
656
|
+
truncated: "Showing the first 100 subscriptions. The list is truncated.",
|
|
657
|
+
name: "Name",
|
|
658
|
+
email: "Email",
|
|
659
|
+
application: "Application",
|
|
660
|
+
subscription: "Subscription",
|
|
661
|
+
cancelling: "cancelling",
|
|
662
|
+
amount: "Amount",
|
|
663
|
+
renews: "Renews"
|
|
664
|
+
},
|
|
665
|
+
availability: {
|
|
666
|
+
loading: "Loading\u2026",
|
|
667
|
+
loadFailed: "Couldn't load availability",
|
|
668
|
+
saved: "Saved.",
|
|
669
|
+
title: "Booking availability",
|
|
670
|
+
days: "Days",
|
|
671
|
+
startHour: "Start hour (0\u201324)",
|
|
672
|
+
endHour: "End hour (0\u201324)",
|
|
673
|
+
slotMinutes: "Slot length (minutes)",
|
|
674
|
+
minNoticeHours: "Minimum notice (hours)",
|
|
675
|
+
windowDays: "Booking window (days)",
|
|
676
|
+
timezone: "Timezone",
|
|
677
|
+
summaryTemplate: "Event summary template",
|
|
678
|
+
save: "Save availability",
|
|
679
|
+
dayLabels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
|
680
|
+
},
|
|
681
|
+
email: {
|
|
682
|
+
loading: "Loading\u2026",
|
|
683
|
+
loadFailed: "Couldn't load email config",
|
|
684
|
+
saved: "Saved.",
|
|
685
|
+
sent: "Sent {template} to {address}{redirected}.",
|
|
686
|
+
testFailed: "Test send did not deliver.",
|
|
687
|
+
delivery: "Delivery",
|
|
688
|
+
notificationAddress: "Notification address",
|
|
689
|
+
replyTo: "Reply-to",
|
|
690
|
+
debugInbox: "Debug inbox",
|
|
691
|
+
debugInboxHint: "Non-production sends redirect here.",
|
|
692
|
+
sendTest: "Send test",
|
|
693
|
+
enabled: "Enabled",
|
|
694
|
+
subject: "Subject",
|
|
695
|
+
body: "Body",
|
|
696
|
+
save: "Save changes",
|
|
697
|
+
sendLog: "Send log",
|
|
698
|
+
sentColumn: "Sent",
|
|
699
|
+
templateColumn: "Template",
|
|
700
|
+
statusColumn: "Status",
|
|
701
|
+
toColumn: "To",
|
|
702
|
+
failed: "failed",
|
|
703
|
+
redirected: "redirected",
|
|
704
|
+
delivered: "delivered"
|
|
705
|
+
},
|
|
706
|
+
meetings: {
|
|
707
|
+
loading: "Loading\u2026",
|
|
708
|
+
loadFailed: "Couldn't load meetings",
|
|
709
|
+
cancelConfirm: "Cancel this call? The calendar provider notifies the attendee.",
|
|
710
|
+
newStartPrompt: "New start time (for example, 2026-08-01 14:00):",
|
|
711
|
+
parseFailed: "Couldn't parse that time.",
|
|
712
|
+
agenda: "Agenda",
|
|
713
|
+
empty: "No meetings.",
|
|
714
|
+
unknown: "(unknown)",
|
|
715
|
+
drift: "drift",
|
|
716
|
+
meet: "Meet",
|
|
717
|
+
reschedule: "Reschedule",
|
|
718
|
+
cancel: "Cancel"
|
|
719
|
+
},
|
|
720
|
+
network: {
|
|
721
|
+
title: "Share to a follower",
|
|
722
|
+
allowlistDescription: "Sends the target's allowlisted fields. Its pipeline and account state remain local.",
|
|
723
|
+
sharing: "Sharing\u2026",
|
|
724
|
+
shareWith: "Share with {target}",
|
|
725
|
+
shared: "Shared with {target}.",
|
|
726
|
+
shareFailed: "Could not share with {target}.",
|
|
727
|
+
deliveryFailed: "Delivery failed."
|
|
728
|
+
},
|
|
729
|
+
records: {
|
|
730
|
+
workflowMissing: "This record is not linked to an application workflow.",
|
|
731
|
+
comms: "Comms",
|
|
732
|
+
commsHistory: "Comms history",
|
|
733
|
+
scheduling: "Scheduling",
|
|
734
|
+
billing: "Billing",
|
|
735
|
+
notes: "Notes",
|
|
736
|
+
access: "Access",
|
|
737
|
+
sharing: "Sharing",
|
|
738
|
+
lifecycle: "Access & lifecycle",
|
|
739
|
+
role: "Role",
|
|
740
|
+
superAdminHint: "Super-admin, managed in odla Studio.",
|
|
741
|
+
noAccount: "No linked account yet. The role is set once they sign in.",
|
|
742
|
+
approve: "Approve",
|
|
743
|
+
refund: "Refund",
|
|
744
|
+
approved: "Approved.",
|
|
745
|
+
refunded: "Refund issued.",
|
|
746
|
+
roleSet: "Role set to {role}.",
|
|
747
|
+
messageSent: "Message sent.",
|
|
748
|
+
messageNotSent: "Message was not sent.",
|
|
749
|
+
loadingTemplates: "Loading templates\u2026",
|
|
750
|
+
template: "Template",
|
|
751
|
+
chooseTemplate: "Choose a template\u2026",
|
|
752
|
+
sending: "Sending\u2026",
|
|
753
|
+
send: "Send",
|
|
754
|
+
noMessages: "No messages recorded.",
|
|
755
|
+
message: "Message",
|
|
756
|
+
newStartPrompt: "New start time:",
|
|
757
|
+
parseFailed: "Couldn't parse that time.",
|
|
758
|
+
cancelConfirm: "Cancel this call?",
|
|
759
|
+
callCancelled: "Call cancelled.",
|
|
760
|
+
callRescheduled: "Call rescheduled.",
|
|
761
|
+
noApplication: "No application is linked to this record.",
|
|
762
|
+
loadingMeetings: "Loading meetings\u2026",
|
|
763
|
+
noMeetings: "No meetings recorded.",
|
|
764
|
+
joinMeeting: "Join meeting",
|
|
765
|
+
openCalendar: "Open calendar",
|
|
766
|
+
reschedule: "Reschedule",
|
|
767
|
+
cancel: "Cancel"
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
// src/copy-defaults.ts
|
|
772
|
+
var DEFAULT_COMMON_COPY = {
|
|
773
|
+
loading: "Loading\u2026",
|
|
774
|
+
saved: "Saved.",
|
|
775
|
+
unknown: "(unknown)"
|
|
776
|
+
};
|
|
777
|
+
var DEFAULT_JOIN_COPY = {
|
|
778
|
+
form: {
|
|
779
|
+
submit: "Submit application",
|
|
780
|
+
submitting: "Submitting\u2026",
|
|
781
|
+
submitFailed: "Your application could not be submitted.",
|
|
782
|
+
unexpectedFailure: "Something went wrong. Please try again."
|
|
783
|
+
},
|
|
784
|
+
booking: {
|
|
785
|
+
unavailable: "Scheduling is briefly unavailable. We'll reach out by email to arrange your call.",
|
|
786
|
+
loadFailed: "Times are briefly unavailable. Please try again.",
|
|
787
|
+
slotTaken: "That time was just taken. Here are the current openings.",
|
|
788
|
+
failed: "The booking could not be completed.",
|
|
789
|
+
loading: "Loading available times\u2026",
|
|
790
|
+
book: "Book this time",
|
|
791
|
+
booking: "Booking\u2026"
|
|
792
|
+
},
|
|
793
|
+
payment: {
|
|
794
|
+
setupFailed: "Payment could not be set up. Please try again.",
|
|
795
|
+
preparing: "Preparing secure payment\u2026",
|
|
796
|
+
pending: "Confirming your payment\u2026",
|
|
797
|
+
processing: "Processing\u2026",
|
|
798
|
+
payAndContinue: "Pay and continue",
|
|
799
|
+
incomplete: "The payment did not complete. Please try again."
|
|
800
|
+
},
|
|
801
|
+
done: {
|
|
802
|
+
label: "You're booked",
|
|
803
|
+
calendarInvite: "A calendar invitation with the video call link is on its way to your email.",
|
|
804
|
+
memberArea: "Go to your member area"
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
var DEFAULT_MEMBERS_COPY = {
|
|
808
|
+
loadFailed: "Sign in is briefly unavailable. Please refresh.",
|
|
809
|
+
account: {
|
|
810
|
+
signOut: "Sign out",
|
|
811
|
+
adminConsole: "Admin console"
|
|
812
|
+
},
|
|
813
|
+
provisional: {
|
|
814
|
+
cardLabel: "Your Application",
|
|
815
|
+
applicationNeeded: "One step remains",
|
|
816
|
+
applicationNeededBody: "Your account is ready, and the application that completes it takes a few minutes.",
|
|
817
|
+
apply: "Apply for membership",
|
|
818
|
+
refunded: "Membership refunded",
|
|
819
|
+
refundedBody: "Your fee has been refunded in full and your membership is canceled.",
|
|
820
|
+
active: "Your membership is active.",
|
|
821
|
+
renews: "Your membership is active and renews {date}.",
|
|
822
|
+
introductionCall: "Your introduction call",
|
|
823
|
+
calendarInvite: "A calendar invitation with the video call link is in your email.",
|
|
824
|
+
joinCall: "Join the video call",
|
|
825
|
+
bookCall: "Book your introduction call",
|
|
826
|
+
bookCallBody: "Your application is in. Choose a time below, and a calendar invitation will reach your email.",
|
|
827
|
+
chooseTime: "Choose a time"
|
|
828
|
+
},
|
|
829
|
+
full: {
|
|
830
|
+
welcome: "Welcome back."
|
|
831
|
+
},
|
|
832
|
+
reschedule: {
|
|
833
|
+
changeTime: "Change your time",
|
|
834
|
+
unavailable: "Scheduling is briefly unavailable. We'll reach out by email to arrange your call.",
|
|
835
|
+
loadFailed: "Times are briefly unavailable. Please try again.",
|
|
836
|
+
slotGone: "That time is no longer available. Please pick another.",
|
|
837
|
+
loading: "Loading available times\u2026",
|
|
838
|
+
noTimes: "No open times right now. Please check back soon.",
|
|
839
|
+
rescheduling: "Rescheduling\u2026",
|
|
840
|
+
keepTime: "Keep my current time"
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
// src/copy-resolve.ts
|
|
845
|
+
var DEFAULT_CHAPTER_COPY = {
|
|
846
|
+
common: DEFAULT_COMMON_COPY,
|
|
847
|
+
join: DEFAULT_JOIN_COPY,
|
|
848
|
+
members: DEFAULT_MEMBERS_COPY,
|
|
849
|
+
admin: DEFAULT_ADMIN_COPY
|
|
850
|
+
};
|
|
851
|
+
var isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
852
|
+
function mergeCopy(base, input, path) {
|
|
853
|
+
if (typeof base === "string") {
|
|
854
|
+
if (input === void 0) return base;
|
|
855
|
+
if (typeof input !== "string") throw new Error(`${path}: must be a string`);
|
|
856
|
+
return input;
|
|
857
|
+
}
|
|
858
|
+
if (Array.isArray(base)) {
|
|
859
|
+
if (input === void 0) return [...base];
|
|
860
|
+
if (!Array.isArray(input) || !input.every((item) => typeof item === "string")) {
|
|
861
|
+
throw new Error(`${path}: must be an array of strings`);
|
|
862
|
+
}
|
|
863
|
+
return [...input];
|
|
864
|
+
}
|
|
865
|
+
if (!isObject(base)) return base;
|
|
866
|
+
if (input !== void 0 && !isObject(input)) throw new Error(`${path}: must be an object`);
|
|
867
|
+
const overrides = input;
|
|
868
|
+
const result = {};
|
|
869
|
+
for (const [key, value] of Object.entries(base)) {
|
|
870
|
+
result[key] = mergeCopy(value, overrides?.[key], `${path}.${key}`);
|
|
871
|
+
}
|
|
872
|
+
return result;
|
|
873
|
+
}
|
|
874
|
+
function resolveChapterCopy(input) {
|
|
875
|
+
return mergeCopy(DEFAULT_CHAPTER_COPY, input, "defineChapter.copy");
|
|
876
|
+
}
|
|
877
|
+
function formatChapterCopy(template, values) {
|
|
878
|
+
return template.replace(
|
|
879
|
+
/\{([a-zA-Z][a-zA-Z0-9]*)\}/g,
|
|
880
|
+
(match, key) => Object.prototype.hasOwnProperty.call(values, key) ? String(values[key]) : match
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
|
|
587
884
|
// src/config.ts
|
|
588
885
|
var SLUG = /^[a-z0-9][a-z0-9-]{1,62}$/;
|
|
589
886
|
var FIELD = /^[a-z][a-zA-Z0-9_]*$/;
|
|
@@ -662,11 +959,15 @@ function defineChapter(config) {
|
|
|
662
959
|
if (!config.prices || typeof config.prices.standardCents !== "number") {
|
|
663
960
|
throw new Error("defineChapter.prices.standardCents: required in chapter mode");
|
|
664
961
|
}
|
|
962
|
+
if (config.account === void 0) {
|
|
963
|
+
throw new Error('defineChapter.account: required in chapter mode; choose "none", "create", or "invite" explicitly');
|
|
964
|
+
}
|
|
665
965
|
}
|
|
666
966
|
const auth = resolveAuth(mode, config.auth);
|
|
667
967
|
const pipeline = resolvePipeline(config.pipeline);
|
|
668
968
|
const application = resolveApplication(config.application);
|
|
669
969
|
const brand = { ...config.brand, wordmark: config.brand?.wordmark ?? name };
|
|
970
|
+
const copy = resolveChapterCopy(config.copy);
|
|
670
971
|
const network = resolveNetwork(config, crm);
|
|
671
972
|
const { schema, rules } = chapterDb(mode, auth);
|
|
672
973
|
const services = config.services ?? ["db", "calendar", "o11y"];
|
|
@@ -721,6 +1022,7 @@ function defineChapter(config) {
|
|
|
721
1022
|
name,
|
|
722
1023
|
mode,
|
|
723
1024
|
brand,
|
|
1025
|
+
copy,
|
|
724
1026
|
network,
|
|
725
1027
|
crm,
|
|
726
1028
|
auth,
|
|
@@ -1542,6 +1844,7 @@ function brandTokens(brand, options = {}) {
|
|
|
1542
1844
|
if (fonts?.body) light.push(`--ui-font-sans: ${cleanValue(fonts.body)};`);
|
|
1543
1845
|
if (fonts?.numeral) light.push(`--ui-font-numeral: ${cleanValue(fonts.numeral)};`);
|
|
1544
1846
|
const dark = [...paletteDecls(brand.paletteDark), ...semanticDecls(brand.tokensDark)];
|
|
1847
|
+
const invert = paletteDecls(brand.paletteInvert);
|
|
1545
1848
|
const selector = options.selector ?? ":root";
|
|
1546
1849
|
const darkSelector = selector === ":root" ? ':root[data-theme="dark"]' : `${selector}[data-theme="dark"]`;
|
|
1547
1850
|
const systemSelector = selector === ":root" ? ':root:not([data-theme="light"])' : `${selector}:not([data-theme="light"])`;
|
|
@@ -1557,10 +1860,26 @@ function brandTokens(brand, options = {}) {
|
|
|
1557
1860
|
@media (prefers-color-scheme: dark) {
|
|
1558
1861
|
${systemSelector} ${block}
|
|
1559
1862
|
}
|
|
1863
|
+
`;
|
|
1864
|
+
}
|
|
1865
|
+
if (invert.length) {
|
|
1866
|
+
const invertSelector = selector === ":root" ? ".ui-invert" : `${selector}.ui-invert, ${selector} .ui-invert`;
|
|
1867
|
+
css += `${invertSelector} {
|
|
1868
|
+
color-scheme: dark;
|
|
1869
|
+
${invert.join("\n ")}
|
|
1870
|
+
}
|
|
1560
1871
|
`;
|
|
1561
1872
|
}
|
|
1562
1873
|
return css;
|
|
1563
1874
|
}
|
|
1875
|
+
function chapterBrandFromTokens(compiled, base = {}) {
|
|
1876
|
+
return {
|
|
1877
|
+
...base,
|
|
1878
|
+
palette: { ...compiled.light, ...base.palette },
|
|
1879
|
+
paletteDark: { ...compiled.dark, ...base.paletteDark },
|
|
1880
|
+
paletteInvert: { ...compiled.dark, ...base.paletteInvert }
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1564
1883
|
|
|
1565
1884
|
// src/reconcile.ts
|
|
1566
1885
|
function isReconcilable(meeting, now) {
|