codelessly_api 24.0.0
codelessly_api: ^24.0.0 copied to clipboard
Flutter's widgets and layouts as plain, immutable data with a JSON format. The model behind the Codelessly Editor and the Codelessly SDK. Pure Dart.
24.0.0 #
Breaking changes
- The built-in Mailchimp service of
SubmitFormActionis removed:FormService.mailchimp, and theapiKey,dataCenter,listId,emailField,firstNameFieldandlastNameFieldfields (of the action and ofSubmitFormFields). A layout must not carry a provider's API key, and the packages don't call third-party services. SubmitFormAction()and{"type": "submitForm"}now default toFormService.local.
New
-
RetryFailedAction(retryFailed): in anactionErrorreaction, runs the failed action chain again. -
Paywall test store data:
ProductSlot.test(ProductTestData:price,rawPrice,currency,currencySymbol,period—week,month,yearor '' for lifetime —,trialDays,entitlementIdandoutcome, aTestPurchaseOutcome:purchased(default),declinedorcancelled) andPaywallConfig.testStore("testStore": trueon the publishedpaywall). The SDK's test store runs a paywall's whole flow from them on the web (preview and demo sites) without a store or a payment; it never grants real entitlements. Both are omitted when unset, so existing JSON is unchanged; real stores ignore them. -
Backdrop screens:
CanvasProps.backdrop("props": {"backdrop": true}on a canvas) marks a screen drawn once beneath every screen, outside navigation (a sky that stays still while screens move over it).PublishModellists them inbackdropLayoutIds(omitted when empty);backdropsis the published, enabled ones. A canvas bothoverlayandbackdropis an overlay. -
LoadCloudDataAction.scope(CloudDataScope.screen, the default, orapp;LoadCloudDataFields.scope):"scope": "app"asks the runtime to keep one live subscription for the whole app, shared by every screen that runs the same load, writing an app variable. Omitted whenscreen, so existing JSON is unchanged; older runtimes ignore it and load per screen. -
Dark colors:
NamedColorStyle.dark(an optional second paint,"dark": {...}, omitted when absent) anddarkColor;ThemeTokens.dark(the colors that differ in dark mode),ThemeTokens.colorsandThemeTokens.textStyles(every named style byThemeTokens.themeKey),forBrightness(dark:)andhasDark.StyleSheet.themefills them. Old style sheets and themes decode and re-encode unchanged. -
Data rules for server-written data:
DataRule.ownerRead(each user reads their own documents; only the project's editors, the server and the collection's role write) andDataRule.audience(a user reads a document whoseaudiencelist names*,signedIn,role:{role}oruser:{uid}, checked at read time).DataRules.ownerFieldslists the fields anownerReadowner may change (areadflag);DataRules.expirynames a collection's expiry field, past which app users can't read a document. Helpers:DataRules.audienceOf,roleAudience,userAudience,neverExpires,expiryFieldFor,ownerFieldsFor; traitsreadsAudience,writtenByRole. Older JSON decodes and re-encodes unchanged; an older reader drops the new rules (reads them asapp), and the database rules then refuse its reads and writes instead of opening the collection. -
Automations:
Automation(AutomationTriggerappStart,sessionStart,resume,event,interval,screenShown; awhenformula;maxRuns,maxPerSession,everyDays;delayMs,priority;actions),AutomationFields, andPublishModel.automations/withAutomations(the model'sautomations, kept inextra: a model without them encodes as before). -
EmitEventAction(emitEvent:event,props): fires an app event on the runtime's event bus. -
CaptureScreenshotAction(captureScreenshot:targetlayout/node/app,node,pixelRatio):${result.image}is a PNGdata:URL. -
ModalPresentation.banner: a modal along the top (or bottom) edge with no barrier. Runtimes that don't know it decode it asdialog. -
CallFunctionAction.optional: a function the app didn't register givesnullinstead of failing the chain. -
CloudFilesAction.sourceandfileName: upload a value (adata:URL,{"data", "name"}, or a list) instead of asking the user to pick files. -
ListViewProps.stickToEnd: a list that opens at its end, keeps its place when items are put before the ones on screen, and follows new items at the end only while scrolled there (a chat, a log). -
FormService.unsupported: older JSON withservice: mailchimp, with noserviceand the removed fields, or with an unknown service decodes as this (it never throws). The removed fields are read past and never written back out.SubmitFormFields.serviceoffers onlylocal. -
Live cloud data bindings (all optional keys; older layouts decode and re-encode unchanged):
LoadCloudDataAction.limit(a number or expression;0: all),aggregate(CloudLoadAggregate: count, sum, average) withaggregateField,refreshSeconds,reactive;kDefaultCloudLoadLimit(500), the limit a runtime applies when neither the action nor its query gives one.CloudQueryDef.joins:CloudJoin {collection, as, id | localField + foreignField, many}.ReloadCloudDataAction(reloadCloudData { variable }), withReloadCloudDataFieldsand itsActionSpec.CloudBatchAction.forEach(steps per item of a list, one commit) andkMaxCloudBatchWrites(500).Trigger.onceKey(once per key per app session) andTrigger.visibleMs(enterViewport after staying in view).ListViewProps.pullToRefresh: pull to refresh without pagination.- Their editor fields:
LoadCloudDataFields,CloudBatchFields.forEach,TriggerFields.visibleMs/onceKey.
Migration
- Stored layouts need no change to load. An old newsletter submission no longer sends anything: a runtime fails
it as
unsupported_service. To keep collecting sign-ups, use acallApiaction to your own endpoint, which holds the provider's key server-side. See docs/submit_form.md. - Code that read the removed fields or matched
FormService.mailchimpshould drop them, and handleFormService.unsupportedwhere it switches overFormService.
23.0.0 #
New
- Models for managed paywall placements, product slots, offers, and purchase outcomes.
- Action and widget data for form submission, conditional reveal, generated files, print, image lifecycle, media playback controls and status, and sound waveforms.
- Model support for charts and gauges, masonry layouts, stroke progress, and symbol fallback.
- Documented video readiness and action error trigger values.
22.0.0 #
Breaking changes
Behavioursis nowBehaviors.BehaviourFieldsis nowBehaviorFields.Node.behavioursis nowNode.behaviors, and thebehaviours:parameter ofNode()andNode.copyWithis nowbehaviors:.
The JSON format is unchanged: behaviors are stored flat in the node's JSON under the same keys.
21.0.1 #
- Documentation: a cleaner README.
21.0.0 #
Breaking changes
- Requires Dart 3.12 or newer.
- Requires
collection1.19.1 or newer andmeta1.19.0 or newer. If your app pins older versions of either, raise them alongside this package.
New
- A guide to the model, with runnable samples in
example/: docs/guide.
The model classes and the JSON format are unchanged from 20.0.1.
20.0.1 #
New
StyleSheetholds a project's named text and color styles (NamedTextStyle,NamedColorStyle).StyleSheet.themereads theThemeTokensfrom them by name.
20.0.0 #
Breaking changes
- A new data model and JSON format (
"schema": 2). Nodes use Flutter's own parameter names, types and defaults, and a layout is aLayoutDocument: its canvases and every node in one flat map. - Decoding is total:
fromJsonnever throws, unknown keys and node types round-trip, and a bad value falls back to its default. Encoding is sparse: values equal to Flutter's defaults are not written.