@velocity-astro/cms-admin 0.0.0-stage → 0.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/app-directory.d.mts +2 -0
- package/app-directory.mjs +8 -0
- package/app-dist/assets/RichTextEditor-Ci93Tlgw.js +135 -0
- package/app-dist/assets/index-CczBKhBz.css +2 -0
- package/app-dist/assets/index-DOIcFJow.js +80 -0
- package/app-dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/app-dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/app-dist/assets/manrope-cyrillic-wght-normal-Dvxsihut.woff2 +0 -0
- package/app-dist/assets/manrope-greek-wght-normal-DL7QRZyv.woff2 +0 -0
- package/app-dist/assets/manrope-latin-ext-wght-normal-Ch3YOpNY.woff2 +0 -0
- package/app-dist/assets/manrope-latin-wght-normal-DHIcAJRg.woff2 +0 -0
- package/app-dist/assets/manrope-vietnamese-wght-normal-usUDDRr7.woff2 +0 -0
- package/app-dist/assets/outfit-latin-ext-wght-normal-DdQaqQDo.woff2 +0 -0
- package/app-dist/assets/outfit-latin-wght-normal-Bc-8i84L.woff2 +0 -0
- package/app-dist/index.html +15 -0
- package/dist/app/AdminApp.d.ts +34 -0
- package/dist/app/AdminApp.d.ts.map +1 -0
- package/dist/app/AdminApp.js +26 -0
- package/dist/app/AdminApp.js.map +1 -0
- package/dist/app/AdminLayout.d.ts +7 -0
- package/dist/app/AdminLayout.d.ts.map +1 -0
- package/dist/app/AdminLayout.js +128 -0
- package/dist/app/AdminLayout.js.map +1 -0
- package/dist/app/NavigationBridge.d.ts +6 -0
- package/dist/app/NavigationBridge.d.ts.map +1 -0
- package/dist/app/NavigationBridge.js +15 -0
- package/dist/app/NavigationBridge.js.map +1 -0
- package/dist/app/PasskeysDialog.d.ts +5 -0
- package/dist/app/PasskeysDialog.d.ts.map +1 -0
- package/dist/app/PasskeysDialog.js +51 -0
- package/dist/app/PasskeysDialog.js.map +1 -0
- package/dist/app/RequestState.d.ts +20 -0
- package/dist/app/RequestState.d.ts.map +1 -0
- package/dist/app/RequestState.js +33 -0
- package/dist/app/RequestState.js.map +1 -0
- package/dist/app/paths.d.ts +29 -0
- package/dist/app/paths.d.ts.map +1 -0
- package/dist/app/paths.js +29 -0
- package/dist/app/paths.js.map +1 -0
- package/dist/app/routes.d.ts +4 -0
- package/dist/app/routes.d.ts.map +1 -0
- package/dist/app/routes.js +53 -0
- package/dist/app/routes.js.map +1 -0
- package/dist/app/use-go.d.ts +7 -0
- package/dist/app/use-go.d.ts.map +1 -0
- package/dist/app/use-go.js +11 -0
- package/dist/app/use-go.js.map +1 -0
- package/dist/client/admin-client.d.ts +317 -0
- package/dist/client/admin-client.d.ts.map +1 -0
- package/dist/client/admin-client.js +2 -0
- package/dist/client/admin-client.js.map +1 -0
- package/dist/client/client-context.d.ts +10 -0
- package/dist/client/client-context.d.ts.map +1 -0
- package/dist/client/client-context.js +14 -0
- package/dist/client/client-context.js.map +1 -0
- package/dist/client/errors.d.ts +22 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +17 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/http-client.d.ts +122 -0
- package/dist/client/http-client.d.ts.map +1 -0
- package/dist/client/http-client.js +366 -0
- package/dist/client/http-client.js.map +1 -0
- package/dist/client/queries.d.ts +213 -0
- package/dist/client/queries.d.ts.map +1 -0
- package/dist/client/queries.js +672 -0
- package/dist/client/queries.js.map +1 -0
- package/dist/fields/BlocksControl.d.ts +8 -0
- package/dist/fields/BlocksControl.d.ts.map +1 -0
- package/dist/fields/BlocksControl.js +154 -0
- package/dist/fields/BlocksControl.js.map +1 -0
- package/dist/fields/CustomFieldsDialog.d.ts +7 -0
- package/dist/fields/CustomFieldsDialog.d.ts.map +1 -0
- package/dist/fields/CustomFieldsDialog.js +29 -0
- package/dist/fields/CustomFieldsDialog.js.map +1 -0
- package/dist/fields/FieldEditor.d.ts +17 -0
- package/dist/fields/FieldEditor.d.ts.map +1 -0
- package/dist/fields/FieldEditor.js +25 -0
- package/dist/fields/FieldEditor.js.map +1 -0
- package/dist/fields/FieldGrid.d.ts +19 -0
- package/dist/fields/FieldGrid.d.ts.map +1 -0
- package/dist/fields/FieldGrid.js +36 -0
- package/dist/fields/FieldGrid.js.map +1 -0
- package/dist/fields/FieldSetDialog.d.ts +11 -0
- package/dist/fields/FieldSetDialog.d.ts.map +1 -0
- package/dist/fields/FieldSetDialog.js +73 -0
- package/dist/fields/FieldSetDialog.js.map +1 -0
- package/dist/fields/FieldSetEditor.d.ts +9 -0
- package/dist/fields/FieldSetEditor.d.ts.map +1 -0
- package/dist/fields/FieldSetEditor.js +49 -0
- package/dist/fields/FieldSetEditor.js.map +1 -0
- package/dist/fields/FieldSummary.d.ts +9 -0
- package/dist/fields/FieldSummary.d.ts.map +1 -0
- package/dist/fields/FieldSummary.js +28 -0
- package/dist/fields/FieldSummary.js.map +1 -0
- package/dist/fields/LinkControl.d.ts +8 -0
- package/dist/fields/LinkControl.d.ts.map +1 -0
- package/dist/fields/LinkControl.js +54 -0
- package/dist/fields/LinkControl.js.map +1 -0
- package/dist/fields/block-icons.d.ts +4 -0
- package/dist/fields/block-icons.d.ts.map +1 -0
- package/dist/fields/block-icons.js +51 -0
- package/dist/fields/block-icons.js.map +1 -0
- package/dist/fields/controls.d.ts +4 -0
- package/dist/fields/controls.d.ts.map +1 -0
- package/dist/fields/controls.js +292 -0
- package/dist/fields/controls.js.map +1 -0
- package/dist/fields/custom-values.d.ts +23 -0
- package/dist/fields/custom-values.d.ts.map +1 -0
- package/dist/fields/custom-values.js +30 -0
- package/dist/fields/custom-values.js.map +1 -0
- package/dist/fields/field-control.d.ts +72 -0
- package/dist/fields/field-control.d.ts.map +1 -0
- package/dist/fields/field-control.js +19 -0
- package/dist/fields/field-control.js.map +1 -0
- package/dist/fields/field-set.d.ts +39 -0
- package/dist/fields/field-set.d.ts.map +1 -0
- package/dist/fields/field-set.js +24 -0
- package/dist/fields/field-set.js.map +1 -0
- package/dist/fields/index.d.ts +7 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.js +7 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/page-focus.d.ts +23 -0
- package/dist/fields/page-focus.d.ts.map +1 -0
- package/dist/fields/page-focus.js +14 -0
- package/dist/fields/page-focus.js.map +1 -0
- package/dist/fields/settings.d.ts +40 -0
- package/dist/fields/settings.d.ts.map +1 -0
- package/dist/fields/settings.js +92 -0
- package/dist/fields/settings.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/arrangement.d.ts +20 -0
- package/dist/lib/arrangement.d.ts.map +1 -0
- package/dist/lib/arrangement.js +52 -0
- package/dist/lib/arrangement.js.map +1 -0
- package/dist/lib/content.d.ts +45 -0
- package/dist/lib/content.d.ts.map +1 -0
- package/dist/lib/content.js +99 -0
- package/dist/lib/content.js.map +1 -0
- package/dist/lib/csv.d.ts +10 -0
- package/dist/lib/csv.d.ts.map +1 -0
- package/dist/lib/csv.js +54 -0
- package/dist/lib/csv.js.map +1 -0
- package/dist/lib/day-part.d.ts +5 -0
- package/dist/lib/day-part.d.ts.map +1 -0
- package/dist/lib/day-part.js +10 -0
- package/dist/lib/day-part.js.map +1 -0
- package/dist/lib/download.d.ts +6 -0
- package/dist/lib/download.d.ts.map +1 -0
- package/dist/lib/download.js +13 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/keys.d.ts +5 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +26 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +11 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +52 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/preview-tab.d.ts +14 -0
- package/dist/lib/preview-tab.d.ts.map +1 -0
- package/dist/lib/preview-tab.js +24 -0
- package/dist/lib/preview-tab.js.map +1 -0
- package/dist/lib/relative-time.d.ts +3 -0
- package/dist/lib/relative-time.d.ts.map +1 -0
- package/dist/lib/relative-time.js +18 -0
- package/dist/lib/relative-time.js.map +1 -0
- package/dist/lib/slug.d.ts +3 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/slug.js +10 -0
- package/dist/lib/slug.js.map +1 -0
- package/dist/lib/type-icon.d.ts +3 -0
- package/dist/lib/type-icon.d.ts.map +1 -0
- package/dist/lib/type-icon.js +27 -0
- package/dist/lib/type-icon.js.map +1 -0
- package/dist/lib/use-closing.d.ts +19 -0
- package/dist/lib/use-closing.d.ts.map +1 -0
- package/dist/lib/use-closing.js +24 -0
- package/dist/lib/use-closing.js.map +1 -0
- package/dist/lib/use-leave-guard.d.ts +16 -0
- package/dist/lib/use-leave-guard.d.ts.map +1 -0
- package/dist/lib/use-leave-guard.js +29 -0
- package/dist/lib/use-leave-guard.js.map +1 -0
- package/dist/messages/en.d.ts +1068 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +1041 -0
- package/dist/messages/en.js.map +1 -0
- package/dist/messages/messages-context.d.ts +17 -0
- package/dist/messages/messages-context.d.ts.map +1 -0
- package/dist/messages/messages-context.js +16 -0
- package/dist/messages/messages-context.js.map +1 -0
- package/dist/plugins/PluginBoundary.d.ts +21 -0
- package/dist/plugins/PluginBoundary.d.ts.map +1 -0
- package/dist/plugins/PluginBoundary.js +20 -0
- package/dist/plugins/PluginBoundary.js.map +1 -0
- package/dist/plugins/plugin-editor.d.ts +112 -0
- package/dist/plugins/plugin-editor.d.ts.map +1 -0
- package/dist/plugins/plugin-editor.js +142 -0
- package/dist/plugins/plugin-editor.js.map +1 -0
- package/dist/plugins/plugin-ui.d.ts +45 -0
- package/dist/plugins/plugin-ui.d.ts.map +1 -0
- package/dist/plugins/plugin-ui.js +44 -0
- package/dist/plugins/plugin-ui.js.map +1 -0
- package/dist/screens/Contact/ContactDeals.d.ts +6 -0
- package/dist/screens/Contact/ContactDeals.d.ts.map +1 -0
- package/dist/screens/Contact/ContactDeals.js +41 -0
- package/dist/screens/Contact/ContactDeals.js.map +1 -0
- package/dist/screens/Contact/ContactScreen.d.ts +3 -0
- package/dist/screens/Contact/ContactScreen.d.ts.map +1 -0
- package/dist/screens/Contact/ContactScreen.js +153 -0
- package/dist/screens/Contact/ContactScreen.js.map +1 -0
- package/dist/screens/Contact/ContactWork.d.ts +6 -0
- package/dist/screens/Contact/ContactWork.d.ts.map +1 -0
- package/dist/screens/Contact/ContactWork.js +50 -0
- package/dist/screens/Contact/ContactWork.js.map +1 -0
- package/dist/screens/Contacts/ContactsScreen.d.ts +3 -0
- package/dist/screens/Contacts/ContactsScreen.d.ts.map +1 -0
- package/dist/screens/Contacts/ContactsScreen.js +127 -0
- package/dist/screens/Contacts/ContactsScreen.js.map +1 -0
- package/dist/screens/Contacts/ImportDialog.d.ts +5 -0
- package/dist/screens/Contacts/ImportDialog.d.ts.map +1 -0
- package/dist/screens/Contacts/ImportDialog.js +90 -0
- package/dist/screens/Contacts/ImportDialog.js.map +1 -0
- package/dist/screens/Contacts/PipelineBoard.d.ts +11 -0
- package/dist/screens/Contacts/PipelineBoard.d.ts.map +1 -0
- package/dist/screens/Contacts/PipelineBoard.js +74 -0
- package/dist/screens/Contacts/PipelineBoard.js.map +1 -0
- package/dist/screens/Contacts/StagesDialog.d.ts +8 -0
- package/dist/screens/Contacts/StagesDialog.d.ts.map +1 -0
- package/dist/screens/Contacts/StagesDialog.js +58 -0
- package/dist/screens/Contacts/StagesDialog.js.map +1 -0
- package/dist/screens/Contacts/contact-source.d.ts +4 -0
- package/dist/screens/Contacts/contact-source.d.ts.map +1 -0
- package/dist/screens/Contacts/contact-source.js +18 -0
- package/dist/screens/Contacts/contact-source.js.map +1 -0
- package/dist/screens/Contacts/pipeline.d.ts +23 -0
- package/dist/screens/Contacts/pipeline.d.ts.map +1 -0
- package/dist/screens/Contacts/pipeline.js +57 -0
- package/dist/screens/Contacts/pipeline.js.map +1 -0
- package/dist/screens/ContentList/ContentListScreen.d.ts +3 -0
- package/dist/screens/ContentList/ContentListScreen.d.ts.map +1 -0
- package/dist/screens/ContentList/ContentListScreen.js +105 -0
- package/dist/screens/ContentList/ContentListScreen.js.map +1 -0
- package/dist/screens/ContentType/ContentTypeScreen.d.ts +3 -0
- package/dist/screens/ContentType/ContentTypeScreen.d.ts.map +1 -0
- package/dist/screens/ContentType/ContentTypeScreen.js +133 -0
- package/dist/screens/ContentType/ContentTypeScreen.js.map +1 -0
- package/dist/screens/ContentType/FieldDialog.d.ts +12 -0
- package/dist/screens/ContentType/FieldDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/FieldDialog.js +110 -0
- package/dist/screens/ContentType/FieldDialog.js.map +1 -0
- package/dist/screens/ContentType/SectionsDialog.d.ts +7 -0
- package/dist/screens/ContentType/SectionsDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/SectionsDialog.js +67 -0
- package/dist/screens/ContentType/SectionsDialog.js.map +1 -0
- package/dist/screens/ContentType/SettingsDialog.d.ts +7 -0
- package/dist/screens/ContentType/SettingsDialog.d.ts.map +1 -0
- package/dist/screens/ContentType/SettingsDialog.js +75 -0
- package/dist/screens/ContentType/SettingsDialog.js.map +1 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.d.ts +3 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.d.ts.map +1 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.js +103 -0
- package/dist/screens/ContentTypes/ContentTypesScreen.js.map +1 -0
- package/dist/screens/Deals/DealDialog.d.ts +16 -0
- package/dist/screens/Deals/DealDialog.d.ts.map +1 -0
- package/dist/screens/Deals/DealDialog.js +84 -0
- package/dist/screens/Deals/DealDialog.js.map +1 -0
- package/dist/screens/Deals/DealsScreen.d.ts +3 -0
- package/dist/screens/Deals/DealsScreen.d.ts.map +1 -0
- package/dist/screens/Deals/DealsScreen.js +93 -0
- package/dist/screens/Deals/DealsScreen.js.map +1 -0
- package/dist/screens/Deals/deal-subject.d.ts +30 -0
- package/dist/screens/Deals/deal-subject.d.ts.map +1 -0
- package/dist/screens/Deals/deal-subject.js +57 -0
- package/dist/screens/Deals/deal-subject.js.map +1 -0
- package/dist/screens/EntryEditor/EntryDeals.d.ts +11 -0
- package/dist/screens/EntryEditor/EntryDeals.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryDeals.js +45 -0
- package/dist/screens/EntryEditor/EntryDeals.js.map +1 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.d.ts +3 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.js +65 -0
- package/dist/screens/EntryEditor/EntryEditorScreen.js.map +1 -0
- package/dist/screens/EntryEditor/EntryForm.d.ts +22 -0
- package/dist/screens/EntryEditor/EntryForm.d.ts.map +1 -0
- package/dist/screens/EntryEditor/EntryForm.js +279 -0
- package/dist/screens/EntryEditor/EntryForm.js.map +1 -0
- package/dist/screens/EntryEditor/HistoryDialog.d.ts +16 -0
- package/dist/screens/EntryEditor/HistoryDialog.d.ts.map +1 -0
- package/dist/screens/EntryEditor/HistoryDialog.js +52 -0
- package/dist/screens/EntryEditor/HistoryDialog.js.map +1 -0
- package/dist/screens/EntryEditor/PagePane.d.ts +15 -0
- package/dist/screens/EntryEditor/PagePane.d.ts.map +1 -0
- package/dist/screens/EntryEditor/PagePane.js +25 -0
- package/dist/screens/EntryEditor/PagePane.js.map +1 -0
- package/dist/screens/EntryEditor/ScheduleDialog.d.ts +15 -0
- package/dist/screens/EntryEditor/ScheduleDialog.d.ts.map +1 -0
- package/dist/screens/EntryEditor/ScheduleDialog.js +70 -0
- package/dist/screens/EntryEditor/ScheduleDialog.js.map +1 -0
- package/dist/screens/Form/FormFields.d.ts +9 -0
- package/dist/screens/Form/FormFields.d.ts.map +1 -0
- package/dist/screens/Form/FormFields.js +26 -0
- package/dist/screens/Form/FormFields.js.map +1 -0
- package/dist/screens/Form/FormScreen.d.ts +3 -0
- package/dist/screens/Form/FormScreen.d.ts.map +1 -0
- package/dist/screens/Form/FormScreen.js +58 -0
- package/dist/screens/Form/FormScreen.js.map +1 -0
- package/dist/screens/Form/FormSettingsDialog.d.ts +8 -0
- package/dist/screens/Form/FormSettingsDialog.d.ts.map +1 -0
- package/dist/screens/Form/FormSettingsDialog.js +78 -0
- package/dist/screens/Form/FormSettingsDialog.js.map +1 -0
- package/dist/screens/Form/Submissions.d.ts +6 -0
- package/dist/screens/Form/Submissions.d.ts.map +1 -0
- package/dist/screens/Form/Submissions.js +98 -0
- package/dist/screens/Form/Submissions.js.map +1 -0
- package/dist/screens/Form/form-fields.d.ts +3 -0
- package/dist/screens/Form/form-fields.d.ts.map +1 -0
- package/dist/screens/Form/form-fields.js +9 -0
- package/dist/screens/Form/form-fields.js.map +1 -0
- package/dist/screens/Forms/FormsScreen.d.ts +3 -0
- package/dist/screens/Forms/FormsScreen.d.ts.map +1 -0
- package/dist/screens/Forms/FormsScreen.js +139 -0
- package/dist/screens/Forms/FormsScreen.js.map +1 -0
- package/dist/screens/Home/FollowUps.d.ts +8 -0
- package/dist/screens/Home/FollowUps.d.ts.map +1 -0
- package/dist/screens/Home/FollowUps.js +43 -0
- package/dist/screens/Home/FollowUps.js.map +1 -0
- package/dist/screens/Home/HomeScreen.d.ts +6 -0
- package/dist/screens/Home/HomeScreen.d.ts.map +1 -0
- package/dist/screens/Home/HomeScreen.js +67 -0
- package/dist/screens/Home/HomeScreen.js.map +1 -0
- package/dist/screens/Media/MediaScreen.d.ts +3 -0
- package/dist/screens/Media/MediaScreen.d.ts.map +1 -0
- package/dist/screens/Media/MediaScreen.js +71 -0
- package/dist/screens/Media/MediaScreen.js.map +1 -0
- package/dist/screens/People/PeopleScreen.d.ts +3 -0
- package/dist/screens/People/PeopleScreen.d.ts.map +1 -0
- package/dist/screens/People/PeopleScreen.js +78 -0
- package/dist/screens/People/PeopleScreen.js.map +1 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.d.ts +3 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.d.ts.map +1 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.js +16 -0
- package/dist/screens/PluginScreen/PluginScreenScreen.js.map +1 -0
- package/dist/screens/Plugins/PluginActivityDialog.d.ts +7 -0
- package/dist/screens/Plugins/PluginActivityDialog.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginActivityDialog.js +49 -0
- package/dist/screens/Plugins/PluginActivityDialog.js.map +1 -0
- package/dist/screens/Plugins/PluginSecrets.d.ts +7 -0
- package/dist/screens/Plugins/PluginSecrets.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginSecrets.js +44 -0
- package/dist/screens/Plugins/PluginSecrets.js.map +1 -0
- package/dist/screens/Plugins/PluginSettingsDialog.d.ts +7 -0
- package/dist/screens/Plugins/PluginSettingsDialog.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginSettingsDialog.js +46 -0
- package/dist/screens/Plugins/PluginSettingsDialog.js.map +1 -0
- package/dist/screens/Plugins/PluginsScreen.d.ts +3 -0
- package/dist/screens/Plugins/PluginsScreen.d.ts.map +1 -0
- package/dist/screens/Plugins/PluginsScreen.js +68 -0
- package/dist/screens/Plugins/PluginsScreen.js.map +1 -0
- package/dist/screens/SignIn/SignInScreen.d.ts +6 -0
- package/dist/screens/SignIn/SignInScreen.d.ts.map +1 -0
- package/dist/screens/SignIn/SignInScreen.js +52 -0
- package/dist/screens/SignIn/SignInScreen.js.map +1 -0
- package/dist/screens/Trash/TrashScreen.d.ts +3 -0
- package/dist/screens/Trash/TrashScreen.d.ts.map +1 -0
- package/dist/screens/Trash/TrashScreen.js +73 -0
- package/dist/screens/Trash/TrashScreen.js.map +1 -0
- package/dist/standalone/config.d.ts +19 -0
- package/dist/standalone/config.d.ts.map +1 -0
- package/dist/standalone/config.js +20 -0
- package/dist/standalone/config.js.map +1 -0
- package/dist/standalone/main.d.ts +7 -0
- package/dist/standalone/main.d.ts.map +1 -0
- package/dist/standalone/main.js +26 -0
- package/dist/standalone/main.js.map +1 -0
- package/dist/testing/admin-client-contract.d.ts +24 -0
- package/dist/testing/admin-client-contract.d.ts.map +1 -0
- package/dist/testing/admin-client-contract.js +571 -0
- package/dist/testing/admin-client-contract.js.map +1 -0
- package/dist/testing/http-server.d.ts +18 -0
- package/dist/testing/http-server.d.ts.map +1 -0
- package/dist/testing/http-server.js +51 -0
- package/dist/testing/http-server.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/memory-client.d.ts +142 -0
- package/dist/testing/memory-client.d.ts.map +1 -0
- package/dist/testing/memory-client.js +401 -0
- package/dist/testing/memory-client.js.map +1 -0
- package/dist/testing/memory-people.d.ts +18 -0
- package/dist/testing/memory-people.d.ts.map +1 -0
- package/dist/testing/memory-people.js +70 -0
- package/dist/testing/memory-people.js.map +1 -0
- package/dist/testing/render-app.d.ts +8 -0
- package/dist/testing/render-app.d.ts.map +1 -0
- package/dist/testing/render-app.js +10 -0
- package/dist/testing/render-app.js.map +1 -0
- package/dist/testing/sample-content.d.ts +23 -0
- package/dist/testing/sample-content.d.ts.map +1 -0
- package/dist/testing/sample-content.js +225 -0
- package/dist/testing/sample-content.js.map +1 -0
- package/package.json +70 -3
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { liveFields } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The key of the place for fields that no section shows. */
|
|
3
|
+
export const NO_SECTION = '';
|
|
4
|
+
/** A type's live fields in the order the editor shows them: each section's, then the rest. */
|
|
5
|
+
export function placesOf(type) {
|
|
6
|
+
const live = new Map(liveFields(type.fields).map((field) => [field.id, field]));
|
|
7
|
+
const sections = (type.sections ?? []).map((section) => ({
|
|
8
|
+
key: section.key,
|
|
9
|
+
fields: section.fieldIds.flatMap((id) => live.get(id) ?? []),
|
|
10
|
+
}));
|
|
11
|
+
const shown = new Set(sections.flatMap((section) => section.fields.map((field) => field.id)));
|
|
12
|
+
return [...sections, { key: NO_SECTION, fields: [...live.values()].filter((field) => !shown.has(field.id)) }];
|
|
13
|
+
}
|
|
14
|
+
/** The section that shows a field, or `NO_SECTION`. */
|
|
15
|
+
export function placeOf(type, fieldId) {
|
|
16
|
+
return type.sections?.find((section) => section.fieldIds.includes(fieldId))?.key ?? NO_SECTION;
|
|
17
|
+
}
|
|
18
|
+
function arrangementOf(places) {
|
|
19
|
+
return {
|
|
20
|
+
order: places.flatMap((place) => place.ids),
|
|
21
|
+
sections: Object.fromEntries(places.filter((place) => place.key !== NO_SECTION).map((place) => [place.key, place.ids])),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The arrangement with one field a step earlier (`-1`) or later (`1`) among the fields it is shown with. */
|
|
25
|
+
export function moved(type, fieldId, by) {
|
|
26
|
+
return arrangementOf(placesOf(type).map((place) => {
|
|
27
|
+
const ids = place.fields.map((field) => field.id);
|
|
28
|
+
const from = ids.indexOf(fieldId);
|
|
29
|
+
const to = from + by;
|
|
30
|
+
if (from === -1 || to < 0 || to >= ids.length)
|
|
31
|
+
return { key: place.key, ids };
|
|
32
|
+
ids.splice(to, 0, ...ids.splice(from, 1));
|
|
33
|
+
return { key: place.key, ids };
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
/** The arrangement with one field at the end of another section, or of the fields in none. */
|
|
37
|
+
export function placed(type, fieldId, key) {
|
|
38
|
+
return arrangementOf(placesOf(type).map((place) => {
|
|
39
|
+
const ids = place.fields.map((field) => field.id).filter((id) => id !== fieldId);
|
|
40
|
+
return { key: place.key, ids: place.key === key ? [...ids, fieldId] : ids };
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
/** The fields a group holds, with one a step earlier (`-1`) or later (`1`). */
|
|
44
|
+
export function movedWithin(fields, fieldId, by, within) {
|
|
45
|
+
const order = liveFields([...fields]).map((field) => field.id);
|
|
46
|
+
const from = order.indexOf(fieldId);
|
|
47
|
+
const to = from + by;
|
|
48
|
+
if (from !== -1 && to >= 0 && to < order.length)
|
|
49
|
+
order.splice(to, 0, ...order.splice(from, 1));
|
|
50
|
+
return { order, within };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=arrangement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrangement.js","sourceRoot":"","sources":["../../src/lib/arrangement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6D,MAAM,0BAA0B,CAAC;AAEjH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAS7B,8FAA8F;AAC9F,MAAM,UAAU,QAAQ,CAAC,IAAoB;IAC3C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvD,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;KAC7D,CAAC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CAAC,GAAG,EAAE,CAAC;IAC9E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,MAA2B,EAAE,OAAe,EAAE,EAAU,EAAE,MAAyB;IAC7G,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,IAAI,GAAG,EAAE,CAAC;IACrB,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ContentTypeDef, type Entry, type EntryData, type FieldDef, type LocalizedText } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The text for a language, falling back to its base language (`es` for `es-ES`), then to any. */
|
|
3
|
+
export declare function localized(text: LocalizedText, locale: string): string;
|
|
4
|
+
/** A language's name in the reader's own language: `Spanish` for `es`. The tag itself if it has no name. */
|
|
5
|
+
export declare function languageName(tag: string, locale: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* What to call an entry in a list: the value of the field its content type names, or of its
|
|
8
|
+
* first text field when the type names none. `null` when that is empty.
|
|
9
|
+
*/
|
|
10
|
+
export declare function entryTitle(type: ContentTypeDef, data: EntryData): string | null;
|
|
11
|
+
/** A field of a type and its value in an entry, found by a path of field ids from the top down. */
|
|
12
|
+
export declare function fieldAt(type: ContentTypeDef, data: EntryData, path: readonly string[]): {
|
|
13
|
+
readonly field: FieldDef;
|
|
14
|
+
readonly value: unknown;
|
|
15
|
+
} | null;
|
|
16
|
+
/**
|
|
17
|
+
* The name of the image a list shows for an entry, from the field its type names. For a field
|
|
18
|
+
* that holds several images, the first.
|
|
19
|
+
*/
|
|
20
|
+
export declare function entryImage(type: ContentTypeDef, data: EntryData): string | null;
|
|
21
|
+
/** Where an entry stands, as the editor shows it. */
|
|
22
|
+
export type EntryState = 'draft' | 'scheduled' | 'published' | 'unpublishedChanges';
|
|
23
|
+
export declare function entryState(entry: Entry): EntryState;
|
|
24
|
+
/** A copy of field values with one changed. `undefined` empties the field, which removes it. */
|
|
25
|
+
export declare function withValue(values: Readonly<Record<string, unknown>>, fieldId: string, value: unknown): Record<string, unknown>;
|
|
26
|
+
/** Whether two sets of field values hold the same content, whatever order their fields are in. */
|
|
27
|
+
export declare function sameData(a: unknown, b: unknown): boolean;
|
|
28
|
+
/** One thing in every language it exists in: the versions of an entry that translate each other. */
|
|
29
|
+
export interface EntryGroup {
|
|
30
|
+
/** The version to show and open first: the reader's language if there is one. */
|
|
31
|
+
readonly primary: Entry;
|
|
32
|
+
/** Every version, the primary first. */
|
|
33
|
+
readonly versions: readonly Entry[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Puts translations of the same entry together, keeping the order of the list: a group sits
|
|
37
|
+
* where its first version was.
|
|
38
|
+
*/
|
|
39
|
+
export declare function groupTranslations(entries: readonly Entry[], locale: string): EntryGroup[];
|
|
40
|
+
/**
|
|
41
|
+
* Where an entry's own page is on the site, or `null` when it has none yet. The pattern for the
|
|
42
|
+
* entry's language is used when the type has one, and the type's main pattern otherwise.
|
|
43
|
+
*/
|
|
44
|
+
export declare function entryAddress(type: ContentTypeDef, entry: Pick<Entry, 'locale' | 'slug' | 'data'>): string | null;
|
|
45
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAQxD;AAED,oGAAoG;AACpG,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CASzF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAGhH"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { pageAddress, hasUnpublishedChanges, liveFields, } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The text for a language, falling back to its base language (`es` for `es-ES`), then to any. */
|
|
3
|
+
export function localized(text, locale) {
|
|
4
|
+
return text[locale] ?? text[locale.split('-')[0] ?? locale] ?? Object.values(text)[0] ?? '';
|
|
5
|
+
}
|
|
6
|
+
/** A language's name in the reader's own language: `Spanish` for `es`. The tag itself if it has no name. */
|
|
7
|
+
export function languageName(tag, locale) {
|
|
8
|
+
try {
|
|
9
|
+
return new Intl.DisplayNames(locale, { type: 'language' }).of(tag) ?? tag;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return tag;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* What to call an entry in a list: the value of the field its content type names, or of its
|
|
17
|
+
* first text field when the type names none. `null` when that is empty.
|
|
18
|
+
*/
|
|
19
|
+
export function entryTitle(type, data) {
|
|
20
|
+
const path = type.titlePath ?? liveFields(type.fields).filter((candidate) => candidate.type === 'text').slice(0, 1).map((field) => field.id);
|
|
21
|
+
let value = data;
|
|
22
|
+
for (const id of path)
|
|
23
|
+
value = typeof value === 'object' && value !== null ? value[id] : undefined;
|
|
24
|
+
return typeof value === 'string' && value.trim() !== '' ? value : null;
|
|
25
|
+
}
|
|
26
|
+
/** A field of a type and its value in an entry, found by a path of field ids from the top down. */
|
|
27
|
+
export function fieldAt(type, data, path) {
|
|
28
|
+
let fields = type.fields;
|
|
29
|
+
let value = data;
|
|
30
|
+
let found;
|
|
31
|
+
for (const id of path) {
|
|
32
|
+
found = fields.find((candidate) => candidate.id === id && candidate.deletedAt === undefined);
|
|
33
|
+
if (!found)
|
|
34
|
+
return null;
|
|
35
|
+
value = typeof value === 'object' && value !== null ? value[id] : undefined;
|
|
36
|
+
fields = Array.isArray(found.options['fields']) ? found.options['fields'] : [];
|
|
37
|
+
}
|
|
38
|
+
return found ? { field: found, value } : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The name of the image a list shows for an entry, from the field its type names. For a field
|
|
42
|
+
* that holds several images, the first.
|
|
43
|
+
*/
|
|
44
|
+
export function entryImage(type, data) {
|
|
45
|
+
const at = type.list?.imagePath ? fieldAt(type, data, type.list.imagePath) : null;
|
|
46
|
+
const value = Array.isArray(at?.value) ? at.value[0] : at?.value;
|
|
47
|
+
return typeof value === 'string' && value !== '' ? value : null;
|
|
48
|
+
}
|
|
49
|
+
export function entryState(entry) {
|
|
50
|
+
// Set to go out at a time, whether or not an earlier version is on the site meanwhile.
|
|
51
|
+
if (entry.publishAt !== undefined)
|
|
52
|
+
return 'scheduled';
|
|
53
|
+
if (hasUnpublishedChanges(entry))
|
|
54
|
+
return 'unpublishedChanges';
|
|
55
|
+
return entry.status;
|
|
56
|
+
}
|
|
57
|
+
/** A copy of field values with one changed. `undefined` empties the field, which removes it. */
|
|
58
|
+
export function withValue(values, fieldId, value) {
|
|
59
|
+
const { [fieldId]: _previous, ...rest } = values;
|
|
60
|
+
return value === undefined ? rest : { ...rest, [fieldId]: value };
|
|
61
|
+
}
|
|
62
|
+
/** Whether two sets of field values hold the same content, whatever order their fields are in. */
|
|
63
|
+
export function sameData(a, b) {
|
|
64
|
+
if (a === b)
|
|
65
|
+
return true;
|
|
66
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
|
|
67
|
+
return false;
|
|
68
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
69
|
+
return false;
|
|
70
|
+
const left = a;
|
|
71
|
+
const right = b;
|
|
72
|
+
const keys = Object.keys(left);
|
|
73
|
+
return keys.length === Object.keys(right).length && keys.every((key) => key in right && sameData(left[key], right[key]));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Puts translations of the same entry together, keeping the order of the list: a group sits
|
|
77
|
+
* where its first version was.
|
|
78
|
+
*/
|
|
79
|
+
export function groupTranslations(entries, locale) {
|
|
80
|
+
const base = locale.split('-')[0] ?? locale;
|
|
81
|
+
const groups = new Map();
|
|
82
|
+
for (const entry of entries)
|
|
83
|
+
groups.set(entry.translationGroup, [...(groups.get(entry.translationGroup) ?? []), entry]);
|
|
84
|
+
return [...groups.values()].map((versions) => {
|
|
85
|
+
const primary = versions.find((entry) => entry.locale === locale) ?? versions.find((entry) => entry.locale.split('-')[0] === base) ?? versions[0];
|
|
86
|
+
if (!primary)
|
|
87
|
+
throw new Error('A group of translations has no entries.');
|
|
88
|
+
return { primary, versions: [primary, ...versions.filter((entry) => entry !== primary)] };
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Where an entry's own page is on the site, or `null` when it has none yet. The pattern for the
|
|
93
|
+
* entry's language is used when the type has one, and the type's main pattern otherwise.
|
|
94
|
+
*/
|
|
95
|
+
export function entryAddress(type, entry) {
|
|
96
|
+
const urlPattern = type.localizedUrlPatterns?.[entry.locale] ?? type.urlPattern;
|
|
97
|
+
return urlPattern === undefined ? null : pageAddress({ urlPattern, fields: type.fields }, entry, entry.locale);
|
|
98
|
+
}
|
|
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AC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClJ,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5F,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAoB,EAAE,KAA8C;IAC/F,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC;IAChF,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The most a file of rows may hold. Past this the person is asked to split it. */
|
|
2
|
+
export declare const MAX_CSV_ROWS = 5000;
|
|
3
|
+
/**
|
|
4
|
+
* Reads a table saved as text (CSV): rows of cells, with quoted cells that may hold the
|
|
5
|
+
* separator, a line break or a doubled quote. The separator is the comma, or the semicolon or
|
|
6
|
+
* tab when the first line has more of those, as spreadsheets in some countries save it. Empty
|
|
7
|
+
* rows are left out and every cell is trimmed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseCsv(text: string): string[][];
|
|
10
|
+
//# sourceMappingURL=csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../src/lib/csv.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAmCjD"}
|
package/dist/lib/csv.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** The most a file of rows may hold. Past this the person is asked to split it. */
|
|
2
|
+
export const MAX_CSV_ROWS = 5000;
|
|
3
|
+
/**
|
|
4
|
+
* Reads a table saved as text (CSV): rows of cells, with quoted cells that may hold the
|
|
5
|
+
* separator, a line break or a doubled quote. The separator is the comma, or the semicolon or
|
|
6
|
+
* tab when the first line has more of those, as spreadsheets in some countries save it. Empty
|
|
7
|
+
* rows are left out and every cell is trimmed.
|
|
8
|
+
*/
|
|
9
|
+
export function parseCsv(text) {
|
|
10
|
+
const source = text.replace(/^\uFEFF/, '');
|
|
11
|
+
const firstLine = source.split(/\r?\n/, 1)[0] ?? '';
|
|
12
|
+
const count = (mark) => firstLine.split(mark).length - 1;
|
|
13
|
+
const separator = [',', ';', '\t'].reduce((best, mark) => (count(mark) > count(best) ? mark : best), ',');
|
|
14
|
+
const rows = [];
|
|
15
|
+
let row = [];
|
|
16
|
+
let cell = '';
|
|
17
|
+
let quoted = false;
|
|
18
|
+
const endCell = () => {
|
|
19
|
+
row.push(cell.trim());
|
|
20
|
+
cell = '';
|
|
21
|
+
};
|
|
22
|
+
const endRow = () => {
|
|
23
|
+
endCell();
|
|
24
|
+
if (row.some((value) => value !== ''))
|
|
25
|
+
rows.push(row);
|
|
26
|
+
row = [];
|
|
27
|
+
};
|
|
28
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
29
|
+
const character = source[index];
|
|
30
|
+
if (quoted) {
|
|
31
|
+
if (character !== '"')
|
|
32
|
+
cell += character;
|
|
33
|
+
else if (source[index + 1] === '"') {
|
|
34
|
+
cell += '"';
|
|
35
|
+
index += 1;
|
|
36
|
+
}
|
|
37
|
+
else
|
|
38
|
+
quoted = false;
|
|
39
|
+
}
|
|
40
|
+
else if (character === '"' && cell.trim() === '') {
|
|
41
|
+
cell = '';
|
|
42
|
+
quoted = true;
|
|
43
|
+
}
|
|
44
|
+
else if (character === separator)
|
|
45
|
+
endCell();
|
|
46
|
+
else if (character === '\n')
|
|
47
|
+
endRow();
|
|
48
|
+
else if (character !== '\r')
|
|
49
|
+
cell += character;
|
|
50
|
+
}
|
|
51
|
+
endRow();
|
|
52
|
+
return rows;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=csv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.js","sourceRoot":"","sources":["../../src/lib/csv.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1G,MAAM,IAAI,GAAe,EAAE,CAAC;IAC5B,IAAI,GAAG,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AAI,SAAS,CAAC;IACjD,CAAC;IACD,MAAM,EAAE,CAAC;IACT,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The part of the day a greeting is for. */
|
|
2
|
+
export type DayPart = 'morning' | 'afternoon' | 'evening';
|
|
3
|
+
/** Morning until noon, afternoon until six, evening after: by the person's own clock. */
|
|
4
|
+
export declare function dayPart(now?: Date): DayPart;
|
|
5
|
+
//# sourceMappingURL=day-part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day-part.d.ts","sourceRoot":"","sources":["../../src/lib/day-part.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1D,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAKvD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Morning until noon, afternoon until six, evening after: by the person's own clock. */
|
|
2
|
+
export function dayPart(now = new Date()) {
|
|
3
|
+
const hour = now.getHours();
|
|
4
|
+
if (hour >= 5 && hour < 12)
|
|
5
|
+
return 'morning';
|
|
6
|
+
if (hour >= 12 && hour < 18)
|
|
7
|
+
return 'afternoon';
|
|
8
|
+
return 'evening';
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=day-part.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day-part.js","sourceRoot":"","sources":["../../src/lib/day-part.ts"],"names":[],"mappings":"AAGA,yFAAyF;AACzF,MAAM,UAAU,OAAO,CAAC,MAAY,IAAI,IAAI,EAAE;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IAC7C,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,WAAW,CAAC;IAChD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/lib/download.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO3E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hands the person a file made in the editor, such as an export. The browser saves it under
|
|
3
|
+
* `name`; nothing is sent anywhere.
|
|
4
|
+
*/
|
|
5
|
+
export function downloadText(name, text, type) {
|
|
6
|
+
const address = URL.createObjectURL(new Blob([text], { type }));
|
|
7
|
+
const link = document.createElement('a');
|
|
8
|
+
link.href = address;
|
|
9
|
+
link.download = name;
|
|
10
|
+
link.click();
|
|
11
|
+
URL.revokeObjectURL(address);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/lib/download.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,IAAY,EAAE,IAAY;IACnE,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A key for a field, from what it is called: `Listed on` becomes `listedOn`. */
|
|
2
|
+
export declare function fieldKeyFrom(name: string): string;
|
|
3
|
+
/** A key for a content type, from what it is called: `Case studies` becomes `case-studies`. */
|
|
4
|
+
export declare function typeKeyFrom(name: string): string;
|
|
5
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/lib/keys.ts"],"names":[],"mappings":"AAiBA,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
package/dist/lib/keys.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The words of a name, lowercased and without accents or signs: `Listed on` gives `listed`, `on`. */
|
|
2
|
+
function wordsOf(name) {
|
|
3
|
+
return name
|
|
4
|
+
.normalize('NFKD')
|
|
5
|
+
.replace(/[̀-ͯ]/g, '')
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.split(/[^a-z0-9]+/)
|
|
8
|
+
.filter(Boolean);
|
|
9
|
+
}
|
|
10
|
+
/** A key cannot start with a number, so one that would is left without its first numbers. */
|
|
11
|
+
const startingWithALetter = (words) => {
|
|
12
|
+
const [first = '', ...rest] = words;
|
|
13
|
+
const trimmed = first.replace(/^[0-9]+/, '');
|
|
14
|
+
return trimmed === '' ? (rest.length > 0 ? startingWithALetter(rest) : []) : [trimmed, ...rest];
|
|
15
|
+
};
|
|
16
|
+
/** A key for a field, from what it is called: `Listed on` becomes `listedOn`. */
|
|
17
|
+
export function fieldKeyFrom(name) {
|
|
18
|
+
return startingWithALetter(wordsOf(name))
|
|
19
|
+
.map((word, index) => (index === 0 ? word : `${word.charAt(0).toUpperCase()}${word.slice(1)}`))
|
|
20
|
+
.join('');
|
|
21
|
+
}
|
|
22
|
+
/** A key for a content type, from what it is called: `Case studies` becomes `case-studies`. */
|
|
23
|
+
export function typeKeyFrom(name) {
|
|
24
|
+
return startingWithALetter(wordsOf(name)).join('-');
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/lib/keys.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,6FAA6F;AAC7F,MAAM,mBAAmB,GAAG,CAAC,KAAe,EAAY,EAAE;IACxD,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IACpC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAClG,CAAC,CAAC;AAEF,iFAAiF;AACjF,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACtC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC9F,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type NewUpload } from '@velocity-astro/cms-core';
|
|
2
|
+
/**
|
|
3
|
+
* Gets a file from the person's computer ready to send. A photo that is larger than a page
|
|
4
|
+
* ever shows, heavier than the site takes, or in a format the site does not keep (a phone's
|
|
5
|
+
* HEIC, where the browser can read it) is drawn again smaller, here in the browser, so a
|
|
6
|
+
* 12 MB photo from a phone simply works. Anything else is sent as it is, and the server decides.
|
|
7
|
+
*
|
|
8
|
+
* @param maxBytes The largest file the site takes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function prepareImage(file: File, maxBytes: number): Promise<NewUpload>;
|
|
11
|
+
//# sourceMappingURL=prepare-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-image.d.ts","sourceRoot":"","sources":["../../src/lib/prepare-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAuBrE;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAmBnF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { readImage } from '@velocity-astro/cms-core';
|
|
2
|
+
/** No page shows a photo wider than this, and a phone's camera makes them twice as wide. */
|
|
3
|
+
const LONGEST_SIDE = 2560;
|
|
4
|
+
const JPEG_QUALITY = 0.86;
|
|
5
|
+
const withEnding = (fileName, ending) => `${fileName.replace(/\.[^.]*$/, '')}.${ending}`;
|
|
6
|
+
function drawn(picture, scale, type) {
|
|
7
|
+
const canvas = document.createElement('canvas');
|
|
8
|
+
canvas.width = Math.max(1, Math.round(picture.width * scale));
|
|
9
|
+
canvas.height = Math.max(1, Math.round(picture.height * scale));
|
|
10
|
+
const context = canvas.getContext('2d');
|
|
11
|
+
if (!context)
|
|
12
|
+
return Promise.resolve(null);
|
|
13
|
+
if (type === 'image/jpeg') {
|
|
14
|
+
// A JPEG has no see-through parts: without this they would turn black.
|
|
15
|
+
context.fillStyle = '#fff';
|
|
16
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
17
|
+
}
|
|
18
|
+
context.drawImage(picture, 0, 0, canvas.width, canvas.height);
|
|
19
|
+
return new Promise((resolve) => canvas.toBlob(resolve, type, JPEG_QUALITY));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets a file from the person's computer ready to send. A photo that is larger than a page
|
|
23
|
+
* ever shows, heavier than the site takes, or in a format the site does not keep (a phone's
|
|
24
|
+
* HEIC, where the browser can read it) is drawn again smaller, here in the browser, so a
|
|
25
|
+
* 12 MB photo from a phone simply works. Anything else is sent as it is, and the server decides.
|
|
26
|
+
*
|
|
27
|
+
* @param maxBytes The largest file the site takes.
|
|
28
|
+
*/
|
|
29
|
+
export async function prepareImage(file, maxBytes) {
|
|
30
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
31
|
+
const asIs = { fileName: file.name, bytes };
|
|
32
|
+
const facts = readImage(bytes);
|
|
33
|
+
const fits = facts !== null && Math.max(facts.width, facts.height) <= LONGEST_SIDE && bytes.length <= maxBytes;
|
|
34
|
+
if (fits || typeof createImageBitmap !== 'function')
|
|
35
|
+
return asIs;
|
|
36
|
+
const picture = await createImageBitmap(file).catch(() => null);
|
|
37
|
+
if (!picture)
|
|
38
|
+
return asIs;
|
|
39
|
+
try {
|
|
40
|
+
const scale = Math.min(1, LONGEST_SIDE / Math.max(picture.width, picture.height));
|
|
41
|
+
// A PNG stays a PNG, since it may have see-through parts. Everything else becomes a JPEG.
|
|
42
|
+
const type = facts?.contentType === 'image/png' ? 'image/png' : 'image/jpeg';
|
|
43
|
+
const smaller = await drawn(picture, scale, type);
|
|
44
|
+
if (!smaller)
|
|
45
|
+
return asIs;
|
|
46
|
+
return { fileName: withEnding(file.name, type === 'image/png' ? 'png' : 'jpg'), bytes: new Uint8Array(await smaller.arrayBuffer()) };
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
picture.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=prepare-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-image.js","sourceRoot":"","sources":["../../src/lib/prepare-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,0BAA0B,CAAC;AAErE,4FAA4F;AAC5F,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,MAAc,EAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC;AAEjH,SAAS,KAAK,CAAC,OAAoB,EAAE,KAAa,EAAE,IAAgC;IAClF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAC9D,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;I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C,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAClF,0FAA0F;QAC1F,MAAM,IAAI,GAAG,KAAK,EAAE,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC;QAC7E,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;IACvI,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A tab opened for a preview before its address is known. */
|
|
2
|
+
export interface PreviewTab {
|
|
3
|
+
/** Shows a page of this site in the tab. Anything but a path on this site is refused. */
|
|
4
|
+
readonly show: (path: string) => void;
|
|
5
|
+
/** Closes the tab, when there turned out to be nothing to show. */
|
|
6
|
+
readonly close: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Opens an empty tab now, to be given its address later. A browser lets a page open a tab only
|
|
10
|
+
* while it is answering a click, and the address of a preview is known a moment after: the draft
|
|
11
|
+
* is saved first. When the browser refuses the tab, the preview takes this one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function openPreviewTab(): PreviewTab;
|
|
14
|
+
//# sourceMappingURL=preview-tab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-tab.d.ts","sourceRoot":"","sources":["../../src/lib/preview-tab.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,WAAW,UAAU;IACzB,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAID;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAc3C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const isOwnPath = (path) => path.startsWith('/') && !path.startsWith('//');
|
|
2
|
+
/**
|
|
3
|
+
* Opens an empty tab now, to be given its address later. A browser lets a page open a tab only
|
|
4
|
+
* while it is answering a click, and the address of a preview is known a moment after: the draft
|
|
5
|
+
* is saved first. When the browser refuses the tab, the preview takes this one.
|
|
6
|
+
*/
|
|
7
|
+
export function openPreviewTab() {
|
|
8
|
+
const tab = window.open('', '_blank');
|
|
9
|
+
return {
|
|
10
|
+
show: (path) => {
|
|
11
|
+
if (!isOwnPath(path)) {
|
|
12
|
+
tab?.close();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const address = new URL(path, window.location.origin).href;
|
|
16
|
+
if (tab)
|
|
17
|
+
tab.location.href = address;
|
|
18
|
+
else
|
|
19
|
+
window.location.assign(address);
|
|
20
|
+
},
|
|
21
|
+
close: () => tab?.close(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=preview-tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-tab.js","sourceRoot":"","sources":["../../src/lib/preview-tab.ts"],"names":[],"mappings":"AAQA,MAAM,SAAS,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAE5F;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACtC,OAAO;QACL,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,GAAG,EAAE,KAAK,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC3D,IAAI,GAAG;gBAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC;;gBAChC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-time.d.ts","sourceRoot":"","sources":["../../src/lib/relative-time.ts"],"names":[],"mappings":"AAQA,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAO9F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const STEPS = [
|
|
2
|
+
['year', 365 * 24 * 60 * 60 * 1000],
|
|
3
|
+
['month', 30 * 24 * 60 * 60 * 1000],
|
|
4
|
+
['day', 24 * 60 * 60 * 1000],
|
|
5
|
+
['hour', 60 * 60 * 1000],
|
|
6
|
+
['minute', 60 * 1000],
|
|
7
|
+
];
|
|
8
|
+
/** A time as people say it: "2 hours ago", "yesterday", "now". */
|
|
9
|
+
export function relativeTime(timestamp, locale, now = new Date()) {
|
|
10
|
+
const format = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
|
|
11
|
+
const difference = new Date(timestamp).getTime() - now.getTime();
|
|
12
|
+
for (const [unit, size] of STEPS) {
|
|
13
|
+
if (Math.abs(difference) >= size)
|
|
14
|
+
return format.format(Math.round(difference / size), unit);
|
|
15
|
+
}
|
|
16
|
+
return format.format(0, 'second');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=relative-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-time.js","sourceRoot":"","sources":["../../src/lib/relative-time.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAgE;IACzE,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACnC,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACnC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACxB,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,MAAc,EAAE,MAAY,IAAI,IAAI,EAAE;IACpF,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACjE,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI;YAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../src/lib/slug.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO5C"}
|
package/dist/lib/slug.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A slug made from a title: "Café on 5th St." becomes `cafe-on-5th-st`. */
|
|
2
|
+
export function slugify(text) {
|
|
3
|
+
return text
|
|
4
|
+
.normalize('NFKD')
|
|
5
|
+
.replace(/\p{M}/gu, '')
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
8
|
+
.replace(/^-+|-+$/g, '');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=slug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/lib/slug.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;SACtB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-icon.d.ts","sourceRoot":"","sources":["../../src/lib/type-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyH,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AA2BtK,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,UAAkD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Building2, CalendarDays, FileText, HelpCircle, MapPin, MessageCircle, Package, PanelsTopLeft, PenLine, Tag, UserRound } from 'lucide-react';
|
|
2
|
+
/**
|
|
3
|
+
* An icon for a content type, guessed from its key, so the navigation is not a column of the
|
|
4
|
+
* same icon. Content types will be able to choose their own; until then anything not listed
|
|
5
|
+
* here gets the plain document.
|
|
6
|
+
*/
|
|
7
|
+
const ICONS = {
|
|
8
|
+
listings: Building2,
|
|
9
|
+
properties: Building2,
|
|
10
|
+
agents: UserRound,
|
|
11
|
+
team: UserRound,
|
|
12
|
+
people: UserRound,
|
|
13
|
+
authors: UserRound,
|
|
14
|
+
neighborhoods: MapPin,
|
|
15
|
+
locations: MapPin,
|
|
16
|
+
reviews: MessageCircle,
|
|
17
|
+
testimonials: MessageCircle,
|
|
18
|
+
posts: PenLine,
|
|
19
|
+
blog: PenLine,
|
|
20
|
+
pages: PanelsTopLeft,
|
|
21
|
+
products: Package,
|
|
22
|
+
events: CalendarDays,
|
|
23
|
+
faqs: HelpCircle,
|
|
24
|
+
categories: Tag,
|
|
25
|
+
};
|
|
26
|
+
export const typeIcon = (key) => ICONS[key.toLowerCase()] ?? FileText;
|
|
27
|
+
//# sourceMappingURL=type-icon.js.map
|